pikelet-wasm 0.8.0 → 0.8.1
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/CHANGELOG.md +321 -1
- package/README.md +65 -257
- package/complete/builder.mjs +18 -1
- package/complete/fusion.mjs +72 -0
- package/complete/index.d.ts +23 -0
- package/complete/index.mjs +100 -20
- package/complete/inline-transformer.mjs +97 -1
- package/complete/retrieval-abstention.mjs +118 -25
- package/complete/sources.mjs +1 -1
- package/complete/wordpiece.mjs +22 -0
- package/dist/engine.js +1 -1
- package/dist/engine.scalar.js +1 -1
- package/dist/engine.scalar.wasm +0 -0
- package/dist/engine.wasm +0 -0
- package/package.json +35 -77
- package/{pikelet-artifact-common.js → src/artifact/pikelet-artifact-common.js} +1 -1
- package/{pikelet-artifact-range.js → src/artifact/pikelet-artifact-range.js} +8 -1
- package/{pikelet-artifact-sketch.js → src/artifact/pikelet-artifact-sketch.js} +30 -3
- package/{pikelet-artifact.d.ts → src/artifact/pikelet-artifact.d.ts} +1 -1
- package/{pikelet-core.js → src/core/pikelet-core.js} +6 -5
- package/{pikelet.js → src/pikelet.js} +7 -7
- package/{pikelet.node.mjs → src/pikelet.node.mjs} +7 -7
- package/{pikelet.web.mjs → src/pikelet.web.mjs} +8 -8
- package/{pikelet.workerd.mjs → src/pikelet.workerd.mjs} +8 -8
- /package/{pikelet-artifact.js → src/artifact/pikelet-artifact.js} +0 -0
- /package/{pikelet-errors.js → src/errors/pikelet-errors.js} +0 -0
- /package/{pikelet-loader.js → src/loader/pikelet-loader.js} +0 -0
- /package/{pikelet.d.ts → src/pikelet.d.ts} +0 -0
- /package/{pikelet.web.d.ts → src/pikelet.web.d.ts} +0 -0
package/dist/engine.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=false;var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)};var exceptionLast=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={m:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,i:___cxa_find_matching_catch_3,n:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,k:invoke_iii,l:invoke_iiii,f:invoke_iiiiii,b:invoke_v,g:invoke_vii,e:invoke_viii,h:invoke_viiii,j:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
1
|
+
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=false;var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)};var exceptionLast=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={n:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,l:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,i:invoke_iii,m:invoke_iiii,f:invoke_iiiiii,b:invoke_v,g:invoke_vii,e:invoke_viii,h:invoke_viiii,k:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
2
2
|
;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=P;module.exports.default=P}else if(typeof define==="function"&&define["amd"])define([],()=>P);
|
package/dist/engine.scalar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.scalar.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)};var exceptionLast=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={m:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,i:___cxa_find_matching_catch_3,n:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,k:invoke_iii,l:invoke_iiii,e:invoke_iiiiii,b:invoke_v,g:invoke_vii,f:invoke_viii,h:invoke_viiii,j:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
1
|
+
var P=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else{}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["t"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("engine.scalar.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)};var exceptionLast=0;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=0};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=ptr}throw exceptionLast};var __abort_js=()=>abort("");var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["ccall"]=ccall;Module["cwrap"]=cwrap;var _pikelet_init,_pikelet_add,_pikelet_bulk_insert,_pikelet_query,_pikelet_query_filtered,_pikelet_delete,_pikelet_compact,_pikelet_compact_remap,_pikelet_count,_pikelet_memory,_pikelet_ghost_count,_pikelet_ghost_ratio,_pikelet_export,_pikelet_import,_pikelet_dispose,_pikelet_dimension,_emsc_malloc,_emsc_free,_pikelet_profile_print,_pikelet_profile_reset,_pikelet_sketch_scan,_pikelet_shutdown_all,_shutdown_all,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___cxa_increment_exception_refcount,___cxa_decrement_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_pikelet_init=Module["_pikelet_init"]=wasmExports["u"];_pikelet_add=Module["_pikelet_add"]=wasmExports["v"];_pikelet_bulk_insert=Module["_pikelet_bulk_insert"]=wasmExports["x"];_pikelet_query=Module["_pikelet_query"]=wasmExports["y"];_pikelet_query_filtered=Module["_pikelet_query_filtered"]=wasmExports["z"];_pikelet_delete=Module["_pikelet_delete"]=wasmExports["A"];_pikelet_compact=Module["_pikelet_compact"]=wasmExports["B"];_pikelet_compact_remap=Module["_pikelet_compact_remap"]=wasmExports["C"];_pikelet_count=Module["_pikelet_count"]=wasmExports["D"];_pikelet_memory=Module["_pikelet_memory"]=wasmExports["E"];_pikelet_ghost_count=Module["_pikelet_ghost_count"]=wasmExports["F"];_pikelet_ghost_ratio=Module["_pikelet_ghost_ratio"]=wasmExports["G"];_pikelet_export=Module["_pikelet_export"]=wasmExports["H"];_pikelet_import=Module["_pikelet_import"]=wasmExports["I"];_pikelet_dispose=Module["_pikelet_dispose"]=wasmExports["J"];_pikelet_dimension=Module["_pikelet_dimension"]=wasmExports["K"];_emsc_malloc=Module["_emsc_malloc"]=wasmExports["L"];_emsc_free=Module["_emsc_free"]=wasmExports["M"];_pikelet_profile_print=Module["_pikelet_profile_print"]=wasmExports["N"];_pikelet_profile_reset=Module["_pikelet_profile_reset"]=wasmExports["O"];_pikelet_sketch_scan=Module["_pikelet_sketch_scan"]=wasmExports["P"];_pikelet_shutdown_all=Module["_pikelet_shutdown_all"]=wasmExports["Q"];_shutdown_all=Module["_shutdown_all"]=wasmExports["R"];_setThrew=wasmExports["S"];__emscripten_tempret_set=wasmExports["T"];__emscripten_stack_restore=wasmExports["U"];__emscripten_stack_alloc=wasmExports["V"];_emscripten_stack_get_current=wasmExports["W"];___cxa_increment_exception_refcount=wasmExports["X"];___cxa_decrement_exception_refcount=wasmExports["Y"];___cxa_can_catch=wasmExports["Z"];___cxa_get_exception_ptr=wasmExports["_"];memory=wasmMemory=wasmExports["s"];__indirect_function_table=wasmTable=wasmExports["w"]}var wasmImports={n:___cxa_begin_catch,o:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,l:___cxa_throw,d:___resumeException,p:__abort_js,q:_emscripten_resize_heap,c:invoke_ii,i:invoke_iii,m:invoke_iiii,e:invoke_iiiiii,b:invoke_v,f:invoke_vii,g:invoke_viii,h:invoke_viiii,k:invoke_viiiii,r:invoke_viiiiiii};function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
2
2
|
;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=P;module.exports.default=P}else if(typeof define==="function"&&define["amd"])define([],()=>P);
|
package/dist/engine.scalar.wasm
CHANGED
|
Binary file
|
package/dist/engine.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pikelet-wasm",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Vector search engine and .pikelet artifact readers/builders, in WebAssembly. Compile a corpus into one self-contained, hash-verified search file, or use the underlying HNSW engine directly. Runs in Node.js, browsers, and Cloudflare Workers with no native dependencies.",
|
|
5
|
-
"main": "pikelet.js",
|
|
6
|
-
"types": "pikelet.d.ts",
|
|
5
|
+
"main": "src/pikelet.js",
|
|
6
|
+
"types": "src/pikelet.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"workerd": {
|
|
10
|
-
"types": "./pikelet.web.d.ts",
|
|
11
|
-
"default": "./pikelet.workerd.mjs"
|
|
10
|
+
"types": "./src/pikelet.web.d.ts",
|
|
11
|
+
"default": "./src/pikelet.workerd.mjs"
|
|
12
12
|
},
|
|
13
13
|
"browser": {
|
|
14
|
-
"types": "./pikelet.web.d.ts",
|
|
15
|
-
"default": "./pikelet.web.mjs"
|
|
14
|
+
"types": "./src/pikelet.web.d.ts",
|
|
15
|
+
"default": "./src/pikelet.web.mjs"
|
|
16
16
|
},
|
|
17
17
|
"import": {
|
|
18
|
-
"types": "./pikelet.d.ts",
|
|
19
|
-
"default": "./pikelet.node.mjs"
|
|
18
|
+
"types": "./src/pikelet.d.ts",
|
|
19
|
+
"default": "./src/pikelet.node.mjs"
|
|
20
20
|
},
|
|
21
21
|
"require": {
|
|
22
|
-
"types": "./pikelet.d.ts",
|
|
23
|
-
"default": "./pikelet.js"
|
|
22
|
+
"types": "./src/pikelet.d.ts",
|
|
23
|
+
"default": "./src/pikelet.js"
|
|
24
24
|
},
|
|
25
25
|
"default": {
|
|
26
|
-
"types": "./pikelet.d.ts",
|
|
27
|
-
"default": "./pikelet.js"
|
|
26
|
+
"types": "./src/pikelet.d.ts",
|
|
27
|
+
"default": "./src/pikelet.js"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"./web": {
|
|
31
31
|
"workerd": {
|
|
32
|
-
"types": "./pikelet.web.d.ts",
|
|
33
|
-
"default": "./pikelet.workerd.mjs"
|
|
32
|
+
"types": "./src/pikelet.web.d.ts",
|
|
33
|
+
"default": "./src/pikelet.workerd.mjs"
|
|
34
34
|
},
|
|
35
35
|
"browser": {
|
|
36
|
-
"types": "./pikelet.web.d.ts",
|
|
37
|
-
"default": "./pikelet.web.mjs"
|
|
36
|
+
"types": "./src/pikelet.web.d.ts",
|
|
37
|
+
"default": "./src/pikelet.web.mjs"
|
|
38
38
|
},
|
|
39
39
|
"import": {
|
|
40
|
-
"types": "./pikelet.web.d.ts",
|
|
41
|
-
"default": "./pikelet.web.mjs"
|
|
40
|
+
"types": "./src/pikelet.web.d.ts",
|
|
41
|
+
"default": "./src/pikelet.web.mjs"
|
|
42
42
|
},
|
|
43
43
|
"default": {
|
|
44
|
-
"types": "./pikelet.web.d.ts",
|
|
45
|
-
"default": "./pikelet.web.mjs"
|
|
44
|
+
"types": "./src/pikelet.web.d.ts",
|
|
45
|
+
"default": "./src/pikelet.web.mjs"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"./node": {
|
|
49
49
|
"import": {
|
|
50
|
-
"types": "./pikelet.d.ts",
|
|
51
|
-
"default": "./pikelet.node.mjs"
|
|
50
|
+
"types": "./src/pikelet.d.ts",
|
|
51
|
+
"default": "./src/pikelet.node.mjs"
|
|
52
52
|
},
|
|
53
53
|
"require": {
|
|
54
|
-
"types": "./pikelet.d.ts",
|
|
55
|
-
"default": "./pikelet.js"
|
|
54
|
+
"types": "./src/pikelet.d.ts",
|
|
55
|
+
"default": "./src/pikelet.js"
|
|
56
56
|
},
|
|
57
57
|
"default": {
|
|
58
|
-
"types": "./pikelet.d.ts",
|
|
59
|
-
"default": "./pikelet.js"
|
|
58
|
+
"types": "./src/pikelet.d.ts",
|
|
59
|
+
"default": "./src/pikelet.js"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"./artifact": {
|
|
63
|
-
"types": "./pikelet-artifact.d.ts",
|
|
64
|
-
"default": "./pikelet-artifact.js"
|
|
63
|
+
"types": "./src/artifact/pikelet-artifact.d.ts",
|
|
64
|
+
"default": "./src/artifact/pikelet-artifact.js"
|
|
65
65
|
},
|
|
66
66
|
"./complete": {
|
|
67
67
|
"types": "./complete/index.d.ts",
|
|
@@ -74,21 +74,8 @@
|
|
|
74
74
|
"./engine.wasm": "./dist/engine.wasm"
|
|
75
75
|
},
|
|
76
76
|
"files": [
|
|
77
|
+
"src",
|
|
77
78
|
"complete",
|
|
78
|
-
"pikelet.js",
|
|
79
|
-
"pikelet-artifact.js",
|
|
80
|
-
"pikelet-artifact-common.js",
|
|
81
|
-
"pikelet-artifact-range.js",
|
|
82
|
-
"pikelet-artifact-sketch.js",
|
|
83
|
-
"pikelet.node.mjs",
|
|
84
|
-
"pikelet.web.mjs",
|
|
85
|
-
"pikelet.workerd.mjs",
|
|
86
|
-
"pikelet-core.js",
|
|
87
|
-
"pikelet-errors.js",
|
|
88
|
-
"pikelet-loader.js",
|
|
89
|
-
"pikelet.d.ts",
|
|
90
|
-
"pikelet.web.d.ts",
|
|
91
|
-
"pikelet-artifact.d.ts",
|
|
92
79
|
"dist/engine.js",
|
|
93
80
|
"dist/engine.wasm",
|
|
94
81
|
"dist/engine.scalar.js",
|
|
@@ -99,28 +86,9 @@
|
|
|
99
86
|
"NOTICE"
|
|
100
87
|
],
|
|
101
88
|
"scripts": {
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"bench": "node benchmarks/run.js",
|
|
106
|
-
"demo:data": "node scripts/make-demo-vectors.mjs",
|
|
107
|
-
"demo:veyra": "node examples/05-one-file-search/web/veyra-corpus/fetch-veyra.mjs",
|
|
108
|
-
"demo:artifact": "node examples/legacy/range-artifact-demo/demo.js --compact",
|
|
109
|
-
"demo:sketch": "node examples/legacy/range-artifact-demo/sketch_demo.js --compact",
|
|
110
|
-
"demo:artifact:browser:build": "vite build examples/legacy/range-artifact-demo/static",
|
|
111
|
-
"demo:artifact:browser": "vite preview examples/legacy/range-artifact-demo/static --host 127.0.0.1",
|
|
112
|
-
"build:pages-demo": "node examples/legacy/03-edge-docs-search/pages-ui/build.mjs",
|
|
113
|
-
"test": "node run_tests.js && node test/model_c_loader.js && node test/sketch_profile.js && node test/sketch_staged.js && node test/sketch_row_integrity.js && node test/artifact_hardening.js && node test/complete_profile.mjs && node test/mcp_conformance.mjs && node test/ingestion/run.mjs && npm run test:types",
|
|
114
|
-
"test:types": "tsc -p test/types/tsconfig.json",
|
|
115
|
-
"test:browser": "node test/browser_smoke.js",
|
|
116
|
-
"test:worker-web": "node test/test_worker_web_entry.js",
|
|
117
|
-
"test:simd": "node test/simd_parity.js",
|
|
118
|
-
"test:fuzz": "node test/fuzz_import.js",
|
|
119
|
-
"test:worker-example": "cd examples/legacy/03-edge-docs-search && npx wrangler deploy --dry-run --outdir ../../../.tmp-test-work/student-worker-distilled && cd ../../.. && node examples/legacy/03-edge-docs-search/test_worker.mjs",
|
|
120
|
-
"test:scaffold": "node scripts/test-scaffold-e2e.mjs",
|
|
121
|
-
"bench:range-storage": "node scripts/benchmark-range-storage.mjs",
|
|
122
|
-
"pack:dry-run": "node scripts/pack-dry-run.mjs",
|
|
123
|
-
"prepublishOnly": "npm run build:all && npm test && npm run test:fuzz && npm run test:simd && npm run test:browser && npm run test:worker-web && npm run test:worker-example && npm run pack:dry-run"
|
|
89
|
+
"prepack": "node ../../scripts/stage-package-docs.mjs pikelet-wasm",
|
|
90
|
+
"postpack": "node ../../scripts/stage-package-docs.mjs pikelet-wasm --clean",
|
|
91
|
+
"prepublishOnly": "npm --prefix ../.. run prepublish-checks"
|
|
124
92
|
},
|
|
125
93
|
"keywords": [
|
|
126
94
|
"vector-search",
|
|
@@ -159,17 +127,7 @@
|
|
|
159
127
|
"access": "public"
|
|
160
128
|
},
|
|
161
129
|
"engines": {
|
|
162
|
-
"node": ">=
|
|
130
|
+
"node": ">=18"
|
|
163
131
|
},
|
|
164
|
-
"sideEffects": false
|
|
165
|
-
"devDependencies": {
|
|
166
|
-
"miniflare": "^4.20260409.0",
|
|
167
|
-
"playwright": "^1.60.0",
|
|
168
|
-
"typescript": "^7.0.2",
|
|
169
|
-
"vite": "^8.0.16",
|
|
170
|
-
"wrangler": "^4.81.1"
|
|
171
|
-
},
|
|
172
|
-
"overrides": {
|
|
173
|
-
"esbuild": "^0.28.1"
|
|
174
|
-
}
|
|
132
|
+
"sideEffects": false
|
|
175
133
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Split out of pikelet-artifact.js (the public entry, which re-exports the
|
|
6
6
|
// three parts); see that file for the module map.
|
|
7
7
|
|
|
8
|
-
const { pikeletError, PIKELET_ERROR_CODES } = require('
|
|
8
|
+
const { pikeletError, PIKELET_ERROR_CODES } = require('../errors/pikelet-errors.js');
|
|
9
9
|
|
|
10
10
|
const PIKELET_MAGIC = 0x504E434B;
|
|
11
11
|
const V1_ENVELOPE_HEADER_SIZE = 24;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Split out of pikelet-artifact.js (the public entry, which re-exports the
|
|
5
5
|
// three parts); see that file for the module map.
|
|
6
6
|
|
|
7
|
-
const { pikeletError, PIKELET_ERROR_CODES } = require('
|
|
7
|
+
const { pikeletError, PIKELET_ERROR_CODES } = require('../errors/pikelet-errors.js');
|
|
8
8
|
const {
|
|
9
9
|
MAX_COALESCED_RANGE_BYTES,
|
|
10
10
|
readChecked,
|
|
@@ -376,6 +376,13 @@ class PikeletRangeArtifact {
|
|
|
376
376
|
state.offset += this.dim;
|
|
377
377
|
const scale = readF32(view, state);
|
|
378
378
|
const offset = readF32(view, state);
|
|
379
|
+
// A NaN/Infinity affine pair makes every distance to this node
|
|
380
|
+
// non-finite; NaN compares false everywhere, so the node can sit in
|
|
381
|
+
// the result heap without ever being displaced. Digests do not catch
|
|
382
|
+
// this (the producer signs whatever bytes it wrote), so decode does.
|
|
383
|
+
if (!Number.isFinite(scale) || !Number.isFinite(offset)) {
|
|
384
|
+
throw pikeletError(PIKELET_ERROR_CODES.SNAPSHOT_INVALID, 'Range artifact record has a non-finite scale or offset', { id, scale, offset });
|
|
385
|
+
}
|
|
379
386
|
const base = new Uint32Array(baseCount);
|
|
380
387
|
for (let i = 0; i < this.M0; i++) {
|
|
381
388
|
const neighbor = readU32(view, state);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Split out of pikelet-artifact.js (the public entry, which re-exports the
|
|
6
6
|
// three parts); see that file for the module map.
|
|
7
7
|
|
|
8
|
-
const { pikeletError, PIKELET_ERROR_CODES } = require('
|
|
8
|
+
const { pikeletError, PIKELET_ERROR_CODES } = require('../errors/pikelet-errors.js');
|
|
9
9
|
const {
|
|
10
10
|
DEFAULT_OPEN_READ_BYTES,
|
|
11
11
|
MAX_COALESCED_RANGE_BYTES,
|
|
@@ -38,6 +38,19 @@ const SKETCH_MAGIC = 0x31415350; // PSA1
|
|
|
38
38
|
const SKETCH_HEADER_BYTES = 256;
|
|
39
39
|
const SKETCH_KIND_U8 = 1;
|
|
40
40
|
|
|
41
|
+
// The affine table feeds every rerank distance; a NaN/Infinity entry makes
|
|
42
|
+
// that row's distance non-finite and lets it sit in the result set
|
|
43
|
+
// unchallenged (NaN never loses a comparison). The digests do not catch
|
|
44
|
+
// this, since the producer signs whatever bytes it wrote, so every path
|
|
45
|
+
// that adopts the table checks it.
|
|
46
|
+
function assertFiniteAffine(scales, offsets) {
|
|
47
|
+
for (let i = 0; i < scales.length; i++) {
|
|
48
|
+
if (!Number.isFinite(scales[i]) || !Number.isFinite(offsets[i])) {
|
|
49
|
+
throw pikeletError(PIKELET_ERROR_CODES.SNAPSHOT_INVALID, 'Sketch artifact affine table has a non-finite scale or offset', { id: i });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
41
54
|
function buildSketchArtifact(snapshotBytes, outPath, options = {}) {
|
|
42
55
|
if (typeof outPath !== 'string' || outPath.length === 0) {
|
|
43
56
|
throw pikeletError(PIKELET_ERROR_CODES.INVALID_ARGUMENT, 'buildSketchArtifact() requires an output path');
|
|
@@ -486,6 +499,7 @@ class PikeletSketchArtifact {
|
|
|
486
499
|
}
|
|
487
500
|
artifact.scales = new Float32Array(affineCopy.buffer, 0, count);
|
|
488
501
|
artifact.offsets = new Float32Array(affineCopy.buffer, count * 4, count);
|
|
502
|
+
assertFiniteAffine(artifact.scales, artifact.offsets);
|
|
489
503
|
artifact.sketches = null;
|
|
490
504
|
artifact.microSketches = microCopy;
|
|
491
505
|
if (pageTableCopy) artifact.pageTable = pageTableCopy;
|
|
@@ -514,8 +528,21 @@ class PikeletSketchArtifact {
|
|
|
514
528
|
}
|
|
515
529
|
|
|
516
530
|
_adoptResident(residentCopy, count, sketchRowBytes, microRowBytes, microOffset) {
|
|
517
|
-
|
|
518
|
-
this.offsets
|
|
531
|
+
// Validate into locals BEFORE touching a single member. Assigning
|
|
532
|
+
// this.scales/this.offsets first and validating after left a rejected
|
|
533
|
+
// stage-2 adopt half-applied: this.sketches still null, this.tier
|
|
534
|
+
// still 'micro', this.microSketches still pointing at the STAGE-1
|
|
535
|
+
// buffer -- while scales/offsets had already moved to stage-2. The
|
|
536
|
+
// staged path swallows the rejection (see fullyResident.catch above),
|
|
537
|
+
// so the artifact stayed open and kept serving micro-tier queries
|
|
538
|
+
// that paired stage-1 sketches against stage-2 affine parameters:
|
|
539
|
+
// silently wrong ranking, which is worse than the non-finite
|
|
540
|
+
// distances this check exists to reject.
|
|
541
|
+
const scales = new Float32Array(residentCopy.buffer, 0, count);
|
|
542
|
+
const offsets = new Float32Array(residentCopy.buffer, count * 4, count);
|
|
543
|
+
assertFiniteAffine(scales, offsets);
|
|
544
|
+
this.scales = scales;
|
|
545
|
+
this.offsets = offsets;
|
|
519
546
|
this.sketches = new Uint8Array(residentCopy.buffer, count * 8, count * sketchRowBytes);
|
|
520
547
|
if (this.microDims) {
|
|
521
548
|
this.microSketches = new Uint8Array(residentCopy.buffer, microOffset - SKETCH_HEADER_BYTES, count * microRowBytes);
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
SketchArtifactBuildOptions,
|
|
14
14
|
SketchScanner,
|
|
15
15
|
SketchScannerOptions,
|
|
16
|
-
} from '
|
|
16
|
+
} from '../pikelet.js';
|
|
17
17
|
|
|
18
18
|
/** A parsed uint8 engine snapshot, as returned by {@link parseUint8Snapshot}. */
|
|
19
19
|
export interface Uint8SnapshotGraph {
|
|
@@ -4,7 +4,7 @@ const {
|
|
|
4
4
|
PikeletError,
|
|
5
5
|
PIKELET_ERROR_CODES,
|
|
6
6
|
pikeletError,
|
|
7
|
-
} = require('
|
|
7
|
+
} = require('../errors/pikelet-errors.js');
|
|
8
8
|
|
|
9
9
|
// Envelope header for validated export/import
|
|
10
10
|
const PIKELET_MAGIC = 0x504E434B; // "PNCK"
|
|
@@ -856,9 +856,10 @@ function createPikeletApi(loadEngineImpl) {
|
|
|
856
856
|
async function create(opts) {
|
|
857
857
|
if (!opts || !opts.dim) throw pikeletError(PIKELET_ERROR_CODES.INVALID_ARGUMENT,
|
|
858
858
|
'opts.dim is required', { argument: 'dim' });
|
|
859
|
-
|
|
859
|
+
// Upper bound matches the engine constructors' MAX_DIMS.
|
|
860
|
+
if (!Number.isInteger(opts.dim) || opts.dim <= 0 || opts.dim > 65536) {
|
|
860
861
|
throw pikeletError(PIKELET_ERROR_CODES.INVALID_ARGUMENT,
|
|
861
|
-
'opts.dim must be
|
|
862
|
+
'opts.dim must be an integer between 1 and 65536', { argument: 'dim', value: opts.dim });
|
|
862
863
|
}
|
|
863
864
|
if ('compressed' in opts) {
|
|
864
865
|
throw pikeletError(PIKELET_ERROR_CODES.INVALID_ARGUMENT, 'opts.compressed has been removed');
|
|
@@ -870,7 +871,7 @@ function createPikeletApi(loadEngineImpl) {
|
|
|
870
871
|
throw pikeletError(PIKELET_ERROR_CODES.INVALID_ARGUMENT,
|
|
871
872
|
"opts.metric must be 'cosine' or 'l2'", { argument: 'metric', value: opts.metric });
|
|
872
873
|
}
|
|
873
|
-
// Upper bound matches the engine ABI:
|
|
874
|
+
// Upper bound matches the engine ABI: pikelet_init takes max_elem as a
|
|
874
875
|
// C int, so anything above 2^31-1 would truncate or go negative.
|
|
875
876
|
if (opts.maxElements !== undefined && (!Number.isInteger(opts.maxElements) || opts.maxElements <= 0 || opts.maxElements > 0x7fffffff)) {
|
|
876
877
|
throw pikeletError(PIKELET_ERROR_CODES.INVALID_ARGUMENT,
|
|
@@ -904,7 +905,7 @@ function createPikeletApi(loadEngineImpl) {
|
|
|
904
905
|
|
|
905
906
|
// Capacity guard: the backend allocates its arena eagerly at
|
|
906
907
|
// construction, and a request the wasm32 heap cannot satisfy throws
|
|
907
|
-
// std::bad_alloc inside
|
|
908
|
+
// std::bad_alloc inside pikelet_init — reject it here with the
|
|
908
909
|
// estimate instead. Per-element cost mirrors the constructor
|
|
909
910
|
// allocations (uint8_float_hnsw.hpp / float_hnsw.hpp): quantized rows
|
|
910
911
|
// cost dim bytes plus 16*M edge bytes plus ~39 bytes of bookkeeping;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const loadEngine = require('
|
|
4
|
-
const loadScalarEngine = require('
|
|
5
|
-
const createPikeletApi = require('./pikelet-core.js');
|
|
6
|
-
const { PikeletError, PIKELET_ERROR_CODES, pikeletError } = require('./pikelet-errors.js');
|
|
7
|
-
const { PikeletRangeArtifact, PikeletSketchArtifact, createSketchScanner, NodeFileRangeSource, buildRangeArtifact, buildRangeArtifactFile, buildSketchArtifact, buildSketchArtifactBytes, buildSketchArtifactFile } = require('./pikelet-artifact.js');
|
|
8
|
-
const { createCachedModuleLoader } = require('./pikelet-loader.js');
|
|
3
|
+
const loadEngine = require('../dist/engine.js');
|
|
4
|
+
const loadScalarEngine = require('../dist/engine.scalar.js');
|
|
5
|
+
const createPikeletApi = require('./core/pikelet-core.js');
|
|
6
|
+
const { PikeletError, PIKELET_ERROR_CODES, pikeletError } = require('./errors/pikelet-errors.js');
|
|
7
|
+
const { PikeletRangeArtifact, PikeletSketchArtifact, createSketchScanner, NodeFileRangeSource, buildRangeArtifact, buildRangeArtifactFile, buildSketchArtifact, buildSketchArtifactBytes, buildSketchArtifactFile } = require('./artifact/pikelet-artifact.js');
|
|
8
|
+
const { createCachedModuleLoader } = require('./loader/pikelet-loader.js');
|
|
9
9
|
const _path = require('path');
|
|
10
10
|
const _fs = require('fs');
|
|
11
11
|
let _engineVariantPromise = null;
|
|
@@ -22,7 +22,7 @@ const SUPPORTED_SNAPSHOT_MAGICS = new Set([
|
|
|
22
22
|
|
|
23
23
|
function readWasmBinary(fileName) {
|
|
24
24
|
try {
|
|
25
|
-
const wasmBinary = _fs.readFileSync(_path.join(__dirname, 'dist', fileName));
|
|
25
|
+
const wasmBinary = _fs.readFileSync(_path.join(__dirname, '..', 'dist', fileName));
|
|
26
26
|
return wasmBinary.buffer.slice(
|
|
27
27
|
wasmBinary.byteOffset,
|
|
28
28
|
wasmBinary.byteOffset + wasmBinary.byteLength
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { readFileSync, statSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import loadEngine from '
|
|
5
|
-
import loadScalarEngine from '
|
|
6
|
-
import createPikeletApi from './pikelet-core.js';
|
|
7
|
-
import errorContract from './pikelet-errors.js';
|
|
8
|
-
import loaderContract from './pikelet-loader.js';
|
|
9
|
-
import artifactContract from './pikelet-artifact.js';
|
|
4
|
+
import loadEngine from '../dist/engine.js';
|
|
5
|
+
import loadScalarEngine from '../dist/engine.scalar.js';
|
|
6
|
+
import createPikeletApi from './core/pikelet-core.js';
|
|
7
|
+
import errorContract from './errors/pikelet-errors.js';
|
|
8
|
+
import loaderContract from './loader/pikelet-loader.js';
|
|
9
|
+
import artifactContract from './artifact/pikelet-artifact.js';
|
|
10
10
|
const { PikeletError, PIKELET_ERROR_CODES, pikeletError } = errorContract;
|
|
11
11
|
const { createCachedModuleLoader } = loaderContract;
|
|
12
12
|
const { PikeletRangeArtifact, PikeletSketchArtifact, createSketchScanner, NodeFileRangeSource, buildRangeArtifact, buildRangeArtifactFile, buildSketchArtifact, buildSketchArtifactBytes, buildSketchArtifactFile } = artifactContract;
|
|
@@ -27,7 +27,7 @@ const SUPPORTED_SNAPSHOT_MAGICS = new Set([
|
|
|
27
27
|
|
|
28
28
|
function readWasmBinary(fileName) {
|
|
29
29
|
try {
|
|
30
|
-
const wasmBinary = readFileSync(path.join(__dirname, 'dist', fileName));
|
|
30
|
+
const wasmBinary = readFileSync(path.join(__dirname, '..', 'dist', fileName));
|
|
31
31
|
return wasmBinary.buffer.slice(
|
|
32
32
|
wasmBinary.byteOffset,
|
|
33
33
|
wasmBinary.byteOffset + wasmBinary.byteLength
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import loadEngine from '
|
|
2
|
-
import loadScalarEngine from '
|
|
3
|
-
import simdWasmAsset from '
|
|
4
|
-
import scalarWasmAsset from '
|
|
5
|
-
import createPikeletApi from './pikelet-core.js';
|
|
6
|
-
import errorContract from './pikelet-errors.js';
|
|
7
|
-
import loaderContract from './pikelet-loader.js';
|
|
8
|
-
import artifactContract from './pikelet-artifact.js';
|
|
1
|
+
import loadEngine from '../dist/engine.js';
|
|
2
|
+
import loadScalarEngine from '../dist/engine.scalar.js';
|
|
3
|
+
import simdWasmAsset from '../dist/engine.wasm?url';
|
|
4
|
+
import scalarWasmAsset from '../dist/engine.scalar.wasm?url';
|
|
5
|
+
import createPikeletApi from './core/pikelet-core.js';
|
|
6
|
+
import errorContract from './errors/pikelet-errors.js';
|
|
7
|
+
import loaderContract from './loader/pikelet-loader.js';
|
|
8
|
+
import artifactContract from './artifact/pikelet-artifact.js';
|
|
9
9
|
const { PikeletError, PIKELET_ERROR_CODES, pikeletError } = errorContract;
|
|
10
10
|
const { createCachedModuleLoader } = loaderContract;
|
|
11
11
|
const { PikeletRangeArtifact, PikeletSketchArtifact, createSketchScanner } = artifactContract;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import loadEngine from '
|
|
2
|
-
import loadScalarEngine from '
|
|
3
|
-
import simdWasmAsset from '
|
|
4
|
-
import scalarWasmAsset from '
|
|
5
|
-
import createPikeletApi from './pikelet-core.js';
|
|
6
|
-
import errorContract from './pikelet-errors.js';
|
|
7
|
-
import loaderContract from './pikelet-loader.js';
|
|
8
|
-
import artifactContract from './pikelet-artifact.js';
|
|
1
|
+
import loadEngine from '../dist/engine.js';
|
|
2
|
+
import loadScalarEngine from '../dist/engine.scalar.js';
|
|
3
|
+
import simdWasmAsset from '../dist/engine.wasm';
|
|
4
|
+
import scalarWasmAsset from '../dist/engine.scalar.wasm';
|
|
5
|
+
import createPikeletApi from './core/pikelet-core.js';
|
|
6
|
+
import errorContract from './errors/pikelet-errors.js';
|
|
7
|
+
import loaderContract from './loader/pikelet-loader.js';
|
|
8
|
+
import artifactContract from './artifact/pikelet-artifact.js';
|
|
9
9
|
const { PikeletError, PIKELET_ERROR_CODES, pikeletError } = errorContract;
|
|
10
10
|
const { createCachedModuleLoader } = loaderContract;
|
|
11
11
|
const { PikeletRangeArtifact, PikeletSketchArtifact, createSketchScanner } = artifactContract;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|