UNPKG

@sap/cds-lsp

Version:

Language server for CDS

99 lines (84 loc) 2.82 kB
let imports = {}; imports['__wbindgen_placeholder__'] = module.exports; function getArrayU8FromWasm0(ptr, len) { ptr = ptr >>> 0; return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return decodeText(ptr, len); } let cachedUint8ArrayMemory0 = null; function getUint8ArrayMemory0() { if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8ArrayMemory0; } function passArray8ToWasm0(arg, malloc) { const ptr = malloc(arg.length * 1, 1) >>> 0; getUint8ArrayMemory0().set(arg, ptr / 1); WASM_VECTOR_LEN = arg.length; return ptr; } function takeFromExternrefTable0(idx) { const value = wasm.__wbindgen_externrefs.get(idx); wasm.__externref_table_dealloc(idx); return value; } let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); function decodeText(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } let WASM_VECTOR_LEN = 0; /** * @param {Uint8Array} input * @returns {Uint8Array} */ function compress(input) { const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.compress(ptr0, len0); if (ret[3]) { throw takeFromExternrefTable0(ret[2]); } var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); return v2; } exports.compress = compress; /** * @param {Uint8Array} input * @returns {Uint8Array} */ function decompress(input) { const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.decompress(ptr0, len0); if (ret[3]) { throw takeFromExternrefTable0(ret[2]); } var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); return v2; } exports.decompress = decompress; exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) { const ret = Error(getStringFromWasm0(arg0, arg1)); return ret; }; exports.__wbindgen_init_externref_table = function() { const table = wasm.__wbindgen_externrefs; const offset = table.grow(4); table.set(0, undefined); table.set(offset + 0, undefined); table.set(offset + 1, null); table.set(offset + 2, true); table.set(offset + 3, false); }; const wasmPath = `${__dirname}/snap_wasm_bg.wasm`; const wasmBytes = require('fs').readFileSync(wasmPath); const wasmModule = new WebAssembly.Module(wasmBytes); const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports; wasm.__wbindgen_start();