@gjsify/compression-streams 0.3.20 → 0.3.21
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/lib/esm/index.js +1 -1
- package/package.json +4 -4
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TransformStream as e}from"@gjsify/web-streams";const t=new Set([`gzip`,`deflate`,`deflate-raw`]);function
|
|
1
|
+
import{TransformStream as e}from"@gjsify/web-streams";const t=new Set([`gzip`,`deflate`,`deflate-raw`]);function validateFormat(e){if(!t.has(e))throw TypeError(`Unsupported compression format: '${e}'. Supported formats: 'gzip', 'deflate', 'deflate-raw'.`);return e}const n=typeof globalThis.CompressionStream==`function`&&typeof globalThis.DecompressionStream==`function`;let r=!1,i,a,o,s,c,l;async function loadZlib(){if(r)return;let e=await import(`zlib`);i=e.gzipSync,a=e.gunzipSync,o=e.deflateSync,s=e.inflateSync,c=e.deflateRawSync,l=e.inflateRawSync,r=!0}function getCompressFn(e){switch(e){case`gzip`:return e=>i(e);case`deflate`:return e=>o(e);case`deflate-raw`:return e=>c(e)}}function getDecompressFn(e){switch(e){case`gzip`:return e=>a(e);case`deflate`:return e=>s(e);case`deflate-raw`:return e=>l(e)}}let CompressionStreamImpl,DecompressionStreamImpl;n?(CompressionStreamImpl=globalThis.CompressionStream,DecompressionStreamImpl=globalThis.DecompressionStream):(loadZlib(),CompressionStreamImpl=class{readable;writable;constructor(t){let n=validateFormat(t);if(!r)throw Error(`zlib not yet loaded. Ensure module initialization is complete.`);let i=getCompressFn(n),a=new e({transform(e,t){try{t.enqueue(i(e))}catch(e){t.error(e)}}});this.readable=a.readable,this.writable=a.writable}},DecompressionStreamImpl=class{readable;writable;constructor(t){let n=validateFormat(t);if(!r)throw Error(`zlib not yet loaded. Ensure module initialization is complete.`);let i=getDecompressFn(n),a=new e({transform(e,t){try{t.enqueue(i(e))}catch(e){t.error(e)}}});this.readable=a.readable,this.writable=a.writable}});var u={CompressionStream:CompressionStreamImpl,DecompressionStream:DecompressionStreamImpl};export{CompressionStreamImpl as CompressionStream,DecompressionStreamImpl as DecompressionStream,u as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/compression-streams",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "W3C Compression Streams API for GJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"streams"
|
|
42
42
|
],
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@gjsify/cli": "^0.3.
|
|
45
|
-
"@gjsify/unit": "^0.3.
|
|
44
|
+
"@gjsify/cli": "^0.3.21",
|
|
45
|
+
"@gjsify/unit": "^0.3.21",
|
|
46
46
|
"@types/node": "^25.6.2",
|
|
47
47
|
"typescript": "^6.0.3"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gjsify/web-streams": "^0.3.
|
|
50
|
+
"@gjsify/web-streams": "^0.3.21"
|
|
51
51
|
}
|
|
52
52
|
}
|