diff --git a/bindings/binding_typescript_wasm/scripts/patch.mjs b/bindings/binding_typescript_wasm/scripts/patch.mjs index 8d645d1f8faa..ca7634ca492a 100755 --- a/bindings/binding_typescript_wasm/scripts/patch.mjs +++ b/bindings/binding_typescript_wasm/scripts/patch.mjs @@ -8,23 +8,7 @@ const base64 = rawWasmFile.toString('base64'); const patchedJsFile = origJsFile .replace(`const path = require('path').join(__dirname, 'wasm_bg.wasm');`, '') - .replaceAll(/=\s*getInt32Memory0\(\)\[(\w+)\s*\/\s*(\d+)\s*\+\s*(\d+)\]/g, `= getDataView().getInt32($1 + $2 * $3, true)`) - .replaceAll(/getInt32Memory0\(\)\[(\w+)\s*\/\s*(\d+)\s*\+\s*(\d+)\]\s*=\s*(.*);/g, `getDataView().setInt32($1 + $2 * $3, $4, true);`) - .replaceAll(/getFloat64Memory0\(\)\[(\w+)\s*\/\s*(\d+)\s*\+\s*(\d+)\]\s*=\s*(.*);/g, `getDataView().setFloat64($1 + $2 * $3, $4, true);`) .replace(', fatal: true', '') - .replace('let cachedFloat64Memory0 = null;', - ` -let cachedDataView = null; -/** @returns {DataView} */ -function getDataView() { - if (cachedDataView === null || cachedDataView.buffer !== wasm.memory.buffer) { - cachedDataView = new DataView(wasm.memory.buffer); - } - return cachedDataView; -} - -let cachedFloat64Memory0 = null; -`) .replace(`const bytes = require('fs').readFileSync(path);`, ` const { Buffer } = require('node:buffer'); const bytes = Buffer.from('${base64}', 'base64');`)