A simple integration of TeXLive in Node.js that works in the server and (someday) in the client.
I came to use someone else's package, but they were all either too old or made assumptions I didn't care for, so I'm writing this for the simple use case of: You've installed TexLive on a unix system and want to script it from node. Easy.
Currently only works on Unix + Server, but Windows support is trivial and browser support will come eventually. It supports variable targets (latex, tex, xelatex, etc. ) and delivers rendered data using a virtual file abstraction.
import { TexLive } from '@environment-safe/texlive-api';
const pdfFile = await TexLive.compile(`
\\documentclass{article}
\\begin{document}
Hello Foo!
\\end{document}
`);
// compile file
const pdfFile = await TexLive.compileFile('/some/dir/myfile.tex');
const pdfFile = await TexLive.compileInPlace('/some/dir/myfile.tex');The returned file is an instance of @environment-safe/file which can be used directly or saved to a new location.
Run the es module tests to test the root modules
npm run import-testto run the same test inside the browser:
npm run browser-testto run the same test headless in chrome:
npm run headless-browser-testto run the same test inside docker:
npm run container-testRun the commonjs tests against the /dist commonjs source (generated with the build-commonjs target).
npm run require-testAll work is done in the .mjs files and will be transpiled on commit to commonjs and tested.
If the above tests pass, then attempt a commit which will generate .d.ts files alongside the src files and commonjs classes in dist