defuss-brotli 0.2.0 → 0.3.0
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 +34 -0
- package/README.md +97 -13
- package/dist/cli.js +37 -0
- package/dist/compressor-core.d.ts +63 -4
- package/dist/compressor-encode.d.ts +16 -0
- package/dist/compressor-slim.d.ts +1 -1
- package/dist/compressor-slim.js +1 -1
- package/dist/compressor.d.ts +1 -1
- package/dist/compressor.js +1 -1
- package/dist/compressor.wasm +0 -0
- package/dist/decompressor-slim.js +1 -1
- package/dist/decompressor.js +1 -1
- package/dist/wasm.d.ts +8 -2
- package/dist/workers.d.ts +27 -0
- package/package.json +6 -2
package/dist/compressor.wasm
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var F=(e)=>e;function z(e,t){this[e]=F.bind(null,t)}var k=(e,t)=>{for(var r in t)v(e,r,{get:t[r],enumerable:!0,configurable:!0,set:z.bind(t,r)})};var A={};k(A,{Decoder:()=>d,__wbg_Error_83742b46f01ce22d:()=>L,__wbg___wbindgen_throw_6ddd609b62940d55:()=>j,__wbg_set_wasm:()=>H});class d{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,S.unregister(this),e}free(){let e=this.__destroy_into_raw();s.__wbg_decoder_free(e,0)}constructor(e,t){try{let i=s.__wbindgen_add_to_stack_pointer(-16);s.decoder_create(i,e,t);var r=c().getInt32(i+0,!0),n=c().getInt32(i+4,!0),o=c().getInt32(i+8,!0);if(o)throw
|
|
1
|
+
var v=Object.defineProperty;var F=(e)=>e;function z(e,t){this[e]=F.bind(null,t)}var k=(e,t)=>{for(var r in t)v(e,r,{get:t[r],enumerable:!0,configurable:!0,set:z.bind(t,r)})};var A={};k(A,{Decoder:()=>d,__wbg_Error_83742b46f01ce22d:()=>L,__wbg___wbindgen_throw_6ddd609b62940d55:()=>j,__wbg_set_wasm:()=>H});class d{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,S.unregister(this),e}free(){let e=this.__destroy_into_raw();s.__wbg_decoder_free(e,0)}constructor(e,t){try{let i=s.__wbindgen_add_to_stack_pointer(-16);s.decoder_create(i,e,t);var r=c().getInt32(i+0,!0),n=c().getInt32(i+4,!0),o=c().getInt32(i+8,!0);if(o)throw M(n);return this.__wbg_ptr=r>>>0,S.register(this,this.__wbg_ptr,this),this}finally{s.__wbindgen_add_to_stack_pointer(16)}}decode(e,t){try{let i=s.__wbindgen_add_to_stack_pointer(-16);s.decoder_decode(i,this.__wbg_ptr,e,t);var r=c().getInt32(i+0,!0),n=c().getInt32(i+4,!0),o=c().getInt32(i+8,!0);if(o)throw M(n);return r>>>0}finally{s.__wbindgen_add_to_stack_pointer(16)}}finished(){return s.decoder_finished(this.__wbg_ptr)!==0}input_capacity(){return s.decoder_input_capacity(this.__wbg_ptr)>>>0}input_ptr(){return s.decoder_input_ptr(this.__wbg_ptr)>>>0}needs_input(){return s.decoder_needs_input(this.__wbg_ptr)!==0}output_ptr(){return s.decoder_output_ptr(this.__wbg_ptr)>>>0}}if(Symbol.dispose)d.prototype[Symbol.dispose]=d.prototype.free;function L(e,t){let r=Error(O(e,t));return C(r)}function j(e,t){throw Error(O(e,t))}var S=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((e)=>s.__wbg_decoder_free(e>>>0,1));function C(e){if(f===a.length)a.push(a.length+1);let t=f;return f=a[t],a[t]=e,t}function V(e){if(e<1028)return;a[e]=f,f=e}var u=null;function c(){if(u===null||u.buffer.detached===!0||u.buffer.detached===void 0&&u.buffer!==s.memory.buffer)u=new DataView(s.memory.buffer);return u}function O(e,t){return e=e>>>0,G(e,t)}var _=null;function X(){if(_===null||_.byteLength===0)_=new Uint8Array(s.memory.buffer);return _}function N(e){return a[e]}var a=Array(1024).fill(void 0);a.push(void 0,null,!0,!1);var f=a.length;function M(e){let t=N(e);return V(e),t}var y=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});y.decode();var Z=2146435072,h=0;function G(e,t){if(h+=t,h>=Z)y=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),y.decode(),h=t;return y.decode(X().subarray(e,e+t))}var s;function H(e){s=e}async function q(e){let r=globalThis.process?.getBuiltinModule?.("node:fs/promises");if(!r)throw Error(`cannot read ${e.href} in this runtime; pass the .wasm bytes or a Response to init() instead`);return r.readFile(e)}async function Y(e,t){if(!e.ok)throw Error(`failed to load WASM from ${e.url}: HTTP ${e.status}`);if(typeof WebAssembly.instantiateStreaming==="function"&&e.headers.get("Content-Type")==="application/wasm")return WebAssembly.instantiateStreaming(e,t);return WebAssembly.instantiate(await e.arrayBuffer(),t)}async function B(e,t,r){let n={[t]:r},o=await e;if(typeof o==="string"||o instanceof URL){let l=new URL(o,globalThis.location?.href);o=l.protocol==="file:"?await q(l):await fetch(l)}let i;if(o instanceof WebAssembly.Module)i={module:o,instance:await WebAssembly.instantiate(o,n)};else if(o instanceof Response)i=await Y(o,n);else i=await WebAssembly.instantiate(o,n);return r.__wbg_set_wasm(i.instance.exports),{memory:i.instance.exports.memory,module:i.module}}function D(e,t){if(e.length===1)return e[0];let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}var R=67108864,J=4294967295,b=null,x=!1;function K(e,t,r){let n=new d(t.length,r);try{let o=n.input_ptr(),i=n.output_ptr(),l=n.input_capacity(),U=[],m=0,W=0;do{let p=0;if(n.needs_input())p=Math.min(l,t.length-m),new Uint8Array(e.buffer,o,p).set(t.subarray(m,m+p)),m+=p;let g=n.decode(p,m===t.length);if(g>0)U.push(new Uint8Array(e.buffer,i,g).slice());W+=g}while(!n.finished());return D(U,W)}finally{n.free()}}var w=null;function T(){if(!x||!w)throw Error("defuss-brotli/decompressor is not initialized. Call await init() first.")}function I(e={}){let t=e.maxOutputSize??R;if(!Number.isInteger(t)||t<=0)throw Error("maxOutputSize must be a positive integer");return{maxOutputSize:t}}function E(e){if(!b)b=Promise.resolve().then(()=>B(e(),"./defuss_brotli_decompressor_bg.js",A)).then(({memory:t})=>{w=(r,n)=>K(t,r,n),x=!0},(t)=>{throw b=null,t});return b}function Q(){return x}function P(e,t={}){T();let{maxOutputSize:r}=I(t);return w(e,Math.min(r,J))}function ee(e,t={}){return new TextDecoder().decode(P(e,t))}function se(e){return E(()=>e??new URL("./decompressor.wasm",import.meta.url))}export{R as DEFAULT_MAX_OUTPUT_SIZE,T as assertReady,P as decompress,ee as decompressText,se as init,Q as isReady,I as normalizeOptions,w as wasmDecompressBytes};
|