@danielsimonjr/sciengjs 0.2.0 → 0.3.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 +10 -5
- package/THIRD_PARTY_NOTICES.md +16 -0
- package/assets/licenses/MIT-mermaid.txt +21 -0
- package/assets/licenses/mermaid-bundle.txt +2128 -0
- package/assets/mermaid.min.js +3636 -0
- package/dist/browser/backend-pdf.d.ts +3 -0
- package/dist/browser/backend-pdf.js +15 -0
- package/dist/browser/backend-pdf.js.map +1 -0
- package/dist/browser/backend-png.d.ts +3 -0
- package/dist/browser/backend-png.js +18 -0
- package/dist/browser/backend-png.js.map +1 -0
- package/dist/browser/cdp.d.ts +37 -0
- package/dist/browser/cdp.js +161 -0
- package/dist/browser/cdp.js.map +1 -0
- package/dist/browser/flags.d.ts +10 -0
- package/dist/browser/flags.js +33 -0
- package/dist/browser/flags.js.map +1 -0
- package/dist/browser/index.d.ts +5 -0
- package/dist/browser/index.js +6 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/input.d.ts +38 -0
- package/dist/browser/input.js +97 -0
- package/dist/browser/input.js.map +1 -0
- package/dist/browser/page.d.ts +10 -0
- package/dist/browser/page.js +33 -0
- package/dist/browser/page.js.map +1 -0
- package/dist/browser/pinned.d.ts +16 -0
- package/dist/browser/pinned.js +13 -0
- package/dist/browser/pinned.js.map +1 -0
- package/dist/browser/profile.d.ts +9 -0
- package/dist/browser/profile.js +33 -0
- package/dist/browser/profile.js.map +1 -0
- package/dist/browser/proxy.d.ts +14 -0
- package/dist/browser/proxy.js +64 -0
- package/dist/browser/proxy.js.map +1 -0
- package/dist/browser/render.d.ts +58 -0
- package/dist/browser/render.js +421 -0
- package/dist/browser/render.js.map +1 -0
- package/dist/core.js +10 -2
- package/dist/core.js.map +1 -1
- package/dist/graph/backend-pdf.d.ts +3 -0
- package/dist/graph/backend-pdf.js +14 -0
- package/dist/graph/backend-pdf.js.map +1 -0
- package/dist/graph/backend-png.d.ts +4 -2
- package/dist/graph/backend-png.js +13 -13
- package/dist/graph/backend-png.js.map +1 -1
- package/dist/mermaid/backend-pdf.d.ts +6 -0
- package/dist/mermaid/backend-pdf.js +19 -0
- package/dist/mermaid/backend-pdf.js.map +1 -0
- package/dist/mermaid/backend-png.d.ts +3 -2
- package/dist/mermaid/backend-png.js +20 -6
- package/dist/mermaid/backend-png.js.map +1 -1
- package/dist/mermaid/backend-svg.d.ts +4 -1
- package/dist/mermaid/backend-svg.js +13 -3
- package/dist/mermaid/backend-svg.js.map +1 -1
- package/dist/mermaid/browser.d.ts +30 -0
- package/dist/mermaid/browser.js +52 -0
- package/dist/mermaid/browser.js.map +1 -0
- package/dist/mermaid/common.d.ts +7 -0
- package/dist/mermaid/common.js +34 -2
- package/dist/mermaid/common.js.map +1 -1
- package/dist/pairs.d.ts +2 -1
- package/dist/pairs.js +8 -6
- package/dist/pairs.js.map +1 -1
- package/dist/registry.js +4 -0
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/entry.js +1 -1
- package/dist/worker/entry.js.map +1 -1
- package/dist/worker/protocol.d.ts +7 -0
- package/dist/worker/run.js +1 -1
- package/dist/worker/run.js.map +1 -1
- package/package.json +6 -1
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.
|
|
13
|
+
Release 0.3.0 holds three input types: **Graphviz DOT**, **Mermaid** (every diagram type) and **HTML** (to PNG and PDF). 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
|
|---|---|---|
|
|
@@ -18,8 +18,11 @@ Release 0.2.0 holds two input types: **Graphviz DOT** and **Mermaid** (class, st
|
|
|
18
18
|
| DOT | PNG | Graphviz, then resvg compiled to WASM (`@resvg/resvg-wasm`), with a bundled font |
|
|
19
19
|
| Mermaid (class, state, sequence) | SVG | The engine's own parsers and layouts. Class and state diagrams go through Graphviz. |
|
|
20
20
|
| Mermaid (class, state, sequence) | PNG | The same SVG, then resvg compiled to WASM (`@resvg/resvg-wasm`), with a bundled font |
|
|
21
|
+
| Mermaid (all other types) | SVG, PNG, PDF | The pinned Mermaid 11.17.2 build in the browser stage. The engine serves the build from the package. |
|
|
22
|
+
| DOT, Mermaid | PDF | The SVG, printed by the browser stage |
|
|
23
|
+
| HTML | PNG, PDF | The browser stage |
|
|
21
24
|
|
|
22
|
-
- **No network.** The DOT and Mermaid paths make no network request.
|
|
25
|
+
- **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.
|
|
23
26
|
- **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.
|
|
24
27
|
- **The same text on every machine.** PNG text uses the bundled Liberation Serif font, not the fonts of the host. The engine gives a warning when the drawing asks for bold, italic or a character that the font does not have.
|
|
25
28
|
- **Limits.** Each render has a time limit, a source size limit and a heap limit. A PNG has a pixel limit of 1024 MB.
|
|
@@ -143,6 +146,8 @@ A subpath call runs in the calling thread, without the worker and its limits. Us
|
|
|
143
146
|
|
|
144
147
|
The `mermaid` input draws class, state and sequence diagrams without a browser. A line outside the grammar rejects the render with `E_INPUT`, and the message names the line. Set `lenient` to `true` to skip such a line and get a warning instead.
|
|
145
148
|
|
|
149
|
+
Other Mermaid types, for example `flowchart` and `gantt`, need the browser stage. A `png` takes the option `scale` (above 0, not more than 8, default 1) on both paths. The browser path sizes the page from the `viewBox` of the diagram. The `svg` of the browser path has an explicit `width` and `height`. Any other `png` option rejects with `E_INPUT`.
|
|
150
|
+
|
|
146
151
|
```js
|
|
147
152
|
import { render } from "@danielsimonjr/sciengjs";
|
|
148
153
|
|
|
@@ -150,7 +155,7 @@ const source = "sequenceDiagram\nAlice->>Bob: Hello Bob\nBob-->>Alice: Hi Alice"
|
|
|
150
155
|
const { bytes, warnings } = await render({ type: "mermaid", source, format: "svg" }, {});
|
|
151
156
|
```
|
|
152
157
|
|
|
153
|
-
Other Mermaid diagram types reject with `
|
|
158
|
+
Other Mermaid diagram types (for example flowchart and gantt) go through the browser stage. They need `SCIENG_BROWSER`. Without it they reject with `E_STAGE_MISSING`. The pinned Mermaid build ships in the package, and the browser stage serves it to the page, so no request leaves the process.
|
|
154
159
|
|
|
155
160
|
## Roadmap
|
|
156
161
|
|
|
@@ -159,13 +164,13 @@ The [build plan](docs/superpowers/plans/2026-11-01-scieng-engine-build.md) gives
|
|
|
159
164
|
| Input type | Stage | Status |
|
|
160
165
|
|---|---|---|
|
|
161
166
|
| DOT | graph, raster | released in 0.1.0 |
|
|
162
|
-
| Mermaid | graph, mermaid, browser | class, state and sequence: released in 0.2.0; other types:
|
|
167
|
+
| Mermaid | graph, mermaid, browser | class, state and sequence: released in 0.2.0; other types: released in 0.3.0 |
|
|
163
168
|
| LaTeX math | math (MathJax) | planned |
|
|
164
169
|
| TikZ, circuitikz, LaTeX | tex (an own WASM build of `tex.web`) | trial builds pass |
|
|
165
170
|
| Plots | plot | planned |
|
|
166
171
|
| SysML v2 | sysml | planned |
|
|
167
172
|
| STEP, IGES, BREP | mesh (OpenCascade WASM) | trial build passes |
|
|
168
|
-
| HTML to PNG, PDF and Markdown | html, browser | planned |
|
|
173
|
+
| HTML to PNG, PDF and Markdown | html, browser | PNG and PDF: released in 0.3.0; Markdown: planned |
|
|
169
174
|
|
|
170
175
|
## Use from an agent
|
|
171
176
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -17,6 +17,7 @@ Version: each row gives the version that the engine pins.
|
|
|
17
17
|
| mesh | `occt-import-js` (OpenCascade compiled to WASM) | LGPL-2.1 | not yet a dependency |
|
|
18
18
|
| mesh | `manifold-3d` | Apache-2.0 | not yet a dependency |
|
|
19
19
|
| mesh (viewer page) | `three` | MIT | not yet a dependency |
|
|
20
|
+
| browser | `mermaid` 11.17.2 (the pinned build `dist/mermaid.min.js`, copied into the assets folder at build) | MIT | a devDependency. The browser stage serves the copy to pages |
|
|
20
21
|
| raster | `@resvg/resvg-wasm` 2.6.2 | MPL-2.0 | a dependency |
|
|
21
22
|
| raster | Liberation Serif Regular 2.1.5 (font, in `assets/fonts/`) | SIL Open Font License 1.1 | bundled |
|
|
22
23
|
| html | `parse5` | MIT | not yet a dependency |
|
|
@@ -28,6 +29,21 @@ Version: each row gives the version that the engine pins.
|
|
|
28
29
|
|
|
29
30
|
The Eclipse Public License 2.0 applies to Graphviz. The MIT licence applies to the wrapper `@viz-js/viz`. The package does not ship a Graphviz licence file. The licence text of Graphviz is in `assets/licenses/EPL-2.0.txt`. The MIT licence text of the wrapper is in `assets/licenses/MIT-viz-js.txt`, copied from the tag `release-viz-3.31.0` of the source repository https://github.com/mdaines/viz-js. The npm package does not ship this file.
|
|
30
31
|
|
|
32
|
+
### Mermaid (MIT)
|
|
33
|
+
|
|
34
|
+
The MIT licence applies to `mermaid` 11.17.2. The build writes the file mermaid.min.js into the assets folder. That file is generated at build time and is not committed. The licence text is in `assets/licenses/MIT-mermaid.txt`.
|
|
35
|
+
|
|
36
|
+
The file mermaid.min.js also holds the code of the runtime dependencies of `mermaid`. Each of these packages keeps its own licence:
|
|
37
|
+
|
|
38
|
+
- MIT: `cytoscape`, `cytoscape-cose-bilkent`, `cytoscape-fcose`, `dagre-d3-es`, `dayjs`, `katex`, `khroma`, `marked`, `roughjs`, `stylis`, `ts-dedent`, `uuid`, `es-toolkit`, `fastdom`, `@braintree/sanitize-url`, `@iconify/utils`, `@upsetjs/venn.js`, `@mermaid-js/parser` and `lodash-es`.
|
|
39
|
+
- ISC: `d3` and most of the `d3-*` modules.
|
|
40
|
+
- BSD-3-Clause: `d3-sankey`, `d3-ease`, `rw` and the older copies of `d3-array`, `d3-shape` and `d3-path` that `d3-sankey` uses.
|
|
41
|
+
- MPL-2.0 OR Apache-2.0: `dompurify`. The engine uses it under the Apache-2.0 licence.
|
|
42
|
+
- Apache-2.0: `@chevrotain/types`.
|
|
43
|
+
- Unlicense: `robust-predicates`.
|
|
44
|
+
|
|
45
|
+
The file `assets/licenses/mermaid-bundle.txt` holds the licence text of each of the 79 packages, with its name and version. The script `scripts/mermaid-licenses.mjs` writes that file from the installed `mermaid` package. Run the script again after a change of the pinned Mermaid version.
|
|
46
|
+
|
|
31
47
|
### OpenCascade (LGPL-2.1)
|
|
32
48
|
|
|
33
49
|
`occt-import-js` is licensed under the GNU Lesser General Public License 2.1. The WASM file stays a separate, unmodified file.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 - 2022 Knut Sveidqvist
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|