yeptris 0.6.60 → 0.6.62

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/dist/yeptris.mjs CHANGED
@@ -5,7 +5,7 @@ var Module = (() => {
5
5
  return (
6
6
  async function(moduleArg = {}) {
7
7
 
8
- var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){const{createRequire:createRequire}=await import("module");var require=createRequire(import.meta.url);var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=require("url").fileURLToPath(new URL("./",import.meta.url))}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");var wasmBinaryFile;if(Module["locateFile"]){wasmBinaryFile="yeptris.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}}else{wasmBinaryFile=new URL("yeptris.wasm",import.meta.url).href}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"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["g"];updateMemoryViews();addOnInit(wasmExports["h"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var getHeapMax=()=>2147483648;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;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}var alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){HEAP8[buffer++>>0]=str.charCodeAt(i)}HEAP8[buffer>>0]=0};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;var UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;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)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var SYSCALLS={varargs:undefined,get(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret},getp(){return SYSCALLS.get()},getStr(ptr){var ret=UTF8ToString(ptr);return ret}};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var _fd_close=fd=>52;var MAX_INT53=9007199254740992;var MIN_INT53=-9007199254740992;var bigintToI53Checked=num=>num<MIN_INT53||num>MAX_INT53?NaN:Number(num);function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};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.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}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}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);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 wasmImports={b:_emscripten_resize_heap,e:_environ_get,f:_environ_sizes_get,d:_fd_close,c:_fd_seek,a:_fd_write};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["h"])();var _yeptris_wasm_load=Module["_yeptris_wasm_load"]=(a0,a1)=>(_yeptris_wasm_load=Module["_yeptris_wasm_load"]=wasmExports["i"])(a0,a1);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["j"])(a0);var _yeptris_wasm_load_all=Module["_yeptris_wasm_load_all"]=(a0,a1)=>(_yeptris_wasm_load_all=Module["_yeptris_wasm_load_all"]=wasmExports["k"])(a0,a1);var _yeptris_wasm_dump_ex=Module["_yeptris_wasm_dump_ex"]=(a0,a1,a2,a3)=>(_yeptris_wasm_dump_ex=Module["_yeptris_wasm_dump_ex"]=wasmExports["l"])(a0,a1,a2,a3);var _yeptris_wasm_dump=Module["_yeptris_wasm_dump"]=(a0,a1)=>(_yeptris_wasm_dump=Module["_yeptris_wasm_dump"]=wasmExports["m"])(a0,a1);var _yeptris_wasm_last_error=Module["_yeptris_wasm_last_error"]=()=>(_yeptris_wasm_last_error=Module["_yeptris_wasm_last_error"]=wasmExports["n"])();var _yeptris_wasm_last_error_line=Module["_yeptris_wasm_last_error_line"]=()=>(_yeptris_wasm_last_error_line=Module["_yeptris_wasm_last_error_line"]=wasmExports["o"])();var _yeptris_wasm_last_error_column=Module["_yeptris_wasm_last_error_column"]=()=>(_yeptris_wasm_last_error_column=Module["_yeptris_wasm_last_error_column"]=wasmExports["p"])();var _yeptris_wasm_out=Module["_yeptris_wasm_out"]=()=>(_yeptris_wasm_out=Module["_yeptris_wasm_out"]=wasmExports["q"])();var _yeptris_wasm_out_len=Module["_yeptris_wasm_out_len"]=()=>(_yeptris_wasm_out_len=Module["_yeptris_wasm_out_len"]=wasmExports["r"])();var _yeptris_wasm_out_free=Module["_yeptris_wasm_out_free"]=()=>(_yeptris_wasm_out_free=Module["_yeptris_wasm_out_free"]=wasmExports["s"])();var _yeptris_wasm_free=Module["_yeptris_wasm_free"]=a0=>(_yeptris_wasm_free=Module["_yeptris_wasm_free"]=wasmExports["t"])(a0);var _yeptris_wasm_version=Module["_yeptris_wasm_version"]=()=>(_yeptris_wasm_version=Module["_yeptris_wasm_version"]=wasmExports["u"])();var _yeptris_wasm_events=Module["_yeptris_wasm_events"]=(a0,a1)=>(_yeptris_wasm_events=Module["_yeptris_wasm_events"]=wasmExports["v"])(a0,a1);var _yeptris_wasm_event_records=Module["_yeptris_wasm_event_records"]=()=>(_yeptris_wasm_event_records=Module["_yeptris_wasm_event_records"]=wasmExports["w"])();var _yeptris_wasm_event_count=Module["_yeptris_wasm_event_count"]=()=>(_yeptris_wasm_event_count=Module["_yeptris_wasm_event_count"]=wasmExports["x"])();var _yeptris_wasm_event_arena=Module["_yeptris_wasm_event_arena"]=()=>(_yeptris_wasm_event_arena=Module["_yeptris_wasm_event_arena"]=wasmExports["y"])();var _yeptris_wasm_event_arena_len=Module["_yeptris_wasm_event_arena_len"]=()=>(_yeptris_wasm_event_arena_len=Module["_yeptris_wasm_event_arena_len"]=wasmExports["z"])();var _yeptris_wasm_events_free=Module["_yeptris_wasm_events_free"]=()=>(_yeptris_wasm_events_free=Module["_yeptris_wasm_events_free"]=wasmExports["A"])();var _yeptris_wasm_each_open=Module["_yeptris_wasm_each_open"]=(a0,a1)=>(_yeptris_wasm_each_open=Module["_yeptris_wasm_each_open"]=wasmExports["B"])(a0,a1);var _yeptris_wasm_each_next=Module["_yeptris_wasm_each_next"]=()=>(_yeptris_wasm_each_next=Module["_yeptris_wasm_each_next"]=wasmExports["C"])();var _yeptris_wasm_each_frame=Module["_yeptris_wasm_each_frame"]=()=>(_yeptris_wasm_each_frame=Module["_yeptris_wasm_each_frame"]=wasmExports["D"])();var _yeptris_wasm_each_index=Module["_yeptris_wasm_each_index"]=()=>(_yeptris_wasm_each_index=Module["_yeptris_wasm_each_index"]=wasmExports["E"])();var _yeptris_wasm_each_close=Module["_yeptris_wasm_each_close"]=()=>(_yeptris_wasm_each_close=Module["_yeptris_wasm_each_close"]=wasmExports["F"])();var _yeptris_wasm_validate=Module["_yeptris_wasm_validate"]=(a0,a1,a2)=>(_yeptris_wasm_validate=Module["_yeptris_wasm_validate"]=wasmExports["G"])(a0,a1,a2);var _yeptris_wasm_json_schema_validate=Module["_yeptris_wasm_json_schema_validate"]=(a0,a1,a2,a3)=>(_yeptris_wasm_json_schema_validate=Module["_yeptris_wasm_json_schema_validate"]=wasmExports["H"])(a0,a1,a2,a3);var _yeptris_wasm_schema_compile=Module["_yeptris_wasm_schema_compile"]=(a0,a1)=>(_yeptris_wasm_schema_compile=Module["_yeptris_wasm_schema_compile"]=wasmExports["I"])(a0,a1);var _yeptris_wasm_schema_validate=Module["_yeptris_wasm_schema_validate"]=(a0,a1,a2)=>(_yeptris_wasm_schema_validate=Module["_yeptris_wasm_schema_validate"]=wasmExports["J"])(a0,a1,a2);var _yeptris_wasm_schema_free=Module["_yeptris_wasm_schema_free"]=a0=>(_yeptris_wasm_schema_free=Module["_yeptris_wasm_schema_free"]=wasmExports["K"])(a0);var ___errno_location=()=>(___errno_location=wasmExports["__errno_location"])();Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["lengthBytesUTF8"]=lengthBytesUTF8;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
8
+ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){const{createRequire:createRequire}=await import("module");var require=createRequire(import.meta.url);var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=require("url").fileURLToPath(new URL("./",import.meta.url))}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");var wasmBinaryFile;if(Module["locateFile"]){wasmBinaryFile="yeptris.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}}else{wasmBinaryFile=new URL("yeptris.wasm",import.meta.url).href}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"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["g"];updateMemoryViews();addOnInit(wasmExports["h"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var getHeapMax=()=>2147483648;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;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}var alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){HEAP8[buffer++>>0]=str.charCodeAt(i)}HEAP8[buffer>>0]=0};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;var UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;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)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var SYSCALLS={varargs:undefined,get(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret},getp(){return SYSCALLS.get()},getStr(ptr){var ret=UTF8ToString(ptr);return ret}};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var _fd_close=fd=>52;var MAX_INT53=9007199254740992;var MIN_INT53=-9007199254740992;var bigintToI53Checked=num=>num<MIN_INT53||num>MAX_INT53?NaN:Number(num);function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};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.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}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}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);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 wasmImports={b:_emscripten_resize_heap,e:_environ_get,f:_environ_sizes_get,d:_fd_close,c:_fd_seek,a:_fd_write};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["h"])();var _yeptris_wasm_load=Module["_yeptris_wasm_load"]=(a0,a1)=>(_yeptris_wasm_load=Module["_yeptris_wasm_load"]=wasmExports["i"])(a0,a1);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["j"])(a0);var _yeptris_wasm_load_all=Module["_yeptris_wasm_load_all"]=(a0,a1)=>(_yeptris_wasm_load_all=Module["_yeptris_wasm_load_all"]=wasmExports["k"])(a0,a1);var _yeptris_wasm_dump_ex=Module["_yeptris_wasm_dump_ex"]=(a0,a1,a2,a3)=>(_yeptris_wasm_dump_ex=Module["_yeptris_wasm_dump_ex"]=wasmExports["l"])(a0,a1,a2,a3);var _yeptris_wasm_dump=Module["_yeptris_wasm_dump"]=(a0,a1)=>(_yeptris_wasm_dump=Module["_yeptris_wasm_dump"]=wasmExports["m"])(a0,a1);var _yeptris_wasm_last_error=Module["_yeptris_wasm_last_error"]=()=>(_yeptris_wasm_last_error=Module["_yeptris_wasm_last_error"]=wasmExports["n"])();var _yeptris_wasm_last_error_line=Module["_yeptris_wasm_last_error_line"]=()=>(_yeptris_wasm_last_error_line=Module["_yeptris_wasm_last_error_line"]=wasmExports["o"])();var _yeptris_wasm_last_error_column=Module["_yeptris_wasm_last_error_column"]=()=>(_yeptris_wasm_last_error_column=Module["_yeptris_wasm_last_error_column"]=wasmExports["p"])();var _yeptris_wasm_out=Module["_yeptris_wasm_out"]=()=>(_yeptris_wasm_out=Module["_yeptris_wasm_out"]=wasmExports["q"])();var _yeptris_wasm_out_len=Module["_yeptris_wasm_out_len"]=()=>(_yeptris_wasm_out_len=Module["_yeptris_wasm_out_len"]=wasmExports["r"])();var _yeptris_wasm_out_free=Module["_yeptris_wasm_out_free"]=()=>(_yeptris_wasm_out_free=Module["_yeptris_wasm_out_free"]=wasmExports["s"])();var _yeptris_wasm_free=Module["_yeptris_wasm_free"]=a0=>(_yeptris_wasm_free=Module["_yeptris_wasm_free"]=wasmExports["t"])(a0);var _yeptris_wasm_version=Module["_yeptris_wasm_version"]=()=>(_yeptris_wasm_version=Module["_yeptris_wasm_version"]=wasmExports["u"])();var _yeptris_wasm_events=Module["_yeptris_wasm_events"]=(a0,a1)=>(_yeptris_wasm_events=Module["_yeptris_wasm_events"]=wasmExports["v"])(a0,a1);var _yeptris_wasm_event_records=Module["_yeptris_wasm_event_records"]=()=>(_yeptris_wasm_event_records=Module["_yeptris_wasm_event_records"]=wasmExports["w"])();var _yeptris_wasm_event_count=Module["_yeptris_wasm_event_count"]=()=>(_yeptris_wasm_event_count=Module["_yeptris_wasm_event_count"]=wasmExports["x"])();var _yeptris_wasm_event_arena=Module["_yeptris_wasm_event_arena"]=()=>(_yeptris_wasm_event_arena=Module["_yeptris_wasm_event_arena"]=wasmExports["y"])();var _yeptris_wasm_event_arena_len=Module["_yeptris_wasm_event_arena_len"]=()=>(_yeptris_wasm_event_arena_len=Module["_yeptris_wasm_event_arena_len"]=wasmExports["z"])();var _yeptris_wasm_events_free=Module["_yeptris_wasm_events_free"]=()=>(_yeptris_wasm_events_free=Module["_yeptris_wasm_events_free"]=wasmExports["A"])();var _yeptris_wasm_each_open=Module["_yeptris_wasm_each_open"]=(a0,a1)=>(_yeptris_wasm_each_open=Module["_yeptris_wasm_each_open"]=wasmExports["B"])(a0,a1);var _yeptris_wasm_each_open_ex=Module["_yeptris_wasm_each_open_ex"]=(a0,a1,a2,a3)=>(_yeptris_wasm_each_open_ex=Module["_yeptris_wasm_each_open_ex"]=wasmExports["C"])(a0,a1,a2,a3);var _yeptris_wasm_each_next=Module["_yeptris_wasm_each_next"]=()=>(_yeptris_wasm_each_next=Module["_yeptris_wasm_each_next"]=wasmExports["D"])();var _yeptris_wasm_each_frame=Module["_yeptris_wasm_each_frame"]=()=>(_yeptris_wasm_each_frame=Module["_yeptris_wasm_each_frame"]=wasmExports["E"])();var _yeptris_wasm_each_index=Module["_yeptris_wasm_each_index"]=()=>(_yeptris_wasm_each_index=Module["_yeptris_wasm_each_index"]=wasmExports["F"])();var _yeptris_wasm_each_close=Module["_yeptris_wasm_each_close"]=()=>(_yeptris_wasm_each_close=Module["_yeptris_wasm_each_close"]=wasmExports["G"])();var _yeptris_wasm_validate=Module["_yeptris_wasm_validate"]=(a0,a1,a2)=>(_yeptris_wasm_validate=Module["_yeptris_wasm_validate"]=wasmExports["H"])(a0,a1,a2);var _yeptris_wasm_json_schema_validate=Module["_yeptris_wasm_json_schema_validate"]=(a0,a1,a2,a3)=>(_yeptris_wasm_json_schema_validate=Module["_yeptris_wasm_json_schema_validate"]=wasmExports["I"])(a0,a1,a2,a3);var _yeptris_wasm_schema_compile=Module["_yeptris_wasm_schema_compile"]=(a0,a1)=>(_yeptris_wasm_schema_compile=Module["_yeptris_wasm_schema_compile"]=wasmExports["J"])(a0,a1);var _yeptris_wasm_schema_validate=Module["_yeptris_wasm_schema_validate"]=(a0,a1,a2)=>(_yeptris_wasm_schema_validate=Module["_yeptris_wasm_schema_validate"]=wasmExports["K"])(a0,a1,a2);var _yeptris_wasm_schema_free=Module["_yeptris_wasm_schema_free"]=a0=>(_yeptris_wasm_schema_free=Module["_yeptris_wasm_schema_free"]=wasmExports["L"])(a0);var ___errno_location=()=>(___errno_location=wasmExports["__errno_location"])();Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["lengthBytesUTF8"]=lengthBytesUTF8;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
9
9
 
10
10
 
11
11
  return moduleArg.ready
package/dist/yeptris.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeptris",
3
- "version": "0.6.60",
3
+ "version": "0.6.62",
4
4
  "description": "YAML for JavaScript at libyeptris speed (WebAssembly, no fallback)",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.d.ts CHANGED
@@ -187,6 +187,24 @@ export type EachDocumentResult =
187
187
  | { document: unknown; index: number; error: undefined }
188
188
  | { document: undefined; index: number; error: YamlError };
189
189
 
190
+ /** eachDocument's options door (the engine's YeptrisParseOptions —
191
+ * the ruby `each_document(yaml, schema:, max_depth:)` / py
192
+ * `each_document(yaml, schema=, max_depth=)` parity). Unknown or
193
+ * mistyped options throw TypeError. The compiled/JSON-Schema walks
194
+ * have no seat on the walk — the iterator carries a resolver kind,
195
+ * not a schema document; those doors ride validate()/load(). */
196
+ export interface EachDocumentOptions {
197
+ /** The resolver family every frame types its plain scalars
198
+ * through (the parse resolver's kind, the js-yaml parity names
199
+ * this face uses for validate/load): "core" (default) — the
200
+ * YAML 1.2 core resolver; "json" — the spec 10.2 JSON resolver. */
201
+ schema?: "core" | "json";
202
+ /** Maximum nesting depth per frame (0 = the library default). A
203
+ * frame past the cap fails as that frame's error item and the
204
+ * walk CONTINUES at the next `---` marker. */
205
+ max_depth?: number;
206
+ }
207
+
190
208
  /** Walk a multi-document stream one document at a time, TOLERANTLY
191
209
  * (the engine's stream iterator): an async generator of
192
210
  * EachDocumentResult in stream order. A parse-class failure carries
@@ -197,9 +215,11 @@ export type EachDocumentResult =
197
215
  * yield their item and end the walk; an unrecoverable tail ends it.
198
216
  * Lazy: nothing parses until iteration starts. Documents materialize
199
217
  * through load's serialize door (the engine's default, schema 1.2
200
- * core). */
218
+ * core). options selects the resolver family and the per-frame depth
219
+ * cap (ruby/py parity). */
201
220
  export declare function eachDocument(
202
221
  yaml: string,
222
+ options?: EachDocumentOptions,
203
223
  ): AsyncGenerator<EachDocumentResult, void, undefined>;
204
224
 
205
225
  /** Options for dump (js-yaml parity names over emit.h's
@@ -288,9 +308,10 @@ export declare function compileSchemaSync(jsonSchema: object | string): Schema;
288
308
 
289
309
  /** eachDocument's Sync twin: a sync generator over an initialized
290
310
  * module (await init() first). Throws unless the module is
291
- * initialized. */
311
+ * initialized. Takes the same options door as eachDocument. */
292
312
  export declare function eachDocumentSync(
293
313
  yaml: string,
314
+ options?: EachDocumentOptions,
294
315
  ): Generator<EachDocumentResult, void, undefined>;
295
316
 
296
317
  /** version's Sync twin. Throws unless the module is initialized. */
package/src/index.js CHANGED
@@ -526,18 +526,99 @@ function compileSchemaCore(mod, jsonSchema) {
526
526
  //
527
527
  // The JS shape is the rs face's: an iterator of result objects —
528
528
  // `{ document, index }` for a valid document, `{ error, index }` for
529
- // a failed one. The engine default (schema 1.2 core) rides as-is; the
530
- // options door (schema/max_depth) is the engine's parse-options struct
531
- // and joins when the face needs it.
529
+ // a failed one. The engine default (schema 1.2 core) rides as-is;
530
+ // the options door (schema/max_depth — ruby/py parity) fills the
531
+ // engine's parse-options struct through the shim's open params.
532
532
 
533
533
  const ST_MEMORY = 2; // YEPTRIS_ERROR_MEMORY — stream-fatal
534
534
  const ST_ENCODING = 4; // YEPTRIS_ERROR_ENCODING — stream-fatal
535
535
 
536
- function eachDocumentCore(mod, yaml) {
536
+ // eachDocument's options door (the engine's YeptrisParseOptions, the
537
+ // ruby `each_document(yaml, schema:, max_depth:)` / py
538
+ // `each_document(yaml, schema=, max_depth=)` parity): `schema` is the
539
+ // resolver family every frame types its plain scalars through (the
540
+ // parse resolver's kind, spelled the js-yaml parity way this face
541
+ // already uses for validate/load — "core" the 1.2 core default,
542
+ // "json" the spec 10.2 JSON resolver), `max_depth` caps per-frame
543
+ // nesting (0 = the library default; a frame past the cap fails as
544
+ // that frame's error item and the walk continues at the next marker).
545
+ // The compiled/JSON-Schema doors have no seat on the walk — the
546
+ // iterator carries a resolver KIND, not a schema document; those
547
+ // doors ride validate/load. Strictness law (the dump precedent):
548
+ // unknown or mistyped keys are rejected, never silently ignored.
549
+ // With no options the shim keeps its NULL ride — the engine defaults,
550
+ // the face's shipped v1 contract — byte-identical to the pre-door era.
551
+ function parseEachOptions(options, who) {
552
+ if (options === undefined || options === null) {
553
+ return { kind: -1, maxDepth: 0 }; // -1: the shim's NULL-opts ride
554
+ }
555
+ if (typeof options !== "object") {
556
+ throw new TypeError(`yeptris: ${who} options must be an object`);
557
+ }
558
+ const KEYS = new Set(["schema", "max_depth"]);
559
+ for (const key of Object.keys(options)) {
560
+ if (!KEYS.has(key)) {
561
+ throw new TypeError(
562
+ `yeptris: ${who} option "${key}" is not supported ` +
563
+ "(the surface is schema + max_depth)");
564
+ }
565
+ }
566
+ let kind = 0; // an options object arms the door: the 1.2 core family
567
+ if (options.schema !== undefined && options.schema !== null) {
568
+ if (options.schema instanceof Schema) {
569
+ throw new TypeError(
570
+ `yeptris: ${who}: a compiled Schema rides validate()/load(), ` +
571
+ "not the walk — the iterator takes the resolver kind " +
572
+ '(schema: "core" | "json")');
573
+ }
574
+ if (typeof options.schema !== "string" ||
575
+ (options.schema !== "core" && options.schema !== "json")) {
576
+ throw new TypeError(
577
+ `yeptris: ${who} option schema must be "core" or "json" (got ` +
578
+ JSON.stringify(options.schema) + ")");
579
+ }
580
+ kind = options.schema === "json" ? 2 : 0; // YEPTRIS_SCHEMA_12_JSON / _12_CORE
581
+ }
582
+ let maxDepth = 0;
583
+ if (options.max_depth !== undefined && options.max_depth !== null) {
584
+ const d = options.max_depth;
585
+ if (typeof d !== "number" || !Number.isInteger(d) || d < 0) {
586
+ throw new TypeError(
587
+ `yeptris: ${who} option max_depth must be a non-negative integer ` +
588
+ "(0 rides the library default)");
589
+ }
590
+ maxDepth = d;
591
+ }
592
+ return { kind, maxDepth };
593
+ }
594
+
595
+ function eachDocumentCore(mod, yaml, vo) {
537
596
  return (function* () {
538
597
  const [ptr, len] = cstr(mod, yaml);
539
598
  try {
540
- const openSt = mod._yeptris_wasm_each_open(ptr, len);
599
+ // The capability probe: the door rides a NEW export (the v1
600
+ // open's 2-param wasm ABI stays frozen — this surface's ABI is
601
+ // append-only), so a dist built before the door simply lacks
602
+ // it. The probe is the missing-export check's own idiom, and it
603
+ // gates the DOOR ONLY: the no-options walk is the v1 contract
604
+ // and rides either era unchanged. Without the probe wasm would
605
+ // never even see the call — the export isn't there to call —
606
+ // and the options would have no seat at all; with it, a stale
607
+ // dist is refused loudly instead of pretending.
608
+ let openSt;
609
+ if (vo.kind >= 0) {
610
+ const openEx = mod._yeptris_wasm_each_open_ex;
611
+ if (typeof openEx !== "function") {
612
+ throw new Error(
613
+ "yeptris: the eachDocument options door needs a dist rebuilt " +
614
+ "with build.sh — the loaded wasm predates the options era " +
615
+ "(stale artifact)",
616
+ );
617
+ }
618
+ openSt = openEx(ptr, len, vo.kind, vo.maxDepth);
619
+ } else {
620
+ openSt = mod._yeptris_wasm_each_open(ptr, len);
621
+ }
541
622
  if (openSt !== 0) {
542
623
  throw failFrom(mod);
543
624
  }
@@ -587,17 +668,26 @@ function eachDocumentCore(mod, yaml) {
587
668
  * stream-fatal classes (memory/encoding) yield their item and end the
588
669
  * walk; an unrecoverable tail ends it. Lazy: nothing parses until
589
670
  * iteration starts. Documents materialize through load's serialize
590
- * door, so each frame's value is load's value by construction. The
591
- * engine default (schema 1.2 core) rides as-is. */
592
- export async function* eachDocument(yaml) {
671
+ * door, so each frame's value is load's value by construction.
672
+ *
673
+ * options (the engine's parse options — ruby/py parity): schema —
674
+ * the resolver family every frame types through, "core" (default) or
675
+ * "json"; max_depth — the per-frame nesting cap, 0 = the library
676
+ * default (a frame past the cap fails as that frame's item and the
677
+ * walk continues). Unknown or mistyped options throw TypeError. */
678
+ export async function* eachDocument(yaml, options) {
593
679
  const m = await mod();
594
- yield* eachDocumentCore(m, yaml);
680
+ yield* eachDocumentCore(m, yaml, parseEachOptions(options, "eachDocument"));
595
681
  }
596
682
 
597
683
  /** eachDocument's Sync twin: a sync generator over an initialized
598
- * module (await init() first). */
599
- export function eachDocumentSync(yaml) {
600
- return eachDocumentCore(requireMod("eachDocumentSync"), yaml);
684
+ * module (await init() first). Takes the same options door. */
685
+ export function eachDocumentSync(yaml, options) {
686
+ return eachDocumentCore(
687
+ requireMod("eachDocumentSync"),
688
+ yaml,
689
+ parseEachOptions(options, "eachDocumentSync"),
690
+ );
601
691
  }
602
692
 
603
693
  // ---- load/dump cores (shared by the async and Sync forms) --------------
@@ -502,19 +502,32 @@ void yeptris_wasm_events_free(void) {
502
502
  * face: open (feed, copy, construct), next() repeatedly, close always
503
503
  * (the JS generator's finally is the owner).
504
504
  *
505
- * The base four functions only (new/next/status/free) — this face
506
- * ships against the v0.6.60 engine, whose iterator predates the slice
505
+ * The base four functions (new/next/status/free) — this face ships
506
+ * against the v0.6.60 engine, whose iterator predates the slice
507
507
  * accessors; the frame document crosses as JSON through the same
508
508
  * g_out discipline every answer uses (a frame is a dcount==1 forest,
509
- * so serialize_json answers it directly — the load path). */
509
+ * so serialize_json answers it directly — the load path).
510
+ *
511
+ * The options door (ruby/py parity): open_ex carries (schema_kind,
512
+ * max_depth) and fills the engine's YeptrisParseOptions for the walk —
513
+ * the resolver family every frame types through and the per-frame
514
+ * nesting cap. The options struct is RETAINED (g_it_opts): the engine
515
+ * iterator only borrows its options (parse.h) and dereferences them
516
+ * on every next(), so a stack copy would die when open returns.
517
+ * schema_kind < 0 keeps the NULL ride — the engine defaults, the v1
518
+ * contract — and zeroed fields are the parse defaults, so only the
519
+ * two live fields ride (strict/tab_policy/recover stay reserved pins).
520
+ * The door is a NEW export, never a signature change of the v1 open
521
+ * above: this wasm surface's ABI is append-only, and the host probes
522
+ * the door's presence instead of trusting an export's arity. */
510
523
  static yeptris_stream_iter *g_it;
511
524
  static char *g_it_buf; /* the borrowed input's retained copy */
512
525
  static size_t g_it_buf_len;
513
526
  static int g_it_frame; /* 1: g_out carries a document JSON; 0: none */
514
527
  static int g_it_index; /* the last next() step's consumed stream index */
528
+ static YeptrisParseOptions g_it_opts; /* borrowed by the iterator */
515
529
 
516
- EMSCRIPTEN_KEEPALIVE
517
- int yeptris_wasm_each_open(const char *data, size_t len) {
530
+ static int each_open_common(const char *data, size_t len, int schema_kind, int max_depth) {
518
531
  if (g_it != NULL) { /* defensive: the previous walk was not closed */
519
532
  yeptris_stream_iter_free(g_it);
520
533
  g_it = NULL;
@@ -533,7 +546,15 @@ int yeptris_wasm_each_open(const char *data, size_t len) {
533
546
  memcpy(g_it_buf, data, len);
534
547
  }
535
548
  g_it_buf_len = len;
536
- g_it = yeptris_stream_iter_new(g_it_buf, len, NULL);
549
+ if (schema_kind < 0) {
550
+ /* the v1 contract: NULL opts rides the engine defaults */
551
+ g_it = yeptris_stream_iter_new(g_it_buf, len, NULL);
552
+ } else {
553
+ memset(&g_it_opts, 0, sizeof g_it_opts); /* zero = the parse defaults */
554
+ g_it_opts.schema = (YeptrisSchema)schema_kind;
555
+ g_it_opts.max_depth = max_depth;
556
+ g_it = yeptris_stream_iter_new(g_it_buf, len, &g_it_opts);
557
+ }
537
558
  if (g_it == NULL) {
538
559
  free(g_it_buf);
539
560
  g_it_buf = NULL;
@@ -544,6 +565,19 @@ int yeptris_wasm_each_open(const char *data, size_t len) {
544
565
  return YEPTRIS_OK;
545
566
  }
546
567
 
568
+ /* The v1 open: NULL opts — the engine defaults, the face's shipped
569
+ * contract, byte-identical on every dist era. */
570
+ EMSCRIPTEN_KEEPALIVE
571
+ int yeptris_wasm_each_open(const char *data, size_t len) {
572
+ return each_open_common(data, len, -1, 0);
573
+ }
574
+
575
+ /* The options door (the v1 contract grown, not changed — see above). */
576
+ EMSCRIPTEN_KEEPALIVE
577
+ int yeptris_wasm_each_open_ex(const char *data, size_t len, int schema_kind, int max_depth) {
578
+ return each_open_common(data, len, schema_kind, max_depth);
579
+ }
580
+
547
581
  EMSCRIPTEN_KEEPALIVE
548
582
  int yeptris_wasm_each_next(void) {
549
583
  if (g_it == NULL) {