@vercel/stega 0.1.2 → 1.0.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/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},c={0:8203,1:8204,2:8205,3:65279},u=new Array(4).fill(String.fromCodePoint(c[0])).join(""),m=String.fromCharCode(0);function E(t){let e=JSON.stringify(t);return`${u}${Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map(o=>String.fromCodePoint(c[o])).join("")}).join("")}`}function y(t){let e=JSON.stringify(t);return Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(16).padStart(2,"0")).map(o=>String.fromCodePoint(s[o])).join("")}).join("")}function I(t){return!Number.isNaN(Number(t))||/[a-z]/i.test(t)&&!/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t)?!1:Boolean(Date.parse(t))}function T(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0)}catch (e2){return!1}return!0}function C(t,e,r="auto"){return r===!0||r==="auto"&&(I(t)||T(t))?t:`${t}${E(e)}`}var x=Object.fromEntries(Object.entries(c).map(t=>t.reverse())),g=Object.fromEntries(Object.entries(s).map(t=>t.reverse())),S=`${Object.values(s).map(t=>`\\u{${t.toString(16)}}`).join("")}`,f= exports.VERCEL_STEGA_REGEX =new RegExp(`[${S}]{4,}`,"gu");function G(t){let e=t.match(f);if(!!e)return h(e[0],!0)[0]}function $(t){let e=t.match(f);if(!!e)return e.map(r=>h(r)).flat()}function h(t,e=!1){let r=Array.from(t);if(r.length%2===0){if(r.length%4||!t.startsWith(u))return A(r,e)}else throw new Error("Encoded data has invalid length");let n=[];for(let o=r.length*.25;o--;){let p=r.slice(o*4,o*4+4).map(d=>x[d.codePointAt(0)]).join("");n.unshift(String.fromCharCode(parseInt(p,4)))}if(e){n.shift();let o=n.indexOf(m);return o===-1&&(o=n.length),[JSON.parse(n.slice(0,o).join(""))]}return n.join("").split(m).filter(Boolean).map(o=>JSON.parse(o))}function A(t,e){var d;let r=[];for(let i=t.length*.5;i--;){let a=`${g[t[i*2].codePointAt(0)]}${g[t[i*2+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(a,16)))}let n=[],o=[r.join("")],p=10;for(;o.length;){let i=o.shift();try{if(n.push(JSON.parse(i)),e)return n}catch(a){if(!p--)throw a;let l=+((d=a.message.match(/\sposition\s(\d+)$/))==null?void 0:d[1]);if(!l)throw a;o.unshift(i.substring(0,l),i.substring(l))}}return n}function _(t){var e;return{cleaned:t.replace(f,""),encoded:((e=t.match(f))==null?void 0:e[0])||""}}function O(t){return t&&JSON.parse(_(JSON.stringify(t)).cleaned)}exports.VERCEL_STEGA_REGEX = f; exports.legacyStegaEncode = y; exports.vercelStegaClean = O; exports.vercelStegaCombine = C; exports.vercelStegaDecode = G; exports.vercelStegaDecodeAll = $; exports.vercelStegaEncode = E; exports.vercelStegaSplit = _;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var l={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},d={0:8203,1:8204,2:8205,3:65279},a={0:String.fromCodePoint(d[0]),1:String.fromCodePoint(d[1]),2:String.fromCodePoint(d[2]),3:String.fromCodePoint(d[3])},p=new Array(4).fill(String.fromCodePoint(d[0])).join(""),m=String.fromCharCode(0);function A(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),n="";for(let i=0;i<r.length;i++){let c=r[i];n+=a[c>>6&3]+a[c>>4&3]+a[c>>2&3]+a[c&3]}return p+n}function C(t){let e=JSON.stringify(t);return Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(16).padStart(2,"0")).map(i=>String.fromCodePoint(l[i])).join("")}).join("")}function h(t){return!Number.isNaN(Number(t))||/[a-z]/i.test(t)&&!/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t)?!1:!!Date.parse(t)}function S(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0)}catch (e2){return!1}return!0}function b(t,e,r="auto"){return r===!0||r==="auto"&&(h(t)||S(t))?t:`${t}${A(e)}`}var g=Object.fromEntries(Object.entries(a).map(t=>[t[1],+t[0]])),T=Object.fromEntries(Object.entries(l).map(t=>t.reverse())),_=`${Object.values(l).map(t=>`\\u{${t.toString(16)}}`).join("")}`,u= exports.VERCEL_STEGA_REGEX =new RegExp(`[${_}]{4,}`,"gu");function X(t){let e=t.match(u);if(e)return x(e[0],!0)[0]}function w(t){let e=t.match(u);if(e)return e.map(r=>x(r)).flat()}function x(t,e=!1){let r=Array.from(t);if(r.length%2===0){if(r.length%4||!t.startsWith(p))return I(r,e)}else throw new Error("Encoded data has invalid length");let n=r.slice(4),i=new Uint8Array(n.length/4);for(let o=0;o<i.length;o++)i[o]=g[n[o*4]]<<6|g[n[o*4+1]]<<4|g[n[o*4+2]]<<2|g[n[o*4+3]];let c=new TextDecoder().decode(i);if(e){let o=c.indexOf(m);return o===-1&&(o=c.length),[JSON.parse(c.slice(0,o))]}return c.split(m).filter(Boolean).map(o=>JSON.parse(o))}function I(t,e){var o;let r=[];for(let s=t.length*.5;s--;){let f=`${T[t[s*2].codePointAt(0)]}${T[t[s*2+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(f,16)))}let n=[],i=[r.join("")],c=10;for(;i.length;){let s=i.shift();try{if(n.push(JSON.parse(s)),e)return n}catch(f){if(!c--)throw f;let E=+((o=f.message.match(/\sposition\s(\d+)$/))==null?void 0:o[1]);if(!E)throw f;i.unshift(s.substring(0,E),s.substring(E))}}return n}function D(t){var e;return{cleaned:t.replace(u,""),encoded:((e=t.match(u))==null?void 0:e[0])||""}}function M(t){return t&&JSON.parse(D(JSON.stringify(t)).cleaned)}exports.VERCEL_STEGA_REGEX = u; exports.legacyStegaEncode = C; exports.vercelStegaClean = M; exports.vercelStegaCombine = b; exports.vercelStegaDecode = X; exports.vercelStegaDecodeAll = w; exports.vercelStegaEncode = A; exports.vercelStegaSplit = D;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var s={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},c={0:8203,1:8204,2:8205,3:65279},u=new Array(4).fill(String.fromCodePoint(c[0])).join(""),m=String.fromCharCode(0);function E(t){let e=JSON.stringify(t);return`${u}${Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map(o=>String.fromCodePoint(c[o])).join("")}).join("")}`}function y(t){let e=JSON.stringify(t);return Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(16).padStart(2,"0")).map(o=>String.fromCodePoint(s[o])).join("")}).join("")}function I(t){return!Number.isNaN(Number(t))||/[a-z]/i.test(t)&&!/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t)?!1:Boolean(Date.parse(t))}function T(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}function C(t,e,r="auto"){return r===!0||r==="auto"&&(I(t)||T(t))?t:`${t}${E(e)}`}var x=Object.fromEntries(Object.entries(c).map(t=>t.reverse())),g=Object.fromEntries(Object.entries(s).map(t=>t.reverse())),S=`${Object.values(s).map(t=>`\\u{${t.toString(16)}}`).join("")}`,f=new RegExp(`[${S}]{4,}`,"gu");function G(t){let e=t.match(f);if(!!e)return h(e[0],!0)[0]}function $(t){let e=t.match(f);if(!!e)return e.map(r=>h(r)).flat()}function h(t,e=!1){let r=Array.from(t);if(r.length%2===0){if(r.length%4||!t.startsWith(u))return A(r,e)}else throw new Error("Encoded data has invalid length");let n=[];for(let o=r.length*.25;o--;){let p=r.slice(o*4,o*4+4).map(d=>x[d.codePointAt(0)]).join("");n.unshift(String.fromCharCode(parseInt(p,4)))}if(e){n.shift();let o=n.indexOf(m);return o===-1&&(o=n.length),[JSON.parse(n.slice(0,o).join(""))]}return n.join("").split(m).filter(Boolean).map(o=>JSON.parse(o))}function A(t,e){var d;let r=[];for(let i=t.length*.5;i--;){let a=`${g[t[i*2].codePointAt(0)]}${g[t[i*2+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(a,16)))}let n=[],o=[r.join("")],p=10;for(;o.length;){let i=o.shift();try{if(n.push(JSON.parse(i)),e)return n}catch(a){if(!p--)throw a;let l=+((d=a.message.match(/\sposition\s(\d+)$/))==null?void 0:d[1]);if(!l)throw a;o.unshift(i.substring(0,l),i.substring(l))}}return n}function _(t){var e;return{cleaned:t.replace(f,""),encoded:((e=t.match(f))==null?void 0:e[0])||""}}function O(t){return t&&JSON.parse(_(JSON.stringify(t)).cleaned)}export{f as VERCEL_STEGA_REGEX,y as legacyStegaEncode,O as vercelStegaClean,C as vercelStegaCombine,G as vercelStegaDecode,$ as vercelStegaDecodeAll,E as vercelStegaEncode,_ as vercelStegaSplit};
1
+ var l={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},d={0:8203,1:8204,2:8205,3:65279},a={0:String.fromCodePoint(d[0]),1:String.fromCodePoint(d[1]),2:String.fromCodePoint(d[2]),3:String.fromCodePoint(d[3])},p=new Array(4).fill(String.fromCodePoint(d[0])).join(""),m=String.fromCharCode(0);function A(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),n="";for(let i=0;i<r.length;i++){let c=r[i];n+=a[c>>6&3]+a[c>>4&3]+a[c>>2&3]+a[c&3]}return p+n}function C(t){let e=JSON.stringify(t);return Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(16).padStart(2,"0")).map(i=>String.fromCodePoint(l[i])).join("")}).join("")}function h(t){return!Number.isNaN(Number(t))||/[a-z]/i.test(t)&&!/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t)?!1:!!Date.parse(t)}function S(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}function b(t,e,r="auto"){return r===!0||r==="auto"&&(h(t)||S(t))?t:`${t}${A(e)}`}var g=Object.fromEntries(Object.entries(a).map(t=>[t[1],+t[0]])),T=Object.fromEntries(Object.entries(l).map(t=>t.reverse())),_=`${Object.values(l).map(t=>`\\u{${t.toString(16)}}`).join("")}`,u=new RegExp(`[${_}]{4,}`,"gu");function X(t){let e=t.match(u);if(e)return x(e[0],!0)[0]}function w(t){let e=t.match(u);if(e)return e.map(r=>x(r)).flat()}function x(t,e=!1){let r=Array.from(t);if(r.length%2===0){if(r.length%4||!t.startsWith(p))return I(r,e)}else throw new Error("Encoded data has invalid length");let n=r.slice(4),i=new Uint8Array(n.length/4);for(let o=0;o<i.length;o++)i[o]=g[n[o*4]]<<6|g[n[o*4+1]]<<4|g[n[o*4+2]]<<2|g[n[o*4+3]];let c=new TextDecoder().decode(i);if(e){let o=c.indexOf(m);return o===-1&&(o=c.length),[JSON.parse(c.slice(0,o))]}return c.split(m).filter(Boolean).map(o=>JSON.parse(o))}function I(t,e){var o;let r=[];for(let s=t.length*.5;s--;){let f=`${T[t[s*2].codePointAt(0)]}${T[t[s*2+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(f,16)))}let n=[],i=[r.join("")],c=10;for(;i.length;){let s=i.shift();try{if(n.push(JSON.parse(s)),e)return n}catch(f){if(!c--)throw f;let E=+((o=f.message.match(/\sposition\s(\d+)$/))==null?void 0:o[1]);if(!E)throw f;i.unshift(s.substring(0,E),s.substring(E))}}return n}function D(t){var e;return{cleaned:t.replace(u,""),encoded:((e=t.match(u))==null?void 0:e[0])||""}}function M(t){return t&&JSON.parse(D(JSON.stringify(t)).cleaned)}export{u as VERCEL_STEGA_REGEX,C as legacyStegaEncode,M as vercelStegaClean,b as vercelStegaCombine,X as vercelStegaDecode,w as vercelStegaDecodeAll,A as vercelStegaEncode,D as vercelStegaSplit};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/stega",
3
- "version": "0.1.2",
3
+ "version": "1.0.0",
4
4
  "description": "Utilities for steganography",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -15,8 +15,7 @@
15
15
  "jest": "^29.6.1",
16
16
  "ts-jest": "^29.1.1",
17
17
  "tsup": "^6.7.0",
18
- "typescript": "^4.6.3",
19
- "@vercel-private/conformance": "1.7.0"
18
+ "typescript": "^4.6.3"
20
19
  },
21
20
  "access": "public",
22
21
  "publishConfig": {
@@ -25,7 +24,6 @@
25
24
  "scripts": {
26
25
  "dev": "tsup --watch",
27
26
  "build": "tsup",
28
- "conformance": "vercel-conformance",
29
27
  "test": "jest"
30
28
  }
31
29
  }