texlite 0.7.2 → 0.7.5

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.
Files changed (26) hide show
  1. package/README.md +1 -6
  2. package/README.zh-CN.md +1 -6
  3. package/dist/client/assets/{BinaryModule-Aj1vLnwf-wAe5fMVe.js → BinaryModule-Aj1vLnwf-CKY6Y_Pt.js} +1 -1
  4. package/dist/client/assets/{GitDialog-b7cWzpdJ.js → GitDialog-pn8n5Afm.js} +1 -1
  5. package/dist/client/assets/{HistoryDialog-F8tDuD3v.js → HistoryDialog-BpWEZrYf.js} +1 -1
  6. package/dist/client/assets/{LatexEditor-BT2E5IIK.js → LatexEditor-DNAmNvHu.js} +1 -1
  7. package/dist/client/assets/{PdfPreview-C2tw6xhu.js → PdfPreview-BVaG7TtG.js} +1 -1
  8. package/dist/client/assets/{ProjectNavigationDialogs-CzrF5eh5.js → ProjectNavigationDialogs-CaovMu4V.js} +1 -1
  9. package/dist/client/assets/{SystemMetricsDialog-OAoXCVVy.js → SystemMetricsDialog-D8jj7epG.js} +1 -1
  10. package/dist/client/assets/binary-BoldOm0z.js +1 -0
  11. package/dist/client/assets/index-BQCB3z5H.js +64 -0
  12. package/dist/client/assets/index-BnvpaWsa.css +1 -0
  13. package/dist/client/assets/{index-JmuE6_j5.js → index-Byn2Miy9.js} +1 -1
  14. package/dist/client/assets/{minus-D0DZYQR6.js → minus-K-5IK4nL.js} +1 -1
  15. package/dist/client/assets/pdf-BB1XvBIF.js +55 -0
  16. package/dist/client/assets/{spellCheck-TTrb0uqA.js → spellCheck-C32VQVUE.js} +3 -3
  17. package/dist/client/assets/texFmtRuntime-EYyQNUnJ.js +2 -0
  18. package/dist/client/assets/tex_fmt_bg-VEAUIuFz.wasm +0 -0
  19. package/dist/client/index.html +2 -2
  20. package/dist/server/app.js +0 -40
  21. package/package.json +3 -1
  22. package/dist/client/assets/binary-CWru8eff.js +0 -1
  23. package/dist/client/assets/index-BLOqf18q.js +0 -62
  24. package/dist/client/assets/index-CwGialPz.css +0 -1
  25. package/dist/client/assets/pdf-DPnwNQHb.js +0 -55
  26. package/dist/server/latexFormatter.js +0 -118
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-JmuE6_j5.js","assets/BinaryModule-Aj1vLnwf-wAe5fMVe.js","assets/index-BLOqf18q.js","assets/react-CsO_xvbl.js","assets/index-CwGialPz.css","assets/binary-CWru8eff.js"])))=>i.map(i=>d[i]);
2
- import{_ as w}from"./index-BLOqf18q.js";import"./react-CsO_xvbl.js";const k=/([A-Za-z][A-Za-z0-9_.:/-]*(?:\s+[A-Za-z][A-Za-z0-9_.:/-]*){0,7})\s*$/,S=new Set(["tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"]),A=new Set(["math","displaymath","equation","equation*","align","align*","alignat","alignat*","gather","gather*","multline","multline*","flalign","flalign*","tikzpicture","axis","scope","pgfonlayer","pgfpicture","tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","verbatim","Verbatim","lstlisting","minted","comment","algorithmic","alignat"]),b=new Set(["documentclass","usepackage","RequirePackage","includegraphics","tikzset","pgfplotsset","hypersetup","lstset","definecolor","colorlet","setlength","setcounter","draw","path","fill","filldraw","shade","node","addplot","color","textcolor","colorbox","pagecolor"]),L=new Set(["label","hypertarget","ref","pageref","autoref","nameref","hyperref","index","gls","Gls","glspl","Glspl","cite","citep","citet","citeauthor","citeyear","citenum","parencite","textcite","autocite","footcite"]),z=5;let d=null,_=Promise.resolve(),x="";function c(t,i,n){n>i&&t.push({from:i,to:n})}function p(t,i,n,a){if(t[i]!==n)return null;let e=0;for(let r=i;r<t.length;r+=1){const l=t[r-1]==="\\"&&t[r-2]!=="\\";if(!l&&t[r]===n&&(e+=1),!l&&t[r]===a&&(e-=1,e===0))return{from:i,to:r+1,end:r+1}}return null}function u(t,i){let n=i;for(;n<t.length&&/[ \t\r\n]/.test(t[n]);)n+=1;return n}function E(t,i){if(t[i]!=="%")return!1;let n=0;for(let a=i-1;a>=0&&t[a]==="\\";a-=1)n+=1;return n%2===0}function P(t){return/[=,!/]/.test(t)||/\b(?:colorbar|legend|width|height|draw|fill|style|domain|samples|anchor|at|axis)\b/.test(t)}function O(t){return L.has(t)||/^cite[A-Za-z]*/.test(t)}function Z(t,i){for(let n=t.indexOf("=");n>=0;n=t.indexOf("=",n+1)){const e=Math.max(...[`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Byn2Miy9.js","assets/BinaryModule-Aj1vLnwf-CKY6Y_Pt.js","assets/index-BQCB3z5H.js","assets/react-CsO_xvbl.js","assets/index-BnvpaWsa.css","assets/binary-BoldOm0z.js"])))=>i.map(i=>d[i]);
2
+ import{_ as w}from"./index-BQCB3z5H.js";import"./react-CsO_xvbl.js";const k=/([A-Za-z][A-Za-z0-9_.:/-]*(?:\s+[A-Za-z][A-Za-z0-9_.:/-]*){0,7})\s*$/,S=new Set(["tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"]),A=new Set(["math","displaymath","equation","equation*","align","align*","alignat","alignat*","gather","gather*","multline","multline*","flalign","flalign*","tikzpicture","axis","scope","pgfonlayer","pgfpicture","tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","verbatim","Verbatim","lstlisting","minted","comment","algorithmic","alignat"]),b=new Set(["documentclass","usepackage","RequirePackage","includegraphics","tikzset","pgfplotsset","hypersetup","lstset","definecolor","colorlet","setlength","setcounter","draw","path","fill","filldraw","shade","node","addplot","color","textcolor","colorbox","pagecolor"]),L=new Set(["label","hypertarget","ref","pageref","autoref","nameref","hyperref","index","gls","Gls","glspl","Glspl","cite","citep","citet","citeauthor","citeyear","citenum","parencite","textcite","autocite","footcite"]),z=5;let d=null,_=Promise.resolve(),x="";function c(t,i,n){n>i&&t.push({from:i,to:n})}function p(t,i,n,a){if(t[i]!==n)return null;let e=0;for(let r=i;r<t.length;r+=1){const l=t[r-1]==="\\"&&t[r-2]!=="\\";if(!l&&t[r]===n&&(e+=1),!l&&t[r]===a&&(e-=1,e===0))return{from:i,to:r+1,end:r+1}}return null}function u(t,i){let n=i;for(;n<t.length&&/[ \t\r\n]/.test(t[n]);)n+=1;return n}function E(t,i){if(t[i]!=="%")return!1;let n=0;for(let a=i-1;a>=0&&t[a]==="\\";a-=1)n+=1;return n%2===0}function P(t){return/[=,!/]/.test(t)||/\b(?:colorbar|legend|width|height|draw|fill|style|domain|samples|anchor|at|axis)\b/.test(t)}function O(t){return L.has(t)||/^cite[A-Za-z]*/.test(t)}function Z(t,i){for(let n=t.indexOf("=");n>=0;n=t.indexOf("=",n+1)){const e=Math.max(...[`
3
3
  `,"[","{","]","}",",",";"].map(o=>t.lastIndexOf(o,n-1)+1)),l=t.slice(e,n).match(k);l?.index!==void 0&&c(i,e+l.index,n);let f=n+1;for(;f<t.length&&/\s/.test(t[f]);)f+=1;let s=f;if(t[f]==="{")s=p(t,f,"{","}")?.end??f;else for(;s<t.length&&!/[,\]\}\n]/.test(t[s]);)s+=1;c(i,f,s)}}function I(t,i,n){const a=/\\(begin|end)\s*\{\s*([^{}]+?)\s*\}/g;a.lastIndex=i;let e=1;for(let r=a.exec(t);r;r=a.exec(t))if(r[2].trim()===n){if(r[1]==="begin")e+=1;else if(--e===0)return a.lastIndex}return null}function R(t,i){for(const n of t.matchAll(/\\\((?:\\.|[^])*?\\\)|\\\[(?:\\.|[^])*?\\\]/g))n.index!==void 0&&c(i,n.index,n.index+n[0].length);for(let n=0;n<t.length;n+=1){if(t[n]!=="$"||t[n-1]==="\\")continue;const a=t[n+1]==="$"?"$$":"$",e=t.indexOf(a,n+a.length);e>=0&&(c(i,n,e+a.length),n=e+a.length-1)}}function $(t){const i=[],n=/[A-Za-z@]/;for(let e=0;e<t.length;e+=1){if(E(t,e)){const o=t.indexOf(`
4
4
  `,e);c(i,e,o<0?t.length:o),e=o<0?t.length:o;continue}if(t[e]!=="\\")continue;const r=e;let l=e+1;if(n.test(t[l]??""))for(;l<t.length&&/[A-Za-z@0-9:_]/.test(t[l]);)l+=1;else l<t.length&&(l+=1);const f=t.slice(e+1,l);c(i,r,l);let s=u(t,l);if(f==="begin"||f==="end"){const o=p(t,s,"{","}");if(o){c(i,o.from,o.to);const h=t.slice(o.from+1,o.to-1).trim();if(s=u(t,o.end),f==="begin"){const g=p(t,s,"[","]");if(g&&(c(i,g.from,g.to),s=u(t,g.end)),S.has(h)){const m=p(t,s,"{","}");m&&c(i,m.from,m.to)}if(A.has(h)){const m=I(t,o.end,h);if(m!==null){c(i,r,m),e=m-1;continue}}}}e=l-1;continue}if(O(f))for(t[s]==="*"&&(s=u(t,s+1));;){const o=p(t,s,"[","]")??p(t,s,"{","}");if(!o)break;c(i,o.from,o.to),s=u(t,o.end)}else{const o=p(t,s,"[","]");if(o&&(b.has(f)||P(t.slice(o.from+1,o.to-1)))&&(c(i,o.from,o.to),s=u(t,o.end)),b.has(f)){const h=f==="definecolor"||f==="colorlet"?3:1;for(let g=0;g<h;g+=1){const m=p(t,s,"{","}");if(!m)break;c(i,m.from,m.to),s=u(t,m.end)}}}e=l-1}R(t,i),Z(t,i);for(const e of t.matchAll(/(?:https?|ftp):\/\/[^\s]+/gi))e.index!==void 0&&c(i,e.index,e.index+e[0].length);i.sort((e,r)=>e.from-r.from||e.to-r.to);const a=[];for(const e of i){const r=a.at(-1);r&&e.from<=r.to?r.to=Math.max(r.to,e.to):a.push({...e})}return a}function T(t){const i=$(t),n=[];let a=0,e=0;for(const r of t){for(;e<i.length&&i[e].to<=a;)e+=1;const l=i[e];n.push(l&&l.from<=a&&a<l.to&&r!==`
5
- `&&r!=="\r"?" ":r),a+=r.length}return n.join("")}function V(t){const i=[0];let n=0;for(const a of t)n+=a.length,i.push(n);return i}function B(t){return[...new Set(t.map(i=>i.trim()).filter(Boolean))].sort((i,n)=>i.localeCompare(n)).join("\0")}async function C(t,i){const n=_.then(async()=>{if(!d)try{const[{WorkerLinter:e,LocalLinter:r},{binary:l}]=await Promise.all([w(()=>import("./index-JmuE6_j5.js"),__vite__mapDeps([0,1,2,3,4])),w(()=>import("./binary-CWru8eff.js"),__vite__mapDeps([5,1,2,3,4]))]),f=typeof Worker<"u";try{d=new(f?e:r)({binary:l}),await d.setup()}catch(s){const o=d;if(d=null,await o?.dispose().catch(()=>{}),!f)throw s;d=new r({binary:l}),await d.setup()}}catch(e){throw d=null,x="",e}const a=B(t);return a!==x&&(await d.clearWords(),t.length&&await d.importWords([...new Set(t.map(e=>e.trim()).filter(Boolean))]),x=a),i(d)});return _=n.then(()=>{},()=>{}),n}function q(t){return t.get_replacement_text()}function W(t,i,n,a,e){const r={from:a.start,to:a.end},l={from:e[a.start]??-1,to:e[a.end]??-1},f=[r,l].filter((o,h,g)=>o.from>=0&&o.to>o.from&&o.to<=t.length&&g.findIndex(m=>m.from===o.from&&m.to===o.to)===h);if(f.length===0)return null;const s=n.get_problem_text();return f.find(o=>i.slice(o.from,o.to)===s)??f.find(o=>/[A-Za-z]/.test(i.slice(o.from,o.to)))??f[0]??null}function D(t,i,n,a){const e=n.span();try{const r=W(t,i,n,e,a);if(!r)return null;const{from:l,to:f}=r;if(!/[A-Za-z]/.test(i.slice(l,f)))return null;const s=t.slice(l,f);if(!s.trim()||/[\\%$]/.test(s))return null;const o=n.lint_kind()==="Spelling"||n.lint_kind()==="Typo"?"spelling":"grammar",h=n.suggestions(),g=h.map(q).filter((m,y,v)=>y<z&&v.indexOf(m)===y);for(const m of h)m.free();return{from:l,to:f,word:s,kind:o,message:n.message(),suggestions:g}}finally{e.free()}}function G(t,i=[]){const n=T(t),a=V(t);return C(i,async e=>{const r=await e.lint(n,{language:"plaintext",dedup:!0,isolateEnglish:!1});try{return r.map(l=>D(t,n,l,a)).filter(l=>!!l).sort((l,f)=>l.from-f.from||l.to-f.to)}finally{for(const l of r)l.free()}})}export{$ as ignoredRanges,G as lintLatex,T as maskLatexSource};
5
+ `&&r!=="\r"?" ":r),a+=r.length}return n.join("")}function V(t){const i=[0];let n=0;for(const a of t)n+=a.length,i.push(n);return i}function B(t){return[...new Set(t.map(i=>i.trim()).filter(Boolean))].sort((i,n)=>i.localeCompare(n)).join("\0")}async function C(t,i){const n=_.then(async()=>{if(!d)try{const[{WorkerLinter:e,LocalLinter:r},{binary:l}]=await Promise.all([w(()=>import("./index-Byn2Miy9.js"),__vite__mapDeps([0,1,2,3,4])),w(()=>import("./binary-BoldOm0z.js"),__vite__mapDeps([5,1,2,3,4]))]),f=typeof Worker<"u";try{d=new(f?e:r)({binary:l}),await d.setup()}catch(s){const o=d;if(d=null,await o?.dispose().catch(()=>{}),!f)throw s;d=new r({binary:l}),await d.setup()}}catch(e){throw d=null,x="",e}const a=B(t);return a!==x&&(await d.clearWords(),t.length&&await d.importWords([...new Set(t.map(e=>e.trim()).filter(Boolean))]),x=a),i(d)});return _=n.then(()=>{},()=>{}),n}function q(t){return t.get_replacement_text()}function W(t,i,n,a,e){const r={from:a.start,to:a.end},l={from:e[a.start]??-1,to:e[a.end]??-1},f=[r,l].filter((o,h,g)=>o.from>=0&&o.to>o.from&&o.to<=t.length&&g.findIndex(m=>m.from===o.from&&m.to===o.to)===h);if(f.length===0)return null;const s=n.get_problem_text();return f.find(o=>i.slice(o.from,o.to)===s)??f.find(o=>/[A-Za-z]/.test(i.slice(o.from,o.to)))??f[0]??null}function D(t,i,n,a){const e=n.span();try{const r=W(t,i,n,e,a);if(!r)return null;const{from:l,to:f}=r;if(!/[A-Za-z]/.test(i.slice(l,f)))return null;const s=t.slice(l,f);if(!s.trim()||/[\\%$]/.test(s))return null;const o=n.lint_kind()==="Spelling"||n.lint_kind()==="Typo"?"spelling":"grammar",h=n.suggestions(),g=h.map(q).filter((m,y,v)=>y<z&&v.indexOf(m)===y);for(const m of h)m.free();return{from:l,to:f,word:s,kind:o,message:n.message(),suggestions:g}}finally{e.free()}}function G(t,i=[]){const n=T(t),a=V(t);return C(i,async e=>{const r=await e.lint(n,{language:"plaintext",dedup:!0,isolateEnglish:!1});try{return r.map(l=>D(t,n,l,a)).filter(l=>!!l).sort((l,f)=>l.from-f.from||l.to-f.to)}finally{for(const l of r)l.free()}})}export{$ as ignoredRanges,G as lintLatex,T as maskLatexSource};
@@ -0,0 +1,2 @@
1
+ const T="/assets/tex_fmt_bg-VEAUIuFz.wasm",O=async(e={},t)=>{let _;if(t.startsWith("data:")){const r=t.replace(/^data:.*?base64,/,"");let n;if(typeof Buffer=="function"&&typeof Buffer.from=="function")n=Buffer.from(r,"base64");else if(typeof atob=="function"){const i=atob(r);n=new Uint8Array(i.length);for(let o=0;o<i.length;o++)n[o]=i.charCodeAt(o)}else throw new Error("Cannot decode base64-encoded data URL");_=await WebAssembly.instantiate(n,e)}else{const r=await fetch(t),n=r.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&n.startsWith("application/wasm"))_=await WebAssembly.instantiateStreaming(r,e);else{const i=await r.arrayBuffer();_=await WebAssembly.instantiate(i,e)}}return _.instance.exports};function v(e,t){const _=p(e,c.__wbindgen_malloc,c.__wbindgen_realloc),r=d,n=p(t,c.__wbindgen_malloc,c.__wbindgen_realloc),i=d;return c.main(_,r,n,i)}function L(e,t){const _=h(t),r=p(_,c.__wbindgen_malloc,c.__wbindgen_realloc),n=d;x().setInt32(e+4,n,!0),x().setInt32(e+0,r,!0)}function E(e){return e===void 0}function W(e,t){throw new Error(A(e,t))}function B(){return new Object}function I(e){return e.now()}function M(e){return e.performance}function D(){return R(function(e,t,_){return Reflect.set(e,t,_)},arguments)}function U(){const e=typeof global>"u"?null:global;return m(e)?0:u(e)}function $(){const e=typeof globalThis>"u"?null:globalThis;return m(e)?0:u(e)}function j(){const e=typeof self>"u"?null:self;return m(e)?0:u(e)}function F(){const e=typeof window>"u"?null:window;return m(e)?0:u(e)}function C(e,t){return A(e,t)}function N(){const e=c.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}function u(e){const t=c.__externref_table_alloc();return c.__wbindgen_externrefs.set(t,e),t}function h(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const n=e.description;return n==null?"Symbol":`Symbol(${n})`}if(t=="function"){const n=e.name;return typeof n=="string"&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){const n=e.length;let i="[";n>0&&(i+=h(e[0]));for(let o=1;o<n;o++)i+=", "+h(e[o]);return i+="]",i}const _=/\[object ([^\]]+)\]/.exec(toString.call(e));let r;if(_&&_.length>1)r=_[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}let f=null;function x(){return(f===null||f.buffer.detached===!0||f.buffer.detached===void 0&&f.buffer!==c.memory.buffer)&&(f=new DataView(c.memory.buffer)),f}function A(e,t){return e=e>>>0,G(e,t)}let l=null;function w(){return(l===null||l.byteLength===0)&&(l=new Uint8Array(c.memory.buffer)),l}function R(e,t){try{return e.apply(this,t)}catch(_){const r=u(_);c.__wbindgen_exn_store(r)}}function m(e){return e==null}function p(e,t,_){if(_===void 0){const s=b.encode(e),a=t(s.length,1)>>>0;return w().subarray(a,a+s.length).set(s),d=s.length,a}let r=e.length,n=t(r,1)>>>0;const i=w();let o=0;for(;o<r;o++){const s=e.charCodeAt(o);if(s>127)break;i[n+o]=s}if(o!==r){o!==0&&(e=e.slice(o)),n=_(n,r,r=o+e.length*3,1)>>>0;const s=w().subarray(n+o,n+r),a=b.encodeInto(e,s);o+=a.written,n=_(n,r,o,1)>>>0}return d=o,n}let g=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});g.decode();const V=2146435072;let y=0;function G(e,t){return y+=t,y>=V&&(g=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),g.decode(),y=t),g.decode(w().subarray(e,e+t))}const b=new TextEncoder;"encodeInto"in b||(b.encodeInto=function(e,t){const _=b.encode(e);return t.set(_),{read:e.length,written:_.length}});let d=0,c;function k(e){c=e}URL=globalThis.URL;const z=await O({"./tex_fmt_bg.js":{__wbg_performance_3fcf6e32a7e1ed0a:M,__wbg_now_e7c6795a7f81e10f:I,__wbg_new_ab79df5bd7c26067:B,__wbg_set_7eaa4f96924fd6b3:D,__wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913:$,__wbg_static_accessor_SELF_f207c857566db248:j,__wbg_static_accessor_GLOBAL_8adb955bd33fac2f:U,__wbg_static_accessor_WINDOW_bb9f1ba69d61b386:F,__wbg___wbindgen_throw_6ddd609b62940d55:W,__wbg___wbindgen_is_undefined_52709e72fb9f179c:E,__wbg___wbindgen_debug_string_5398f5bb970e0daa:L,__wbindgen_init_externref_table:N,__wbindgen_cast_0000000000000001:C}},T),{memory:H,main:J,__wbindgen_malloc:P,__wbindgen_realloc:X,__wbindgen_exn_store:Y,__externref_table_alloc:q,__wbindgen_externrefs:K,__wbindgen_start:Q}=z,Z=Object.freeze(Object.defineProperty({__proto__:null,__externref_table_alloc:q,__wbindgen_exn_store:Y,__wbindgen_externrefs:K,__wbindgen_malloc:P,__wbindgen_realloc:X,__wbindgen_start:Q,main:J,memory:H},Symbol.toStringTag,{value:"Module"})),S=Z;k(S);S.__wbindgen_start();export{v as main};
@@ -10,9 +10,9 @@
10
10
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.2.5/400.css" />
11
11
  <link rel="icon" type="image/svg+xml" href="/logo.svg" />
12
12
  <title>TexLite</title>
13
- <script type="module" crossorigin src="/assets/index-BLOqf18q.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-BQCB3z5H.js"></script>
14
14
  <link rel="modulepreload" crossorigin href="/assets/react-CsO_xvbl.js">
15
- <link rel="stylesheet" crossorigin href="/assets/index-CwGialPz.css">
15
+ <link rel="stylesheet" crossorigin href="/assets/index-BnvpaWsa.css">
16
16
  </head>
17
17
  <body>
18
18
  <div id="root"></div>
@@ -23,7 +23,6 @@ import { ProjectMutationCoordinator } from "./projectMutations.js";
23
23
  import { ProjectGitService } from "./git.js";
24
24
  import { LatexCompletionService } from "./latexCompletion.js";
25
25
  import { ProjectHistoryService } from "./history.js";
26
- import { LatexFormatterService } from "./latexFormatter.js";
27
26
  import { ProjectOutlineService } from "./projectOutline.js";
28
27
  import { replaceProject, searchProject } from "./projectSearch.js";
29
28
  import { MetricRegistry } from "./metrics.js";
@@ -368,7 +367,6 @@ export async function buildApp(config, db, options = {}) {
368
367
  const history = new ProjectHistoryService(config, db);
369
368
  const latexCompletions = new LatexCompletionService(config);
370
369
  const projectOutlines = new ProjectOutlineService(config);
371
- const latexFormatter = new LatexFormatterService();
372
370
  const recordHistory = (projectId, userId, reason, paths) => {
373
371
  try {
374
372
  return history.record(projectId, userId, reason, paths);
@@ -1668,44 +1666,6 @@ export async function buildApp(config, db, options = {}) {
1668
1666
  }
1669
1667
  });
1670
1668
  });
1671
- app.post("/api/projects/:id/format", async (request, reply) => {
1672
- const user = requireUser(request, reply, db);
1673
- if (!user)
1674
- return;
1675
- const { id } = request.params;
1676
- const project = accessibleProject(db, id, user);
1677
- if (!project)
1678
- return apiError(reply, 404, "PROJECT_NOT_FOUND", "项目不存在");
1679
- if (!canEdit(project))
1680
- return apiError(reply, 403, "PROJECT_EDIT_FORBIDDEN", "没有编辑权限");
1681
- const body = request.body;
1682
- const filePath = safeRelativePath(typeof body?.path === "string" ? body.path : "");
1683
- if (!/\.(?:tex|cls|sty)$/i.test(filePath)) {
1684
- return apiError(reply, 400, "FORMAT_FILE_UNSUPPORTED", "只有 .tex、.cls 和 .sty 文件支持宿主机格式化", { path: filePath });
1685
- }
1686
- if (typeof body?.source !== "string")
1687
- return apiError(reply, 400, "FORMAT_SOURCE_INVALID", "待格式化内容格式不正确");
1688
- const source = body.source;
1689
- if (Buffer.byteLength(source, "utf8") > config.maxUploadBytes) {
1690
- return apiError(reply, 413, "FILE_TOO_LARGE", `单个文件不能超过 ${Math.floor(config.maxUploadBytes / 1024 / 1024)} MB`, { path: filePath });
1691
- }
1692
- try {
1693
- return await projectMutations.runConsistentRead(id, () => {
1694
- assertNoSourceSymlinks(config, id);
1695
- return latexFormatter.format(source, sourceRoot(config, id));
1696
- }, {
1697
- preflight: () => { requireEditableProject(db, id, user); }
1698
- });
1699
- }
1700
- catch (formatError) {
1701
- const statusCode = typeof formatError === "object" && formatError !== null && "statusCode" in formatError && typeof formatError.statusCode === "number"
1702
- ? formatError.statusCode : 422;
1703
- const code = typeof formatError === "object" && formatError !== null && "code" in formatError && typeof formatError.code === "string"
1704
- ? formatError.code : "FORMAT_FAILED";
1705
- const message = formatError instanceof Error ? formatError.message : "LaTeX formatting failed";
1706
- return apiError(reply, statusCode, code, message);
1707
- }
1708
- });
1709
1669
  app.get("/api/projects/:id/outline", async (request, reply) => {
1710
1670
  const user = requireUser(request, reply, db);
1711
1671
  if (!user)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "texlite",
3
- "version": "0.7.2",
3
+ "version": "0.7.5",
4
4
  "description": "A lightweight local-first collaborative LaTeX workspace",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -83,6 +83,7 @@
83
83
  "react-dom": "^19.1.1",
84
84
  "react-i18next": "^15.6.1",
85
85
  "react-resizable-panels": "^2.1.9",
86
+ "tex-fmt": "^0.5.7",
86
87
  "ws": "^8.21.1",
87
88
  "y-codemirror.next": "^0.3.5",
88
89
  "y-indexeddb": "^9.0.12",
@@ -105,6 +106,7 @@
105
106
  "tsx": "^4.20.3",
106
107
  "typescript": "^5.8.3",
107
108
  "vite": "^7.0.6",
109
+ "vite-plugin-wasm": "^3.6.0",
108
110
  "vitest": "^3.2.4"
109
111
  }
110
112
  }
@@ -1 +0,0 @@
1
- import{B as r}from"./BinaryModule-Aj1vLnwf-wAe5fMVe.js";import"./index-BLOqf18q.js";import"./react-CsO_xvbl.js";const a=""+new URL("/assets/harper_wasm_bg-LWXDb7Ll.wasm",import.meta.url).href,o=r.create(a,"full");export{o as binary};