@tailwindcss/oxide-wasm32-wasi 0.0.0-insiders.d801d8d
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/README.md +3 -0
- package/node_modules/@emnapi/core/LICENSE +21 -0
- package/node_modules/@emnapi/core/README.md +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.js +6661 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.d.ts +363 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.d.mts +363 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.d.ts +365 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +7411 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.js +8390 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.min.d.mts +363 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.min.js +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.min.mjs +1 -0
- package/node_modules/@emnapi/core/dist/emnapi-core.mjs +6650 -0
- package/node_modules/@emnapi/core/index.js +5 -0
- package/node_modules/@emnapi/core/package.json +49 -0
- package/node_modules/@emnapi/runtime/LICENSE +21 -0
- package/node_modules/@emnapi/runtime/README.md +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +1347 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.d.ts +663 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.d.mts +663 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.d.ts +665 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +1403 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +420 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +1474 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.js +1475 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.min.d.mts +663 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -0
- package/node_modules/@emnapi/runtime/dist/emnapi.mjs +1316 -0
- package/node_modules/@emnapi/runtime/index.js +5 -0
- package/node_modules/@emnapi/runtime/package.json +48 -0
- package/node_modules/@emnapi/wasi-threads/LICENSE +21 -0
- package/node_modules/@emnapi/wasi-threads/README.md +203 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +881 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +214 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js +1 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts +214 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +216 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +929 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +941 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +214 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js +1 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs +1 -0
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs +876 -0
- package/node_modules/@emnapi/wasi-threads/index.js +5 -0
- package/node_modules/@emnapi/wasi-threads/package.json +50 -0
- package/node_modules/@napi-rs/wasm-runtime/LICENSE +43 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +23712 -0
- package/node_modules/@napi-rs/wasm-runtime/dist/runtime.js +12269 -0
- package/node_modules/@napi-rs/wasm-runtime/fs-proxy.cjs +193 -0
- package/node_modules/@napi-rs/wasm-runtime/package.json +60 -0
- package/node_modules/@napi-rs/wasm-runtime/runtime.cjs +15 -0
- package/node_modules/@tybys/wasm-util/README.md +193 -0
- package/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +11 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +417 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +2738 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +2738 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.js +2760 -0
- package/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +1 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +158 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/index.js +13 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +46 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/load.js +97 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/memory.js +35 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +103 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +268 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +3 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +194 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +174 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +1544 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +141 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +220 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +128 -0
- package/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +13 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +153 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +9 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +39 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +89 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +28 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +97 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +256 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +1 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +188 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +168 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +1539 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +135 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +216 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +113 -0
- package/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +9 -0
- package/node_modules/@tybys/wasm-util/package.json +58 -0
- package/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/node_modules/tslib/LICENSE.txt +12 -0
- package/node_modules/tslib/README.md +164 -0
- package/node_modules/tslib/SECURITY.md +41 -0
- package/node_modules/tslib/modules/index.d.ts +38 -0
- package/node_modules/tslib/modules/index.js +70 -0
- package/node_modules/tslib/modules/package.json +3 -0
- package/node_modules/tslib/package.json +47 -0
- package/node_modules/tslib/tslib.d.ts +460 -0
- package/node_modules/tslib/tslib.es6.html +1 -0
- package/node_modules/tslib/tslib.es6.js +393 -0
- package/node_modules/tslib/tslib.es6.mjs +392 -0
- package/node_modules/tslib/tslib.html +1 -0
- package/node_modules/tslib/tslib.js +475 -0
- package/package.json +45 -0
- package/tailwindcss-oxide.wasi-browser.js +63 -0
- package/tailwindcss-oxide.wasi.cjs +88 -0
- package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
- package/wasi-worker-browser.mjs +39 -0
- package/wasi-worker.mjs +63 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import type { Context } from '@emnapi/runtime';
|
|
4
|
+
import type { ReferenceOwnership } from '@emnapi/runtime';
|
|
5
|
+
import type { Worker as Worker_2 } from 'worker_threads';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export declare type BaseCreateOptions = {
|
|
9
|
+
filename?: string
|
|
10
|
+
nodeBinding?: NodeBinding
|
|
11
|
+
reuseWorker?: ThreadManagerOptionsMain['reuseWorker']
|
|
12
|
+
asyncWorkPoolSize?: number
|
|
13
|
+
waitThreadStart?: MainThreadBaseOptions['waitThreadStart']
|
|
14
|
+
onCreateWorker?: (info: CreateWorkerInfo) => any
|
|
15
|
+
print?: (str: string) => void
|
|
16
|
+
printErr?: (str: string) => void
|
|
17
|
+
postMessage?: (msg: any) => any
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** @public */
|
|
21
|
+
export declare interface BaseOptions {
|
|
22
|
+
wasi: WASIInstance;
|
|
23
|
+
version?: 'preview1';
|
|
24
|
+
wasm64?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** @public */
|
|
28
|
+
export declare interface ChildThreadOptions extends BaseOptions {
|
|
29
|
+
childThread: true;
|
|
30
|
+
postMessage?: (data: any) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @public */
|
|
34
|
+
export declare function createInstanceProxy(instance: WebAssembly.Instance, memory?: WebAssembly.Memory | (() => WebAssembly.Memory)): WebAssembly.Instance;
|
|
35
|
+
|
|
36
|
+
/** @public */
|
|
37
|
+
export declare function createNapiModule (
|
|
38
|
+
options: CreateOptions
|
|
39
|
+
): NapiModule
|
|
40
|
+
|
|
41
|
+
/** @public */
|
|
42
|
+
export declare type CreateOptions = BaseCreateOptions & ({
|
|
43
|
+
context: Context
|
|
44
|
+
childThread?: boolean
|
|
45
|
+
} | {
|
|
46
|
+
context?: Context
|
|
47
|
+
childThread: true
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
/** @public */
|
|
51
|
+
export declare interface CreateWorkerInfo {
|
|
52
|
+
type: 'thread' | 'async-work'
|
|
53
|
+
name: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @public */
|
|
57
|
+
export declare interface InitOptions {
|
|
58
|
+
instance: WebAssembly.Instance
|
|
59
|
+
module: WebAssembly.Module
|
|
60
|
+
memory?: WebAssembly.Memory
|
|
61
|
+
table?: WebAssembly.Table
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare type InputType = string | URL | Response | BufferSource | WebAssembly.Module;
|
|
65
|
+
|
|
66
|
+
/** @public */
|
|
67
|
+
export declare interface InstantiatedSource extends LoadedSource {
|
|
68
|
+
napiModule: NapiModule;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @public */
|
|
72
|
+
export declare function instantiateNapiModule(
|
|
73
|
+
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */
|
|
74
|
+
wasmInput: InputType | Promise<InputType>, options: InstantiateOptions): Promise<InstantiatedSource>;
|
|
75
|
+
|
|
76
|
+
/** @public */
|
|
77
|
+
export declare function instantiateNapiModuleSync(wasmInput: BufferSource | WebAssembly.Module, options: InstantiateOptions): InstantiatedSource;
|
|
78
|
+
|
|
79
|
+
/** @public */
|
|
80
|
+
export declare type InstantiateOptions = CreateOptions & LoadOptions;
|
|
81
|
+
|
|
82
|
+
/** @public */
|
|
83
|
+
export declare function isSharedArrayBuffer(value: any): value is SharedArrayBuffer;
|
|
84
|
+
|
|
85
|
+
/** @public */
|
|
86
|
+
export declare function isTrapError(e: Error): e is WebAssembly.RuntimeError;
|
|
87
|
+
|
|
88
|
+
/** @public */
|
|
89
|
+
export declare interface LoadedSource extends WebAssembly.WebAssemblyInstantiatedSource {
|
|
90
|
+
usedInstance: WebAssembly.Instance;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** @public */
|
|
94
|
+
export declare function loadNapiModule(napiModule: NapiModule,
|
|
95
|
+
/** Only support `BufferSource` or `WebAssembly.Module` on Node.js */
|
|
96
|
+
wasmInput: InputType | Promise<InputType>, options?: LoadOptions): Promise<LoadedSource>;
|
|
97
|
+
|
|
98
|
+
/** @public */
|
|
99
|
+
export declare function loadNapiModuleSync(napiModule: NapiModule, wasmInput: BufferSource | WebAssembly.Module, options?: LoadOptions): LoadedSource;
|
|
100
|
+
|
|
101
|
+
/** @public */
|
|
102
|
+
export declare interface LoadOptions {
|
|
103
|
+
wasi?: WASIInstance;
|
|
104
|
+
overwriteImports?: (importObject: WebAssembly.Imports) => WebAssembly.Imports;
|
|
105
|
+
beforeInit?: (source: WebAssembly.WebAssemblyInstantiatedSource) => void;
|
|
106
|
+
getMemory?: (exports: WebAssembly.Exports) => WebAssembly.Memory;
|
|
107
|
+
getTable?: (exports: WebAssembly.Exports) => WebAssembly.Table;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export declare interface LoadPayload {
|
|
111
|
+
wasmModule: WebAssembly.Module;
|
|
112
|
+
wasmMemory: WebAssembly.Memory;
|
|
113
|
+
sab?: Int32Array;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** @public */
|
|
117
|
+
export declare interface MainThreadBaseOptions extends BaseOptions {
|
|
118
|
+
waitThreadStart?: boolean | number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** @public */
|
|
122
|
+
export declare type MainThreadOptions = MainThreadOptionsWithThreadManager | MainThreadOptionsCreateThreadManager;
|
|
123
|
+
|
|
124
|
+
/** @public */
|
|
125
|
+
export declare interface MainThreadOptionsCreateThreadManager extends MainThreadBaseOptions, ThreadManagerOptionsMain {
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** @public */
|
|
129
|
+
export declare interface MainThreadOptionsWithThreadManager extends MainThreadBaseOptions {
|
|
130
|
+
threadManager?: ThreadManager | (() => ThreadManager);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** @public */
|
|
134
|
+
export declare class MessageHandler extends ThreadMessageHandler {
|
|
135
|
+
napiModule: NapiModule | undefined;
|
|
136
|
+
constructor(options: MessageHandlerOptions);
|
|
137
|
+
instantiate(data: LoadPayload): InstantiatedSource | PromiseLike<InstantiatedSource>;
|
|
138
|
+
handle(e: any): void;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** @public */
|
|
142
|
+
export declare interface MessageHandlerOptions extends ThreadMessageHandlerOptions {
|
|
143
|
+
onLoad: (data: LoadPayload) => InstantiatedSource | PromiseLike<InstantiatedSource>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** @public */
|
|
147
|
+
export declare interface NapiModule {
|
|
148
|
+
imports: {
|
|
149
|
+
env: any
|
|
150
|
+
napi: any
|
|
151
|
+
emnapi: any
|
|
152
|
+
}
|
|
153
|
+
exports: any
|
|
154
|
+
loaded: boolean
|
|
155
|
+
filename: string
|
|
156
|
+
childThread: boolean
|
|
157
|
+
emnapi: {
|
|
158
|
+
syncMemory<T extends ArrayBuffer | ArrayBufferView> (
|
|
159
|
+
js_to_wasm: boolean,
|
|
160
|
+
arrayBufferOrView: T,
|
|
161
|
+
offset?: number,
|
|
162
|
+
len?: number
|
|
163
|
+
): T
|
|
164
|
+
getMemoryAddress (arrayBufferOrView: ArrayBuffer | ArrayBufferView): PointerInfo
|
|
165
|
+
addSendListener (worker: any): boolean
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
init (options: InitOptions): any
|
|
169
|
+
initWorker (arg: number): void
|
|
170
|
+
executeAsyncWork (work: number): void
|
|
171
|
+
postMessage?: (msg: any) => any
|
|
172
|
+
|
|
173
|
+
waitThreadStart: boolean | number
|
|
174
|
+
/* Excluded from this release type: PThread */}
|
|
175
|
+
|
|
176
|
+
/** @public */
|
|
177
|
+
export declare interface NodeBinding {
|
|
178
|
+
node: {
|
|
179
|
+
emitAsyncInit: Function
|
|
180
|
+
emitAsyncDestroy: Function
|
|
181
|
+
makeCallback: Function
|
|
182
|
+
}
|
|
183
|
+
napi: {
|
|
184
|
+
asyncInit: Function
|
|
185
|
+
asyncDestroy: Function
|
|
186
|
+
makeCallback: Function
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** @public */
|
|
191
|
+
export declare interface PointerInfo {
|
|
192
|
+
address: number
|
|
193
|
+
ownership: ReferenceOwnership
|
|
194
|
+
runtimeAllocated: 0 | 1
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** @public */
|
|
198
|
+
export declare interface ReuseWorkerOptions {
|
|
199
|
+
/**
|
|
200
|
+
* @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size | PTHREAD_POOL_SIZE}
|
|
201
|
+
*/
|
|
202
|
+
size: number;
|
|
203
|
+
/**
|
|
204
|
+
* @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size-strict | PTHREAD_POOL_SIZE_STRICT}
|
|
205
|
+
*/
|
|
206
|
+
strict?: boolean;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** @public */
|
|
210
|
+
export declare interface StartResult {
|
|
211
|
+
exitCode: number;
|
|
212
|
+
instance: WebAssembly.Instance;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** @public */
|
|
216
|
+
export declare class ThreadManager {
|
|
217
|
+
unusedWorkers: WorkerLike[];
|
|
218
|
+
runningWorkers: WorkerLike[];
|
|
219
|
+
pthreads: Record<number, WorkerLike>;
|
|
220
|
+
get nextWorkerID(): number;
|
|
221
|
+
wasmModule: WebAssembly.Module | null;
|
|
222
|
+
wasmMemory: WebAssembly.Memory | null;
|
|
223
|
+
private readonly messageEvents;
|
|
224
|
+
private readonly _childThread;
|
|
225
|
+
private readonly _onCreateWorker;
|
|
226
|
+
private readonly _reuseWorker;
|
|
227
|
+
private readonly _beforeLoad?;
|
|
228
|
+
/* Excluded from this release type: printErr */
|
|
229
|
+
constructor(options: ThreadManagerOptions);
|
|
230
|
+
init(): void;
|
|
231
|
+
initMainThread(): void;
|
|
232
|
+
private preparePool;
|
|
233
|
+
shouldPreloadWorkers(): boolean;
|
|
234
|
+
loadWasmModuleToAllWorkers(): Promise<WorkerLike[]>;
|
|
235
|
+
preloadWorkers(): Promise<WorkerLike[]>;
|
|
236
|
+
setup(wasmModule: WebAssembly.Module, wasmMemory: WebAssembly.Memory): void;
|
|
237
|
+
markId(worker: WorkerLike): number;
|
|
238
|
+
returnWorkerToPool(worker: WorkerLike): void;
|
|
239
|
+
loadWasmModuleToWorker(worker: WorkerLike, sab?: Int32Array): Promise<WorkerLike>;
|
|
240
|
+
allocateUnusedWorker(): WorkerLike;
|
|
241
|
+
getNewWorker(sab?: Int32Array): WorkerLike | undefined;
|
|
242
|
+
cleanThread(worker: WorkerLike, tid: number, force?: boolean): void;
|
|
243
|
+
terminateWorker(worker: WorkerLike): void;
|
|
244
|
+
terminateAllThreads(): void;
|
|
245
|
+
addMessageEventListener(worker: WorkerLike, onMessage: (e: WorkerMessageEvent) => void): () => void;
|
|
246
|
+
fireMessageEvent(worker: WorkerLike, e: WorkerMessageEvent): void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** @public */
|
|
250
|
+
export declare type ThreadManagerOptions = ThreadManagerOptionsMain | ThreadManagerOptionsChild;
|
|
251
|
+
|
|
252
|
+
/** @public */
|
|
253
|
+
export declare interface ThreadManagerOptionsBase {
|
|
254
|
+
printErr?: (message: string) => void;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** @public */
|
|
258
|
+
export declare interface ThreadManagerOptionsChild extends ThreadManagerOptionsBase {
|
|
259
|
+
childThread: true;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** @public */
|
|
263
|
+
export declare interface ThreadManagerOptionsMain extends ThreadManagerOptionsBase {
|
|
264
|
+
beforeLoad?: (worker: WorkerLike) => any;
|
|
265
|
+
reuseWorker?: boolean | number | ReuseWorkerOptions;
|
|
266
|
+
onCreateWorker: WorkerFactory;
|
|
267
|
+
childThread?: false;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** @public */
|
|
271
|
+
export declare class ThreadMessageHandler {
|
|
272
|
+
protected instance: WebAssembly.Instance | undefined;
|
|
273
|
+
private messagesBeforeLoad;
|
|
274
|
+
protected postMessage: (message: any) => void;
|
|
275
|
+
protected onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike<WebAssembly.WebAssemblyInstantiatedSource>;
|
|
276
|
+
constructor(options?: ThreadMessageHandlerOptions);
|
|
277
|
+
/** @virtual */
|
|
278
|
+
instantiate(data: LoadPayload): WebAssembly.WebAssemblyInstantiatedSource | PromiseLike<WebAssembly.WebAssemblyInstantiatedSource>;
|
|
279
|
+
/** @virtual */
|
|
280
|
+
handle(e: WorkerMessageEvent): void;
|
|
281
|
+
private _load;
|
|
282
|
+
private _start;
|
|
283
|
+
protected _loaded(err: Error | null, source: WebAssembly.WebAssemblyInstantiatedSource | null, payload: LoadPayload): void;
|
|
284
|
+
protected handleAfterLoad<E extends WorkerMessageEvent>(e: E, f: (e: E) => void): void;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** @public */
|
|
288
|
+
export declare interface ThreadMessageHandlerOptions {
|
|
289
|
+
onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike<WebAssembly.WebAssemblyInstantiatedSource>;
|
|
290
|
+
postMessage?: (message: any) => void;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export declare const version: string;
|
|
294
|
+
|
|
295
|
+
/** @public */
|
|
296
|
+
export declare interface WASIInstance {
|
|
297
|
+
readonly wasiImport?: Record<string, any>;
|
|
298
|
+
initialize(instance: object): void;
|
|
299
|
+
start(instance: object): number;
|
|
300
|
+
getImportObject?(): any;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** @public */
|
|
304
|
+
export declare class WASIThreads {
|
|
305
|
+
PThread: ThreadManager | undefined;
|
|
306
|
+
private wasmMemory;
|
|
307
|
+
private wasmInstance;
|
|
308
|
+
private readonly threadSpawn;
|
|
309
|
+
readonly childThread: boolean;
|
|
310
|
+
private readonly postMessage;
|
|
311
|
+
readonly wasi: WASIInstance;
|
|
312
|
+
constructor(options: WASIThreadsOptions);
|
|
313
|
+
getImportObject(): {
|
|
314
|
+
wasi: WASIThreadsImports;
|
|
315
|
+
};
|
|
316
|
+
setup(wasmInstance: WebAssembly.Instance, wasmModule: WebAssembly.Module, wasmMemory?: WebAssembly.Memory): void;
|
|
317
|
+
preloadWorkers(): Promise<WorkerLike[]>;
|
|
318
|
+
/**
|
|
319
|
+
* It's ok to call this method to a WASI command module.
|
|
320
|
+
*
|
|
321
|
+
* in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module
|
|
322
|
+
*
|
|
323
|
+
* @returns A proxied WebAssembly instance if in child thread, other wise the original instance
|
|
324
|
+
*/
|
|
325
|
+
initialize(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): WebAssembly.Instance;
|
|
326
|
+
/**
|
|
327
|
+
* Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start}
|
|
328
|
+
* ```js
|
|
329
|
+
* this.initialize(instance, module, memory)
|
|
330
|
+
* this.wasi.start(instance)
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
start(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): StartResult;
|
|
334
|
+
terminateAllThreads(): void;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** @public */
|
|
338
|
+
export declare interface WASIThreadsImports {
|
|
339
|
+
'thread-spawn': (startArg: number, errorOrTid?: number) => number;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/** @public */
|
|
343
|
+
export declare type WASIThreadsOptions = MainThreadOptions | ChildThreadOptions;
|
|
344
|
+
|
|
345
|
+
/** @public */
|
|
346
|
+
export declare type WorkerFactory = (ctx: {
|
|
347
|
+
type: string;
|
|
348
|
+
name: string;
|
|
349
|
+
}) => WorkerLike;
|
|
350
|
+
|
|
351
|
+
/** @public */
|
|
352
|
+
export declare type WorkerLike = (Worker | Worker_2) & {
|
|
353
|
+
whenLoaded?: Promise<WorkerLike>;
|
|
354
|
+
loaded?: boolean;
|
|
355
|
+
__emnapi_tid?: number;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
/** @public */
|
|
359
|
+
export declare interface WorkerMessageEvent<T = any> {
|
|
360
|
+
data: T;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export { }
|