Skip to content

Commit

Permalink
monograph: fix Already initialized. The initialize` function can be…
Browse files Browse the repository at this point in the history
… used only once.`
  • Loading branch information
thecodrr committed Oct 11, 2024
1 parent d6ed992 commit 8bfc158
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions apps/monograph/patches/svg2png-wasm+1.4.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/node_modules/svg2png-wasm/dist/index.cjs b/node_modules/svg2png-wasm/dist/index.cjs
index 90b4982..5de4604 100644
--- a/node_modules/svg2png-wasm/dist/index.cjs
+++ b/node_modules/svg2png-wasm/dist/index.cjs
@@ -331,9 +331,10 @@ var svg2png_wasm_default = __wbg_init;
var initialized = false;
var initialize = async (mod) => {
if (initialized) {
- throw new Error(
- "Already initialized. The `initialize` function can be used only once."
- );
+ return;
+ // throw new Error(
+ // "Already initialized. The `initialize` function can be used only once."
+ // );
}
await svg2png_wasm_default(await mod);
initialized = true;
diff --git a/node_modules/svg2png-wasm/dist/index.min.js b/node_modules/svg2png-wasm/dist/index.min.js
index 33e4804..dfdc886 100644
--- a/node_modules/svg2png-wasm/dist/index.min.js
+++ b/node_modules/svg2png-wasm/dist/index.min.js
@@ -1,4 +1,4 @@
/**
* @file This library uses [resvg](https://github.com/RazrFalcon/resvg), which is licensed unser MPL-2.0. The source code for resvg can be found [here](https://github.com/RazrFalcon/resvg).
*/
-"use strict";var svg2pngWasm=(()=>{var O=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var N=(e,n)=>{for(var t in n)O(e,t,{get:n[t],enumerable:!0})},V=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of q(n))!B.call(e,i)&&i!==t&&O(e,i,{get:()=>n[i],enumerable:!(r=P(n,i))||r.enumerable});return e};var H=e=>V(O({},"__esModule",{value:!0}),e);var re={};N(re,{createSvg2png:()=>D,initialize:()=>ne,svg2png:()=>te});var o,k=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&k.decode();var y=null;function g(){return(y===null||y.byteLength===0)&&(y=new Uint8Array(o.memory.buffer)),y}function T(e,n){return e=e>>>0,k.decode(g().subarray(e,e+n))}var u=new Array(128).fill(void 0);u.push(void 0,null,!0,!1);var v=u.length;function U(e){v===u.length&&u.push(u.length+1);let n=v;return v=u[n],u[n]=e,n}function z(e){return u[e]}function J(e){e<132||(u[e]=v,v=e)}function M(e){let n=z(e);return J(e),n}var l=0;function $(e,n){let t=n(e.length*1,1)>>>0;return g().set(e,t/1),l=e.length,t}var A=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},G=typeof A.encodeInto=="function"?function(e,n){return A.encodeInto(e,n)}:function(e,n){let t=A.encode(e);return n.set(t),{read:e.length,written:t.length}};function b(e,n,t){if(t===void 0){let a=A.encode(e),f=n(a.length,1)>>>0;return g().subarray(f,f+a.length).set(a),l=a.length,f}let r=e.length,i=n(r,1)>>>0,c=g(),s=0;for(;s<r;s++){let a=e.charCodeAt(s);if(a>127)break;c[i+s]=a}if(s!==r){s!==0&&(e=e.slice(s)),i=t(i,r,r=s+e.length*3,1)>>>0;let a=g().subarray(i+s,i+r),f=G(e,a);s+=f.written}return l=s,i}function _(e){return e==null}var m=null;function d(){return(m===null||m.byteLength===0)&&(m=new Int32Array(o.memory.buffer)),m}function K(e,n){return e=e>>>0,g().subarray(e/1,e/1+n)}var p=null;function Q(){return(p===null||p.byteLength===0)&&(p=new Uint32Array(o.memory.buffer)),p}function X(e,n){e=e>>>0;let r=Q().subarray(e/4,e/4+n),i=[];for(let c=0;c<r.length;c++)i.push(M(r[c]));return i}function L(e,n,t,r,i){var c=_(e)?0:b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),s=l,a=_(n)?0:b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),f=l,F=_(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),x=l,W=_(r)?0:b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),E=l,w=_(i)?0:b(i,o.__wbindgen_malloc,o.__wbindgen_realloc),C=l;let I=o.createConverter(c,s,a,f,F,x,W,E,w,C);return h.__wrap(I)}var h=class{static __wrap(n){n=n>>>0;let t=Object.create(h.prototype);return t.__wbg_ptr=n,t}__destroy_into_raw(){let n=this.__wbg_ptr;return this.__wbg_ptr=0,n}free(){let n=this.__destroy_into_raw();o.__wbg_converter_free(n)}registerFont(n){let t=$(n,o.__wbindgen_malloc),r=l;o.converter_registerFont(this.__wbg_ptr,t,r)}convert(n,t,r,i,c){try{let w=o.__wbindgen_add_to_stack_pointer(-16),C=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),I=l;var s=_(c)?0:b(c,o.__wbindgen_malloc,o.__wbindgen_realloc),a=l;o.converter_convert(w,this.__wbg_ptr,C,I,!_(t),_(t)?0:t,!_(r),_(r)?0:r,!_(i),_(i)?0:i,s,a);var f=d()[w/4+0],F=d()[w/4+1],x=d()[w/4+2],W=d()[w/4+3];if(W)throw M(x);var E=K(f,F).slice();return o.__wbindgen_free(f,F*1),E}finally{o.__wbindgen_add_to_stack_pointer(16)}}list_fonts(){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.converter_list_fonts(i,this.__wbg_ptr);var n=d()[i/4+0],t=d()[i/4+1],r=X(n,t).slice();return o.__wbindgen_free(n,t*4),r}finally{o.__wbindgen_add_to_stack_pointer(16)}}};async function Y(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function Z(){let e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(n,t){let r=T(n,t);return U(r)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){let n=new Error;return U(n)},e.wbg.__wbg_stack_658279fe44541cf6=function(n,t){let r=z(t).stack,i=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=l;d()[n/4+1]=c,d()[n/4+0]=i},e.wbg.__wbg_error_f851667af71bcfc6=function(n,t){let r,i;try{r=n,i=t,console.error(T(n,t))}finally{o.__wbindgen_free(r,i,1)}},e.wbg.__wbindgen_object_drop_ref=function(n){M(n)},e.wbg.__wbindgen_throw=function(n,t){throw new Error(T(n,t))},e}function ee(e,n){return o=e.exports,R.__wbindgen_wasm_module=n,m=null,p=null,y=null,o.__wbindgen_start(),o}async function R(e){if(o!==void 0)return o;typeof e>"u"&&(e=new URL("svg2png_wasm_bg.wasm",void 0));let n=Z();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await Y(await e,n);return ee(t,r)}var j=R;var S=!1,ne=async e=>{if(S)throw new Error("Already initialized. The `initialize` function can be used only once.");await j(await e),S=!0},D=e=>{if(!S)throw new Error("WASM has not been initialized. Call `initialize` function.");let n;n=L(e?.defaultFontFamily?.serifFamily,e?.defaultFontFamily?.sansSerifFamily,e?.defaultFontFamily?.cursiveFamily,e?.defaultFontFamily?.fantasyFamily,e?.defaultFontFamily?.monospaceFamily);for(let r of e?.fonts??[])n.registerFont(r);let t=(r,i)=>new Promise((c,s)=>{try{let a=n?.convert(r,i?.scale,i?.width,i?.height,i?.backgroundColor);if(a)c(a);else throw new Error("Converter already disposed.")}catch(a){a instanceof Error?s(a):s(new Error(`${a}`))}});return t.dispose=()=>{n?.free(),n=void 0},t.getLoadedFontFamilies=()=>n?.list_fonts()??[],t},te=(e,n)=>{let t=D(n);return t(e,n).finally(()=>t.dispose())};return H(re);})();
+"use strict";var svg2pngWasm=(()=>{var O=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var N=(e,n)=>{for(var t in n)O(e,t,{get:n[t],enumerable:!0})},V=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of q(n))!B.call(e,i)&&i!==t&&O(e,i,{get:()=>n[i],enumerable:!(r=P(n,i))||r.enumerable});return e};var H=e=>V(O({},"__esModule",{value:!0}),e);var re={};N(re,{createSvg2png:()=>D,initialize:()=>ne,svg2png:()=>te});var o,k=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&k.decode();var y=null;function g(){return(y===null||y.byteLength===0)&&(y=new Uint8Array(o.memory.buffer)),y}function T(e,n){return e=e>>>0,k.decode(g().subarray(e,e+n))}var u=new Array(128).fill(void 0);u.push(void 0,null,!0,!1);var v=u.length;function U(e){v===u.length&&u.push(u.length+1);let n=v;return v=u[n],u[n]=e,n}function z(e){return u[e]}function J(e){e<132||(u[e]=v,v=e)}function M(e){let n=z(e);return J(e),n}var l=0;function $(e,n){let t=n(e.length*1,1)>>>0;return g().set(e,t/1),l=e.length,t}var A=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},G=typeof A.encodeInto=="function"?function(e,n){return A.encodeInto(e,n)}:function(e,n){let t=A.encode(e);return n.set(t),{read:e.length,written:t.length}};function b(e,n,t){if(t===void 0){let a=A.encode(e),f=n(a.length,1)>>>0;return g().subarray(f,f+a.length).set(a),l=a.length,f}let r=e.length,i=n(r,1)>>>0,c=g(),s=0;for(;s<r;s++){let a=e.charCodeAt(s);if(a>127)break;c[i+s]=a}if(s!==r){s!==0&&(e=e.slice(s)),i=t(i,r,r=s+e.length*3,1)>>>0;let a=g().subarray(i+s,i+r),f=G(e,a);s+=f.written}return l=s,i}function _(e){return e==null}var m=null;function d(){return(m===null||m.byteLength===0)&&(m=new Int32Array(o.memory.buffer)),m}function K(e,n){return e=e>>>0,g().subarray(e/1,e/1+n)}var p=null;function Q(){return(p===null||p.byteLength===0)&&(p=new Uint32Array(o.memory.buffer)),p}function X(e,n){e=e>>>0;let r=Q().subarray(e/4,e/4+n),i=[];for(let c=0;c<r.length;c++)i.push(M(r[c]));return i}function L(e,n,t,r,i){var c=_(e)?0:b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),s=l,a=_(n)?0:b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),f=l,F=_(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),x=l,W=_(r)?0:b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),E=l,w=_(i)?0:b(i,o.__wbindgen_malloc,o.__wbindgen_realloc),C=l;let I=o.createConverter(c,s,a,f,F,x,W,E,w,C);return h.__wrap(I)}var h=class{static __wrap(n){n=n>>>0;let t=Object.create(h.prototype);return t.__wbg_ptr=n,t}__destroy_into_raw(){let n=this.__wbg_ptr;return this.__wbg_ptr=0,n}free(){let n=this.__destroy_into_raw();o.__wbg_converter_free(n)}registerFont(n){let t=$(n,o.__wbindgen_malloc),r=l;o.converter_registerFont(this.__wbg_ptr,t,r)}convert(n,t,r,i,c){try{let w=o.__wbindgen_add_to_stack_pointer(-16),C=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),I=l;var s=_(c)?0:b(c,o.__wbindgen_malloc,o.__wbindgen_realloc),a=l;o.converter_convert(w,this.__wbg_ptr,C,I,!_(t),_(t)?0:t,!_(r),_(r)?0:r,!_(i),_(i)?0:i,s,a);var f=d()[w/4+0],F=d()[w/4+1],x=d()[w/4+2],W=d()[w/4+3];if(W)throw M(x);var E=K(f,F).slice();return o.__wbindgen_free(f,F*1),E}finally{o.__wbindgen_add_to_stack_pointer(16)}}list_fonts(){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.converter_list_fonts(i,this.__wbg_ptr);var n=d()[i/4+0],t=d()[i/4+1],r=X(n,t).slice();return o.__wbindgen_free(n,t*4),r}finally{o.__wbindgen_add_to_stack_pointer(16)}}};async function Y(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function Z(){let e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(n,t){let r=T(n,t);return U(r)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){let n=new Error;return U(n)},e.wbg.__wbg_stack_658279fe44541cf6=function(n,t){let r=z(t).stack,i=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=l;d()[n/4+1]=c,d()[n/4+0]=i},e.wbg.__wbg_error_f851667af71bcfc6=function(n,t){let r,i;try{r=n,i=t,console.error(T(n,t))}finally{o.__wbindgen_free(r,i,1)}},e.wbg.__wbindgen_object_drop_ref=function(n){M(n)},e.wbg.__wbindgen_throw=function(n,t){throw new Error(T(n,t))},e}function ee(e,n){return o=e.exports,R.__wbindgen_wasm_module=n,m=null,p=null,y=null,o.__wbindgen_start(),o}async function R(e){if(o!==void 0)return o;typeof e>"u"&&(e=new URL("svg2png_wasm_bg.wasm",void 0));let n=Z();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await Y(await e,n);return ee(t,r)}var j=R;var S=!1,ne=async e=>{if(S)return;await j(await e),S=!0},D=e=>{if(!S)throw new Error("WASM has not been initialized. Call `initialize` function.");let n;n=L(e?.defaultFontFamily?.serifFamily,e?.defaultFontFamily?.sansSerifFamily,e?.defaultFontFamily?.cursiveFamily,e?.defaultFontFamily?.fantasyFamily,e?.defaultFontFamily?.monospaceFamily);for(let r of e?.fonts??[])n.registerFont(r);let t=(r,i)=>new Promise((c,s)=>{try{let a=n?.convert(r,i?.scale,i?.width,i?.height,i?.backgroundColor);if(a)c(a);else throw new Error("Converter already disposed.")}catch(a){a instanceof Error?s(a):s(new Error(`${a}`))}});return t.dispose=()=>{n?.free(),n=void 0},t.getLoadedFontFamilies=()=>n?.list_fonts()??[],t},te=(e,n)=>{let t=D(n);return t(e,n).finally(()=>t.dispose())};return H(re);})();
diff --git a/node_modules/svg2png-wasm/dist/index.mjs b/node_modules/svg2png-wasm/dist/index.mjs
index 559c25f..c04f354 100644
--- a/node_modules/svg2png-wasm/dist/index.mjs
+++ b/node_modules/svg2png-wasm/dist/index.mjs
@@ -304,9 +304,10 @@ var svg2png_wasm_default = __wbg_init;
var initialized = false;
var initialize = async (mod) => {
if (initialized) {
- throw new Error(
- "Already initialized. The `initialize` function can be used only once."
- );
+ return;
+ // throw new Error(
+ // "Already initialized. The `initialize` function can be used only once."
+ // );
}
await svg2png_wasm_default(await mod);
initialized = true;

0 comments on commit 8bfc158

Please sign in to comment.