@danielsimonjr/sciengjs 0.9.0 → 0.10.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/README.md +3 -2
- package/THIRD_PARTY_NOTICES.md +65 -4
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -1
- package/dist/registry.js +3 -0
- package/dist/registry.js.map +1 -1
- package/dist/tex/backend-pdf.d.ts +3 -0
- package/dist/tex/backend-pdf.js +10 -0
- package/dist/tex/backend-pdf.js.map +1 -0
- package/dist/tex/backend-png.d.ts +6 -0
- package/dist/tex/backend-png.js +19 -0
- package/dist/tex/backend-png.js.map +1 -0
- package/dist/tex/backend-svg.d.ts +3 -0
- package/dist/tex/backend-svg.js +8 -0
- package/dist/tex/backend-svg.js.map +1 -0
- package/dist/tex/bundles.d.ts +43 -0
- package/dist/tex/bundles.js +150 -0
- package/dist/tex/bundles.js.map +1 -0
- package/dist/tex/bundles.json +26 -0
- package/dist/tex/detect.d.ts +27 -0
- package/dist/tex/detect.js +212 -0
- package/dist/tex/detect.js.map +1 -0
- package/dist/tex/dvi.d.ts +44 -0
- package/dist/tex/dvi.js +280 -0
- package/dist/tex/dvi.js.map +1 -0
- package/dist/tex/host.d.ts +82 -0
- package/dist/tex/host.js +313 -0
- package/dist/tex/host.js.map +1 -0
- package/dist/tex/index.d.ts +16 -0
- package/dist/tex/index.js +17 -0
- package/dist/tex/index.js.map +1 -0
- package/dist/tex/render.d.ts +66 -0
- package/dist/tex/render.js +72 -0
- package/dist/tex/render.js.map +1 -0
- package/dist/tex/run.d.ts +51 -0
- package/dist/tex/run.js +54 -0
- package/dist/tex/run.js.map +1 -0
- package/dist/tex/specials.d.ts +32 -0
- package/dist/tex/specials.js +145 -0
- package/dist/tex/specials.js.map +1 -0
- package/dist/tex/stage.d.ts +15 -0
- package/dist/tex/stage.js +93 -0
- package/dist/tex/stage.js.map +1 -0
- package/dist/tex/tfm.d.ts +15 -0
- package/dist/tex/tfm.js +33 -0
- package/dist/tex/tfm.js.map +1 -0
- package/dist/tex/type1.d.ts +32 -0
- package/dist/tex/type1.js +402 -0
- package/dist/tex/type1.js.map +1 -0
- package/dist/tex/vfs.d.ts +37 -0
- package/dist/tex/vfs.js +80 -0
- package/dist/tex/vfs.js.map +1 -0
- package/dist/tex/wasm.d.ts +16 -0
- package/dist/tex/wasm.js +8 -0
- package/dist/tex/wasm.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/worker/protocol.d.ts +4 -0
- package/package.json +110 -106
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ sciengjs turns diagram source into images on your own machine. It sends no sourc
|
|
|
10
10
|
|
|
11
11
|
## What this release does
|
|
12
12
|
|
|
13
|
-
Release 0.9.0 holds ten input types. They are **Graphviz DOT**, **Mermaid** (every diagram type) and **LaTeX math** (to SVG, PNG and PDF). They also include **Plotly plots** (to SVG, PNG and HTML) and **HTML** (to PNG, PDF and Markdown). The CAD files **STEP**, **IGES** and **BREP** go to GLB, to a viewer page in HTML, and to PNG. A **CAD document** (a CSG model in JSON) goes to GLB, STL, HTML and PNG. A **SysML v2** source in a textual subset goes to SVG, PNG and PDF. The browser stage draws the Mermaid types other than class, state and sequence, and every PDF.
|
|
13
|
+
Release 0.9.0 holds ten input types. They are **Graphviz DOT**, **Mermaid** (every diagram type) and **LaTeX math** (to SVG, PNG and PDF). They also include **Plotly plots** (to SVG, PNG and HTML) and **HTML** (to PNG, PDF and Markdown). The CAD files **STEP**, **IGES** and **BREP** go to GLB, to a viewer page in HTML, and to PNG. A **CAD document** (a CSG model in JSON) goes to GLB, STL, HTML and PNG. A **SysML v2** source in a textual subset goes to SVG, PNG and PDF. A **TikZ** picture goes to SVG, PNG and PDF through the tex stage. The `tikz` input type includes circuitikz, tikz-cd and chemfig. The first render downloads the TeX bundles. The browser stage draws the Mermaid types other than class, state and sequence, and every PDF.
|
|
14
14
|
|
|
15
15
|
| Input | Output | Engine |
|
|
16
16
|
|---|---|---|
|
|
@@ -24,6 +24,7 @@ Release 0.9.0 holds ten input types. They are **Graphviz DOT**, **Mermaid** (eve
|
|
|
24
24
|
| STEP, IGES, BREP | GLB, HTML, PNG | OpenCascade, compiled to WASM (`occt-import-js`); a Three.js viewer page |
|
|
25
25
|
| CAD document | GLB, STL, HTML, PNG | The engine's own reader; the solid operations through `manifold-3d` (WASM) |
|
|
26
26
|
| SysML v2 (a textual subset) | SVG, PNG, PDF | The engine's own parser and views, then Graphviz; PDF through the browser stage |
|
|
27
|
+
| TikZ picture, circuitikz, tikz-cd, chemfig, mhchem, bussproofs, AMS math | SVG, PNG, PDF | An own WASM build of `tex.web` with `etex.ch`; the bundles download on first use (`SCIENG_TEX_BUNDLE_URL`, `SCIENG_CACHE_DIR`) and each has a pinned sha256; PNG through resvg; PDF through the browser stage |
|
|
27
28
|
|
|
28
29
|
- **No network.** The DOT and Mermaid paths make no network request. The browser stage starts Chrome or Chromium from `SCIENG_BROWSER` with a new profile. Its flags stop every connection out of the host. The client refuses every request except the page and the pinned Mermaid build. CI checks the browser process tree on Linux, macOS and Windows.
|
|
29
30
|
- **Unsafe attributes are removed.** The engine removes each `image` and `stylesheet` attribute before the layout and gives a warning for each one. A DOT file cannot make the engine or a browser fetch a file or a URL. A `URL` attribute stays as a link in the SVG.
|
|
@@ -336,7 +337,7 @@ The [build plan](docs/superpowers/plans/2026-11-01-scieng-engine-build.md) gives
|
|
|
336
337
|
| DOT | graph, raster | released in 0.1.0 |
|
|
337
338
|
| Mermaid | graph, mermaid, browser | class, state and sequence: released in 0.2.0; other types: released in 0.3.0 |
|
|
338
339
|
| LaTeX math | math (MathJax) | svg, png and pdf are built; pdf needs the browser stage |
|
|
339
|
-
| TikZ, circuitikz, LaTeX | tex (an own WASM build of `tex.web`) |
|
|
340
|
+
| TikZ, circuitikz, LaTeX | tex (an own WASM build of `tex.web`) | tikz svg, png and pdf are built (unreleased); the bundles come from `texBundleUrl` |
|
|
340
341
|
| Plots | plot | svg, png and html: released in 0.5.0; pdf is not planned |
|
|
341
342
|
| SysML v2 | sysml, graph | svg, png and pdf: released in 0.9.0 |
|
|
342
343
|
| STEP, IGES, BREP | mesh (OpenCascade WASM) | glb, html and png: released in 0.7.0 |
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -12,8 +12,8 @@ Version: each row gives the version that the engine pins.
|
|
|
12
12
|
|---|---|---|---|
|
|
13
13
|
| graph | `@viz-js/viz` 3.31.0 (Graphviz 16.1.0 compiled to WASM) | Wrapper: MIT. Graphviz: EPL-2.0 | a dependency |
|
|
14
14
|
| math | `@mathjax/src` 4.1.3 (MathJax, with the Newcm math font and the packages it installs; see "MathJax") | Apache-2.0 for MathJax and the math font; the other packages are listed under "MathJax" | a dependency |
|
|
15
|
-
| tex | The own WASM build of `tex.web` with `etex.ch` (trials T5 and T6) | The "tex" stage of the design gives the licence of each input |
|
|
16
|
-
| tex | TeX packages (bundles) | LPPL
|
|
15
|
+
| tex | The own WASM build of `tex.web` with `etex.ch` (trials T5 and T6) | The "tex" stage of the design gives the licence of each input | downloaded in the core bundle |
|
|
16
|
+
| tex | TeX packages (bundles) | LPPL, public domain, OFL or GFL. Each package keeps its own licence (see "TeX toolchain and packages") | downloaded in the bundles |
|
|
17
17
|
| mesh | `occt-import-js` 0.0.23 (OpenCascade compiled to WASM) | LGPL-2.1 | a dependency |
|
|
18
18
|
| mesh | `manifold-3d` 3.2.1 (Manifold compiled to WASM) | Apache-2.0 | a dependency |
|
|
19
19
|
| mesh | `manifold-3d` | Apache-2.0 | not yet a dependency |
|
|
@@ -99,11 +99,72 @@ The font `assets/fonts/LiberationSerif-Regular.ttf` is Liberation Serif Regular,
|
|
|
99
99
|
|
|
100
100
|
### TeX toolchain and packages
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
The tex stage downloads its bundles on first use. The engine package holds no TeX package file and no font file. The engine package holds the pinned sha256 of each bundle in `src/tex/bundles.json`. There are four bundle files: `scieng-tex-core.sctb`, `scieng-tex-diagrams.sctb`, `scieng-tex-science.sctb` and `scieng-tex-math.sctb`. They hold unmodified files of the TeX Live 2023 archives in the table. The archives come from `tlnet-final`. Each has a sha256 pin in `tools/tex/config.json`. The core bundle also holds the WASM build of `tex.web` with `etex.ch` and the format `scieng.fmt`.
|
|
103
|
+
|
|
104
|
+
The column Licence gives the `catalogue-license` field of `texlive.tlpdb` of TeX Live 2023, as written there. The values have these meanings. `lppl`, `lppl1.3` and `lppl1.3c` are the LaTeX Project Public License. `ofl` is the SIL Open Font License. `pd` is public domain. `knuth` is the licence of the Computer Modern TFM files and the Knuth library files. The package `pgf` lists the LPPL, the GPL 2 and the FDL. The engine uses the LPPL. The package `circuitikz` lists the LPPL and the GPL; the engine uses the LPPL. The Type 1 outlines of Computer Modern and of the AMS fonts come from `amsfonts` (OFL). Latin Modern (`lm`, GFL) is not in a bundle. No sample glyph needed Latin Modern. No package with the GPL as its only licence is in a bundle.
|
|
105
|
+
|
|
106
|
+
| Package | Archive | Licence | Used in |
|
|
107
|
+
|---|---|---|---|
|
|
108
|
+
| amscls | `amscls.tar.xz` | lppl1.3c | extra bundles |
|
|
109
|
+
| amsfonts | `amsfonts.tar.xz` | ofl | format and core bundle, and the extra bundles |
|
|
110
|
+
| amsmath | `amsmath.tar.xz` | lppl1.3c | extra bundles |
|
|
111
|
+
| babel | `babel.tar.xz` | lppl1.3 | format and core bundle |
|
|
112
|
+
| bussproofs | `bussproofs.tar.xz` | lppl1.3 | extra bundles |
|
|
113
|
+
| chemfig | `chemfig.tar.xz` | lppl1.3c | extra bundles |
|
|
114
|
+
| chemgreek | `chemgreek.tar.xz` | lppl1.3 | extra bundles |
|
|
115
|
+
| circuitikz | `circuitikz.tar.xz` | lppl gpl | format and core bundle |
|
|
116
|
+
| cm | `cm.tar.xz` | knuth | format and core bundle |
|
|
117
|
+
| etoolbox | `etoolbox.tar.xz` | lppl1.3c | extra bundles |
|
|
118
|
+
| firstaid | `firstaid.tar.xz` | lppl1.3c | format and core bundle |
|
|
119
|
+
| graphics | `graphics.tar.xz` | lppl1.3c | format and core bundle |
|
|
120
|
+
| graphics-cfg | `graphics-cfg.tar.xz` | pd | format and core bundle |
|
|
121
|
+
| graphics-def | `graphics-def.tar.xz` | lppl1.3c | format and core bundle |
|
|
122
|
+
| hobby | `hobby.tar.xz` | lppl1.3c | extra bundles |
|
|
123
|
+
| hyphen-base | `hyphen-base.tar.xz` | (no field) | format and core bundle |
|
|
124
|
+
| knuth-lib | `knuth-lib.tar.xz` | knuth | format and core bundle |
|
|
125
|
+
| l3backend | `l3backend.tar.xz` | lppl1.3c | format and core bundle |
|
|
126
|
+
| l3kernel | `l3kernel.tar.xz` | lppl1.3c | format and core bundle |
|
|
127
|
+
| l3packages | `l3packages.tar.xz` | lppl1.3c | extra bundles |
|
|
128
|
+
| latex | `latex.tar.xz` | lppl1.3c | format and core bundle |
|
|
129
|
+
| latex-fonts | `latex-fonts.tar.xz` | lppl | format and core bundle |
|
|
130
|
+
| mhchem | `mhchem.tar.xz` | lppl1.3c | extra bundles |
|
|
131
|
+
| pgf | `pgf.tar.xz` | lppl1.3c gpl2 fdl | format and core bundle |
|
|
132
|
+
| simplekv | `simplekv.tar.xz` | lppl1.3c | extra bundles |
|
|
133
|
+
| smartdiagram | `smartdiagram.tar.xz` | lppl1.3 | extra bundles |
|
|
134
|
+
| standalone | `standalone.tar.xz` | lppl1.3 | format and core bundle |
|
|
135
|
+
| tikz-3dplot | `tikz-3dplot.tar.xz` | lppl1.3 | extra bundles |
|
|
136
|
+
| tikz-cd | `tikz-cd.tar.xz` | lppl1.3 | extra bundles |
|
|
137
|
+
| tools | `tools.tar.xz` | lppl1.3c | format and core bundle |
|
|
138
|
+
| unicode-data | `unicode-data.tar.xz` | lppl1.3c | format and core bundle |
|
|
139
|
+
| xcolor | `xcolor.tar.xz` | lppl1.3c | format and core bundle |
|
|
140
|
+
| xkeyval | `xkeyval.tar.xz` | lppl1.3 | format and core bundle |
|
|
141
|
+
| xstring | `xstring.tar.xz` | lppl1.3c | extra bundles |
|
|
142
|
+
|
|
143
|
+
### Files of Knuth (TeX Live 2023)
|
|
144
|
+
|
|
145
|
+
The licence of Knuth permits copies of an unchanged file. A changed file must have a new name. The build reads these files unchanged from the archives in the table above. This section quotes the licence lines of the files that carry them.
|
|
146
|
+
|
|
147
|
+
`fonts/source/public/cm/cmbase.mf` (package `cm`), lines 1 and 2:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
% THIS IS THE OFFICIAL COMPUTER MODERN SOURCE FILE cmbase.mf BY D E KNUTH.
|
|
151
|
+
% IT MUST NOT BE MODIFIED IN ANY WAY UNLESS THE FILE NAME IS CHANGED!
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`tex/generic/hyphen/hyphen.tex` (package `hyphen-base`), lines 1 to 4:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
% The Plain TeX hyphenation tables [NOT TO BE CHANGED IN ANY WAY!]
|
|
158
|
+
% Unlimited copying and redistribution of this file are permitted as long
|
|
159
|
+
% as this file is not modified. Modifications are permitted, but only if
|
|
160
|
+
% the resulting file is not named hyphen.tex.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The format build reads `hyphen.tex` and puts its patterns into the format `scieng.fmt`. The file lists of the bundles in `tools/tex/config.json` name neither `hyphen.tex` nor `cmbase.mf`. They name no run file of the package `knuth-lib`. The Computer Modern TFM files of the package `cm` are binary metric data and have no licence line.
|
|
103
164
|
|
|
104
165
|
### Template method credit
|
|
105
166
|
|
|
106
|
-
The package detection of the `tex` stage follows the templater of the Upmath renderer (`parpalak/i.upmath.me`, MIT). The engine credits that project for the method.
|
|
167
|
+
The package detection of the `tex` stage follows the templater of the Upmath renderer (`parpalak/i.upmath.me`, MIT). The engine credits that project for the method. Copyright 2015-2025 Roman Parpalak. Licence: MIT. The method is `lib/Templater.php` of that project. The templater tests the source for known environments and known commands. The templater adds the package that each environment or command needs. `src/tex/detect.ts` follows that method with its own tables and its own code. `src/tex/detect.ts` copies no code of the templater.
|
|
107
168
|
|
|
108
169
|
### Trial T2 sample files (LGPL-2.0-or-later, LGPL-2.1 and Apache-2.0)
|
|
109
170
|
|
package/dist/core.js
CHANGED
|
@@ -68,6 +68,8 @@ export async function renderWithRegistry(req, options, registry, configDeps) {
|
|
|
68
68
|
maxCadNodes: cfg.maxCadNodes,
|
|
69
69
|
maxCadFacets: cfg.maxCadFacets,
|
|
70
70
|
maxImageBytes: cfg.maxImageBytes,
|
|
71
|
+
cacheDir: cfg.cacheDir,
|
|
72
|
+
texBundleUrl: cfg.texBundleUrl,
|
|
71
73
|
},
|
|
72
74
|
},
|
|
73
75
|
}, { timeoutMs: cfg.timeoutMs, maxMemoryMb: cfg.maxMemoryMb });
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAiG,MAAM,YAAY,CAAC;AAE5K,2CAA2C;AAC3C,MAAM,IAAI,GAAiC;IACzC,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,iBAAiB;IACtB,IAAI,EAAE,0BAA0B;IAChC,EAAE,EAAE,8BAA8B;IAClC,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,WAAW;CACjB,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;;GAGG;AACH,MAAM,CA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MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;QAC3F,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAClD,IAAI,CAAC,UAAU;YAAE,GAAG,CAAC,MAAM,GAAG,qCAAqC,CAAC;aAC/D,IAAI,CAAC,YAAY;YAAE,GAAG,CAAC,MAAM,GAAG,gDAAgD,CAAC;QACtF,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/registry.js
CHANGED
|
@@ -35,6 +35,9 @@ export const DEFAULT_REGISTRY = {
|
|
|
35
35
|
"cad:stl": { backend: "mesh/manifold+stl", moduleUrl: backendUrl("mesh/backend-stl") },
|
|
36
36
|
"cad:html": { backend: "mesh/manifold+viewer", moduleUrl: backendUrl("mesh/backend-html") },
|
|
37
37
|
"cad:png": { backend: "mesh/manifold+viewer+browser/chromium", moduleUrl: backendUrl("mesh/backend-png") },
|
|
38
|
+
"tikz:svg": { backend: "tex/etex", moduleUrl: backendUrl("tex/backend-svg") },
|
|
39
|
+
"tikz:png": { backend: "tex/etex+raster/resvg", moduleUrl: backendUrl("tex/backend-png") },
|
|
40
|
+
"tikz:pdf": { backend: "tex/etex+browser/chromium", moduleUrl: backendUrl("tex/backend-pdf") },
|
|
38
41
|
"sysml:svg": { backend: "sysml/graph", moduleUrl: backendUrl("sysml/backend-svg") },
|
|
39
42
|
"sysml:png": { backend: "sysml/graph+raster/resvg", moduleUrl: backendUrl("sysml/backend-png") },
|
|
40
43
|
"sysml:pdf": { backend: "sysml/graph+browser/chromium", moduleUrl: backendUrl("sysml/backend-pdf") },
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;A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+
import { renderTikzSvg } from "./stage.js";
|
|
4
|
+
/** Renders one tikz source to pdf: the SVG of the tex stage, then the pdf of that SVG in the browser stage. */
|
|
5
|
+
export async function render(request) {
|
|
6
|
+
const svg = await renderTikzSvg(sourceText(request.source), request.options, request.settings);
|
|
7
|
+
const draw = await drawSvgToPdf(svg.svg, request.settings);
|
|
8
|
+
return { bytes: draw.bytes, warnings: [...svg.warnings, ...draw.warnings] };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=backend-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-pdf.js","sourceRoot":"","sources":["../../src/tex/backend-pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,+GAA+G;AAC/G,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA6B;IACxD,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/F,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3D,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BackendOutput, WorkerJob } from "../worker/protocol.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Renders one tikz source to PNG: the SVG of the tex stage, then the raster stage. The option scale multiplies the pixel
|
|
4
|
+
* size. The worker calls this function for the tikz:png pair.
|
|
5
|
+
*/
|
|
6
|
+
export declare function render(request: WorkerJob["request"]): Promise<BackendOutput>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MAX_SCALE } from "../browser/input.js";
|
|
2
|
+
import { RenderError } from "../errors.js";
|
|
3
|
+
import { readScale, svgDocumentToPng } from "../graph/backend-png.js";
|
|
4
|
+
import { sourceText } from "../graph/text.js";
|
|
5
|
+
import { renderTikzSvg } from "./stage.js";
|
|
6
|
+
/**
|
|
7
|
+
* Renders one tikz source to PNG: the SVG of the tex stage, then the raster stage. The option scale multiplies the pixel
|
|
8
|
+
* size. The worker calls this function for the tikz:png pair.
|
|
9
|
+
*/
|
|
10
|
+
export async function render(request) {
|
|
11
|
+
const { scale: _scale, ...rest } = request.options;
|
|
12
|
+
const scale = readScale(request.options);
|
|
13
|
+
if (scale > MAX_SCALE)
|
|
14
|
+
throw new RenderError("E_INPUT", `option scale must not be more than ${MAX_SCALE}`);
|
|
15
|
+
const svg = await renderTikzSvg(sourceText(request.source), rest, request.settings);
|
|
16
|
+
const png = await svgDocumentToPng(svg.svg, request, scale);
|
|
17
|
+
return { bytes: png.bytes, warnings: [...svg.warnings, ...(png.warnings ?? [])] };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=backend-png.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-png.js","sourceRoot":"","sources":["../../src/tex/backend-png.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA6B;IACxD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IACnD,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,KAAK,GAAG,SAAS;QAAE,MAAM,IAAI,WAAW,CAAC,SAAS,EAAE,sCAAsC,SAAS,EAAE,CAAC,CAAC;IAC3G,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpF,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5D,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BackendOutput, WorkerJob } from "../worker/protocol.ts";
|
|
2
|
+
/** Renders one tikz source to SVG through the tex stage. The worker calls this function for the tikz:svg pair. */
|
|
3
|
+
export declare function render(request: WorkerJob["request"]): Promise<BackendOutput>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { sourceText } from "../graph/text.js";
|
|
2
|
+
import { renderTikzSvg } from "./stage.js";
|
|
3
|
+
/** Renders one tikz source to SVG through the tex stage. The worker calls this function for the tikz:svg pair. */
|
|
4
|
+
export async function render(request) {
|
|
5
|
+
const result = await renderTikzSvg(sourceText(request.source), request.options, request.settings);
|
|
6
|
+
return { bytes: new TextEncoder().encode(result.svg), warnings: result.warnings };
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=backend-svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-svg.js","sourceRoot":"","sources":["../../src/tex/backend-svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,kHAAkH;AAClH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA6B;IACxD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClG,OAAO,EAAE,KAAK,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NetworkPolicy } from "../config.ts";
|
|
2
|
+
import type { BundleName } from "./detect.ts";
|
|
3
|
+
/** One bundle of the engine package: its name, the file name on the download server, the pinned sha256 and the size. */
|
|
4
|
+
export interface BundleEntry {
|
|
5
|
+
name: BundleName;
|
|
6
|
+
file: string;
|
|
7
|
+
sha256: string;
|
|
8
|
+
bytes: number;
|
|
9
|
+
}
|
|
10
|
+
/** The bundles of this build. `tools/tex/bundles.mjs` writes `bundles.json`, and CI fails when a built bundle differs from it. */
|
|
11
|
+
export declare const BUNDLES: readonly BundleEntry[];
|
|
12
|
+
/** The configuration values that the bundle manager reads. */
|
|
13
|
+
export interface BundleSettings {
|
|
14
|
+
/** The folder of the cache. The bundles go in its `tex-bundles` folder. */
|
|
15
|
+
cacheDir: string;
|
|
16
|
+
/** The base URL of the bundles. The download URL of a bundle is this value and the file name. */
|
|
17
|
+
texBundleUrl: string;
|
|
18
|
+
/** The network rule. A download needs `tex-bundles` in it. */
|
|
19
|
+
allowNetwork: NetworkPolicy;
|
|
20
|
+
/** The time limit of one download, in milliseconds. */
|
|
21
|
+
timeoutMs: number;
|
|
22
|
+
}
|
|
23
|
+
/** The sub-folder of the cache folder for the bundles. */
|
|
24
|
+
export declare const CACHE_SUBFOLDER = "tex-bundles";
|
|
25
|
+
/** The path of a bundle in the cache. */
|
|
26
|
+
export declare function cachePath(entry: BundleEntry, settings: Pick<BundleSettings, "cacheDir">): string;
|
|
27
|
+
/** The download URL of a bundle. A base URL with no end slash gets one. */
|
|
28
|
+
export declare function bundleUrl(entry: BundleEntry, settings: Pick<BundleSettings, "texBundleUrl">): string;
|
|
29
|
+
/** Looks up a bundle of the list by name. A name that is not in the list is an internal error. */
|
|
30
|
+
export declare function findBundle(name: BundleName, bundles?: readonly BundleEntry[]): BundleEntry;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the verified bytes of a bundle. The order is the cache, then the download.
|
|
33
|
+
* A cached file is hashed on every load. A cached file with a wrong hash is deleted, and the load goes on to the download.
|
|
34
|
+
* A download is allowed only when `allowNetwork` has `tex-bundles`. It goes to a temporary file in the cache folder,
|
|
35
|
+
* its hash and size are checked, and only then does a rename put it in place. A wrong hash deletes the temporary file and
|
|
36
|
+
* rejects with `E_INTEGRITY`, so a wrong file never stays in the cache. A bundle that is not cached, with the download not allowed,
|
|
37
|
+
* rejects with `E_STAGE_MISSING`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadBundleBytes(entry: BundleEntry, settings: BundleSettings): Promise<Uint8Array>;
|
|
40
|
+
/** Unpacks an SCTB1 container (see `tools/tex/bundles.mjs`) to a map from the tree name to the file bytes. */
|
|
41
|
+
export declare function unpackBundle(bytes: Uint8Array): Map<string, Uint8Array>;
|
|
42
|
+
/** Loads the named bundles and returns the files of each, in the order of the names. A name twice loads once. */
|
|
43
|
+
export declare function loadBundles(names: readonly BundleName[], settings: BundleSettings, bundles?: readonly BundleEntry[]): Promise<Map<BundleName, Map<string, Uint8Array>>>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { inflateRawSync } from "node:zlib";
|
|
6
|
+
import { RenderError } from "../errors.js";
|
|
7
|
+
import list from "./bundles.json" with { type: "json" };
|
|
8
|
+
/** The bundles of this build. `tools/tex/bundles.mjs` writes `bundles.json`, and CI fails when a built bundle differs from it. */
|
|
9
|
+
export const BUNDLES = list;
|
|
10
|
+
/** The sub-folder of the cache folder for the bundles. */
|
|
11
|
+
export const CACHE_SUBFOLDER = "tex-bundles";
|
|
12
|
+
const MAGIC = "SCTB1\0\0\0";
|
|
13
|
+
const sha256 = (b) => createHash("sha256").update(b).digest("hex");
|
|
14
|
+
/** The path of a bundle in the cache. */
|
|
15
|
+
export function cachePath(entry, settings) {
|
|
16
|
+
return path.join(settings.cacheDir, CACHE_SUBFOLDER, entry.file);
|
|
17
|
+
}
|
|
18
|
+
/** The download URL of a bundle. A base URL with no end slash gets one. */
|
|
19
|
+
export function bundleUrl(entry, settings) {
|
|
20
|
+
const base = settings.texBundleUrl;
|
|
21
|
+
return `${base.endsWith("/") ? base : `${base}/`}${entry.file}`;
|
|
22
|
+
}
|
|
23
|
+
/** Looks up a bundle of the list by name. A name that is not in the list is an internal error. */
|
|
24
|
+
export function findBundle(name, bundles = BUNDLES) {
|
|
25
|
+
const entry = bundles.find((b) => b.name === name);
|
|
26
|
+
if (entry === undefined)
|
|
27
|
+
throw new RenderError("E_INTERNAL", `the build has no TeX bundle named ${name}`);
|
|
28
|
+
return entry;
|
|
29
|
+
}
|
|
30
|
+
/** Reads a file or rejects with `undefined` when it is not there. */
|
|
31
|
+
async function readIfThere(file) {
|
|
32
|
+
try {
|
|
33
|
+
return new Uint8Array(await readFile(file));
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
if (e.code === "ENOENT")
|
|
37
|
+
return undefined;
|
|
38
|
+
throw e;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Downloads the bytes of a bundle from an `http:`, `https:` or `file:` URL. */
|
|
42
|
+
async function download(url, settings, entry) {
|
|
43
|
+
const fail = (why) => new RenderError("E_STAGE_MISSING", `the TeX bundle ${entry.name} is not available at ${url}: ${why}`);
|
|
44
|
+
let parsed;
|
|
45
|
+
try {
|
|
46
|
+
parsed = new URL(url);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new RenderError("E_CONFIG", `texBundleUrl gives the URL ${url} for the TeX bundle ${entry.name}, and it is not a URL`);
|
|
50
|
+
}
|
|
51
|
+
if (parsed.protocol === "file:") {
|
|
52
|
+
try {
|
|
53
|
+
return new Uint8Array(await readFile(fileURLToPath(parsed)));
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw fail(e instanceof Error ? e.message : String(e));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:")
|
|
60
|
+
throw fail(`the protocol ${parsed.protocol} is not supported`);
|
|
61
|
+
try {
|
|
62
|
+
const res = await fetch(parsed, { redirect: "follow", signal: AbortSignal.timeout(settings.timeoutMs) });
|
|
63
|
+
if (!res.ok)
|
|
64
|
+
throw fail(`the server answered ${res.status}`);
|
|
65
|
+
const length = Number(res.headers.get("content-length") ?? 0);
|
|
66
|
+
if (length > entry.bytes)
|
|
67
|
+
throw new RenderError("E_INTEGRITY", `the TeX bundle ${entry.name} from ${url} is ${length} bytes, and the pin says ${entry.bytes}`);
|
|
68
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
if (e instanceof RenderError)
|
|
72
|
+
throw e;
|
|
73
|
+
throw fail(e instanceof Error ? e.message : String(e));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns the verified bytes of a bundle. The order is the cache, then the download.
|
|
78
|
+
* A cached file is hashed on every load. A cached file with a wrong hash is deleted, and the load goes on to the download.
|
|
79
|
+
* A download is allowed only when `allowNetwork` has `tex-bundles`. It goes to a temporary file in the cache folder,
|
|
80
|
+
* its hash and size are checked, and only then does a rename put it in place. A wrong hash deletes the temporary file and
|
|
81
|
+
* rejects with `E_INTEGRITY`, so a wrong file never stays in the cache. A bundle that is not cached, with the download not allowed,
|
|
82
|
+
* rejects with `E_STAGE_MISSING`.
|
|
83
|
+
*/
|
|
84
|
+
export async function loadBundleBytes(entry, settings) {
|
|
85
|
+
const target = cachePath(entry, settings);
|
|
86
|
+
const cached = await readIfThere(target);
|
|
87
|
+
if (cached !== undefined) {
|
|
88
|
+
if (sha256(cached) === entry.sha256)
|
|
89
|
+
return cached;
|
|
90
|
+
await rm(target, { force: true });
|
|
91
|
+
}
|
|
92
|
+
const url = bundleUrl(entry, settings);
|
|
93
|
+
if (settings.allowNetwork === "none") {
|
|
94
|
+
throw new RenderError("E_STAGE_MISSING", `the TeX bundle ${entry.name} is not in the cache (${target}), and the configuration does not allow the download of ${url}. Set allowNetwork to tex-bundles, or put the file ${entry.file} in the cache folder.`);
|
|
95
|
+
}
|
|
96
|
+
const bytes = await download(url, settings, entry);
|
|
97
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
98
|
+
const temp = `${target}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
|
|
99
|
+
await writeFile(temp, bytes);
|
|
100
|
+
try {
|
|
101
|
+
if (bytes.length !== entry.bytes || sha256(bytes) !== entry.sha256) {
|
|
102
|
+
await rm(temp, { force: true });
|
|
103
|
+
throw new RenderError("E_INTEGRITY", `the TeX bundle ${entry.name} from ${url} does not match its pin (sha256 ${entry.sha256}, ${entry.bytes} bytes). The download is deleted.`);
|
|
104
|
+
}
|
|
105
|
+
await rename(temp, target);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
await rm(temp, { force: true });
|
|
109
|
+
throw e;
|
|
110
|
+
}
|
|
111
|
+
return bytes;
|
|
112
|
+
}
|
|
113
|
+
/** Unpacks an SCTB1 container (see `tools/tex/bundles.mjs`) to a map from the tree name to the file bytes. */
|
|
114
|
+
export function unpackBundle(bytes) {
|
|
115
|
+
const buf = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
116
|
+
if (buf.length < 8 || buf.toString("latin1", 0, 8) !== MAGIC)
|
|
117
|
+
throw new RenderError("E_INTEGRITY", "a TeX bundle is not an SCTB1 container");
|
|
118
|
+
let body;
|
|
119
|
+
try {
|
|
120
|
+
body = inflateRawSync(buf.subarray(8));
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
throw new RenderError("E_INTEGRITY", `a TeX bundle does not inflate: ${e instanceof Error ? e.message : String(e)}`);
|
|
124
|
+
}
|
|
125
|
+
const out = new Map();
|
|
126
|
+
let at = 4;
|
|
127
|
+
const count = body.readUInt32LE(0);
|
|
128
|
+
for (let i = 0; i < count; i++) {
|
|
129
|
+
const nameLength = body.readUInt16LE(at);
|
|
130
|
+
at += 2;
|
|
131
|
+
const name = body.toString("utf8", at, at + nameLength);
|
|
132
|
+
at += nameLength;
|
|
133
|
+
const size = body.readUInt32LE(at);
|
|
134
|
+
at += 4;
|
|
135
|
+
out.set(name, new Uint8Array(body.buffer, body.byteOffset + at, size));
|
|
136
|
+
at += size;
|
|
137
|
+
}
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
/** Loads the named bundles and returns the files of each, in the order of the names. A name twice loads once. */
|
|
141
|
+
export async function loadBundles(names, settings, bundles = BUNDLES) {
|
|
142
|
+
const out = new Map();
|
|
143
|
+
for (const name of names) {
|
|
144
|
+
if (out.has(name))
|
|
145
|
+
continue;
|
|
146
|
+
out.set(name, unpackBundle(await loadBundleBytes(findBundle(name, bundles), settings)));
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=bundles.js.map
|
|
@@ -0,0 +1 @@
|
|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AC,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "core",
|
|
4
|
+
"file": "scieng-tex-core.sctb",
|
|
5
|
+
"sha256": "20b7654bbf6da695eed7eef7895f3a59533f99e675cdb10e48f73d22ac47f43c",
|
|
6
|
+
"bytes": 9383293
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"name": "diagrams",
|
|
10
|
+
"file": "scieng-tex-diagrams.sctb",
|
|
11
|
+
"sha256": "d11be2a1c7931c0d37496852adebe9b3de3deda4bcad98e5396e7eab9c56f2f7",
|
|
12
|
+
"bytes": 71534
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "science",
|
|
16
|
+
"file": "scieng-tex-science.sctb",
|
|
17
|
+
"sha256": "38990ecd718cf5c670c7661418b2a0e427100a8f6b1bb0fc95f21faed0bb45df",
|
|
18
|
+
"bytes": 90196
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "math",
|
|
22
|
+
"file": "scieng-tex-math.sctb",
|
|
23
|
+
"sha256": "ffb760bdb04aa35d4ee56e8bf9ae6a628dd7d204c6aac55d147e651f1854343e",
|
|
24
|
+
"bytes": 721870
|
|
25
|
+
}
|
|
26
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package detection of the TeX stage.
|
|
3
|
+
*
|
|
4
|
+
* The method follows the templater of the Upmath renderer (parpalak/i.upmath.me, MIT licence,
|
|
5
|
+
* copyright Roman Parpalak): the scan looks for known environments and commands in the source
|
|
6
|
+
* and names the package that each one needs. This module adds package lines, TikZ libraries,
|
|
7
|
+
* the comment and verbatim blanking, the bundle tables and the rejection of packages that no
|
|
8
|
+
* bundle holds. It copies no code of the templater.
|
|
9
|
+
*
|
|
10
|
+
* The scan is not a security boundary. TeX runs on a virtual file tree that holds only the
|
|
11
|
+
* bundles, so a package that the scan misses fails inside TeX.
|
|
12
|
+
*/
|
|
13
|
+
/** The name of a TeX bundle. */
|
|
14
|
+
export type BundleName = "core" | "diagrams" | "science" | "math";
|
|
15
|
+
/** The result of a scan. */
|
|
16
|
+
export interface Detection {
|
|
17
|
+
/** The bundles that the source needs, sorted, with `core` first. */
|
|
18
|
+
bundles: BundleName[];
|
|
19
|
+
/** The packages that the source names or implies, sorted, each one once. */
|
|
20
|
+
packages: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Scans a TeX source and names the bundles that it needs.
|
|
24
|
+
* Throws E_UNSUPPORTED for a package with the GPL as its only licence, for a package that no bundle holds
|
|
25
|
+
* and for a `fontenc` option other than OT1.
|
|
26
|
+
*/
|
|
27
|
+
export declare function detectBundles(source: string): Detection;
|