@grafloria/element 0.3.22 → 0.3.23
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 +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,4 +27,34 @@ framework's template binding targets.
|
|
|
27
27
|
For first-class framework idioms use `@grafloria/react`,
|
|
28
28
|
`@grafloria/angular`, or `@grafloria/vue`.
|
|
29
29
|
|
|
30
|
+
## Bundle size — what actually ships
|
|
31
|
+
|
|
32
|
+
Don't judge this library by npm's **unpacked size** stat. Installing the
|
|
33
|
+
Grafloria family unpacks ~14 MB because every package publishes its code three
|
|
34
|
+
ways — a CJS build, an ESM build, and TypeScript declarations. None of that
|
|
35
|
+
reaches your users as-is; what matters is what your bundler emits.
|
|
36
|
+
|
|
37
|
+
Worst case, importing the **entire** public surface of `@grafloria/element`
|
|
38
|
+
(the whole stack: engine, renderer, the custom element, every kit (diagram, dashboard, table…)), measured with esbuild (minify, ESM, code-splitting):
|
|
39
|
+
|
|
40
|
+
| | minified | gzipped |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| eager bundle | 1660 KB | **451 KB** |
|
|
43
|
+
| elkjs — lazy chunk, downloads **only** if ELK layout is invoked | 1,423 KB | 432 KB |
|
|
44
|
+
|
|
45
|
+
A real app importing only what it uses ships less. Reproduce it in two minutes:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm i -D esbuild @grafloria/element
|
|
49
|
+
echo "export * from '@grafloria/element';" > entry.mjs
|
|
50
|
+
npx esbuild entry.mjs --bundle --minify --format=esm --splitting --outdir=out
|
|
51
|
+
gzip -k9 out/entry.js && wc -c out/entry.js out/entry.js.gz
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`--splitting` matters: without it esbuild inlines the lazily-imported ELK
|
|
55
|
+
chunk and inflates the number by ~1.4 MB. Real app bundlers (Angular CLI,
|
|
56
|
+
Vite, Next.js) split by default. Use current versions — engine ≥ 0.2.13,
|
|
57
|
+
renderer ≥ 0.3.12, element ≥ 0.3.22 — older cores were CJS-only, which
|
|
58
|
+
defeats splitting and tree-shaking.
|
|
59
|
+
|
|
30
60
|
MIT © [Grafloria](https://github.com/grafloria/grafloria)
|