Commit f3ee8bfa authored by Luke Sandberg's avatar Luke Sandberg Committed by Luke Sandberg

fix build

parent a4cce236
...@@ -1158,5 +1158,11 @@ ...@@ -1158,5 +1158,11 @@
"1157": "`unstable_io()` requires the `experimental.unstableIO` option to be enabled in your Next.js config.", "1157": "`unstable_io()` requires the `experimental.unstableIO` option to be enabled in your Next.js config.",
"1158": "The prerender-ppr work unit type has been removed. This code path should be unreachable.", "1158": "The prerender-ppr work unit type has been removed. This code path should be unreachable.",
"1159": "WASM instance %s not found", "1159": "WASM instance %s not found",
"1160": "WASM module %s not found" "1160": "WASM module %s not found",
"1161": "Unexpected optype: %s",
"1162": "Module %s not found",
"1163": "No active instance for memory operation",
"1164": "Unknown request type: %s",
"1165": "Instance %s not found",
"1166": "wasm-worker must be run as a worker thread"
} }
...@@ -618,6 +618,11 @@ export declare function transformSync( ...@@ -618,6 +618,11 @@ export declare function transformSync(
isModule: boolean, isModule: boolean,
options: Buffer options: Buffer
): object ): object
/**
* Register the NAPI-based WASM plugin runtime.
* Must be called from JS before any SWC transforms that use plugins.
*/
export declare function registerWasmPluginRuntime(jsManager: object): void
export declare function startTurbopackTraceServer( export declare function startTurbopackTraceServer(
path: string, path: string,
port?: number | undefined | null port?: number | undefined | null
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* workers, and provide the shared memory pointers to Rust for direct access. * workers, and provide the shared memory pointers to Rust for direct access.
*/ */
import { Worker } from 'worker_threads' import { Worker, type TransferListItem } from 'worker_threads'
import path from 'path' import path from 'path'
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -107,7 +107,7 @@ function createWorker(): WorkerEntry { ...@@ -107,7 +107,7 @@ function createWorker(): WorkerEntry {
function sendToWorker( function sendToWorker(
entry: WorkerEntry, entry: WorkerEntry,
msg: any, msg: any,
transfer?: ArrayBuffer[] transfer?: TransferListItem[]
): Promise<any> { ): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const id = nextMessageId++ const id = nextMessageId++
...@@ -261,7 +261,7 @@ export const wasmManager = { ...@@ -261,7 +261,7 @@ export const wasmManager = {
const ab = data.buffer.slice( const ab = data.buffer.slice(
data.byteOffset, data.byteOffset,
data.byteOffset + data.byteLength data.byteOffset + data.byteLength
) ) as ArrayBuffer
return sendToWorker( return sendToWorker(
workers[workerIndex], workers[workerIndex],
{ type: 'writeMemory', instanceId, ptr, data: ab }, { type: 'writeMemory', instanceId, ptr, data: ab },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment