dprint@0.1.4
code:script.js
function C(){return{dprint:{host_clear_bytes:()=>{},host_read_buffer:()=>{},host_write_buffer:()=>{},host_take_file_path:()=>{},host_take_override_config:()=>{},host_format:()=>0,host_get_formatted_text:()=>0,host_get_error_text:()=>0}}}function M(r){if(WebAssembly.instantiateStreaming==null||typeof globalThis?.Deno!=null)return c().then(o=>U(o));return WebAssembly.instantiateStreaming(r,C()).then(o=>S(o.instance));function c(){if(o(r))return r.arrayBuffer();return r.then(u=>u.arrayBuffer());function o(u){return u.arrayBuffer!=null}}}function U(r){let c=new WebAssembly.Module(r),o=new WebAssembly.Instance(c,C());return S(o)}function S(r){let c=r.exports,{get_plugin_schema_version:o,set_file_path:u,set_override_config:I,get_formatted_text:N,format:v,get_error_text:R,get_plugin_info:A,get_resolved_config:B,get_config_diagnostics:P,set_global_config:T,set_plugin_config:W,get_license_text:E,get_wasm_memory_buffer:k,get_wasm_memory_buffer_size:O,add_to_shared_bytes_from_buffer:D,set_buffer_with_shared_bytes:F,clear_shared_bytes:J,reset_config:p}=c,m=o(),h=3;if(m!==2&&m!==h)throw new Error(Not compatible plugin. Expected schema ${h}, but plugin had ${m}.);let b=O(),w=!1;return{setConfig(e,t){x(e,t)},getConfigDiagnostics(){d();let e=P();return JSON.parse(f(e))},getResolvedConfig(){d();let e=B();return JSON.parse(f(e))},getPluginInfo(){let e=A(),t=JSON.parse(f(e));return t.fileNames=t.fileNames??[],t},getLicenseText(){let e=E();return f(e)},formatText(e,t,n){if(d(),n!=null){if(m===2)throw new Error("Cannot set the override configuration for this old plugin.");l(JSON.stringify(n)),I()}l(e),u(),l(t);let s=v();switch(s){case 0:return t;case 1:return f(N());case 2:throw new Error(f(R()));default:throw new Error(Unexpected response code: ${s})}}};function d(){w||x({},{})}function x(e,t){p!=null&&p(),l(JSON.stringify(e)),T(),l(JSON.stringify(t)),W(),w=!0}function l(e){let n=new TextEncoder().encode(e),s=n.length;J(s);let i=0;for(;i<s;){let a=Math.min(s-i,b),g=y(a);for(let _=0;_<a;_++)g_=ni+_;D(a),i+=a}}function f(e){let t=new Uint8Array(e),n=0;for(;n<e;){let i=Math.min(e-n,b);F(n,i);let a=y(i);for(let g=0;g<i;g++)tn+g=ag;n+=i}return new TextDecoder().decode(t)}function y(e){let t=k();return new Uint8Array(r.exports.memory.buffer,t,e)}}export{U as createFromBuffer,S as createFromInstance,C as createImportObject,M as createStreaming};