svg-path-commander 2.2.3 → 2.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/AGENTS.md CHANGED
@@ -9,11 +9,11 @@ SVGPathCommander v2.2.2 — TypeScript library for manipulating SVG `<path>` `d`
9
9
  ```bash
10
10
  pnpm install # Install dependencies
11
11
  pnpm dev # Serve docs on localhost:3000
12
- pnpm test # Run all tests (vitest + happy-dom)
13
- pnpm test:browser # Run browser tests (vitest + playwright chromium)
12
+ pnpm test # Run all tests (vitest + Istanbul coverage)
14
13
  pnpm test-ui # Run tests with UI
15
14
  pnpm test -- -t "Test name" # Run a single test by name
16
15
  pnpm test -- class.test.ts # Run a single test file
16
+ pnpm bench # Benchmark vs svgpath (results embedded in README)
17
17
  pnpm lint # Deno lint + tsc type check
18
18
  pnpm lint:ts # Deno lint only
19
19
  pnpm fix:ts # Deno lint --fix
@@ -37,8 +37,7 @@ deno publish # JSR dry run: deno publish --dry-run --allow-dirty
37
37
  - **Language:** TypeScript (strict, ES2020 target, `allowImportingTsExtensions`)
38
38
  - **Package manager:** pnpm (v11.x)
39
39
  - **Build:** tsdown (ESM + UMD outputs)
40
- - **Test:** Vitest + happy-dom (Istanbul coverage)
41
- - **Browser Test:** Vitest + Playwright (real Chromium, `test/browser/`)
40
+ - **Test:** Vitest + Istanbul coverage (`test/class.test.ts`, `test/static.test.ts`)
42
41
  - **Lint/Format:** Deno (`deno lint`, `deno fmt`)
43
42
  - **JSR:** `deno.json` publishes as `@thednp/svg-path-commander` — `deno check src`, `deno lint src` and `deno publish --dry-run --allow-dirty` must all pass
44
43
  - **Dependency:** `@thednp/dommatrix` (DOMMatrix shim)
@@ -101,12 +100,9 @@ deno publish # JSR dry run: deno publish --dry-run --allow-dirty
101
100
  - Instance options validated in constructor with fallback to `defaultOptions`
102
101
 
103
102
  ### Testing
104
- - Tests run with happy-dom (headless browser simulation) via `pnpm test`
105
- - Browser tests run with real Chromium (Playwright) via `pnpm test:browser`
103
+ - Tests run with Vitest + Istanbul coverage via `pnpm test`
104
+ - Test files: `test/class.test.ts` (instance API), `test/static.test.ts` (static methods)
106
105
  - Fixtures in `test/fixtures/`
107
- - Test files: `test/class.test.ts` (instance API), `test/static.test.ts` (static methods), `test/browser/` (native browser APIs)
108
- - Tests render actual SVG and verify `d` attribute output
109
- - Use `vi.waitFor()` for async DOM queries (timeout: 200ms)
110
106
  - Use `expect().to.deep.equal()` for object comparison, `expect().to.equal()` for primitives
111
107
  - Coverage provider: Istanbul
112
108
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.3.0] - 2026-08-04
4
+
5
+ ### Added
6
+ - `pnpm bench` — head-to-head benchmark against the [SvgPath](https://github.com/fontello/svgpath) library (vendored reference in `scripts/svgpath/`), comparing parse / bbox / transform / string output, with results embedded in the README
7
+
8
+ ### Changed
9
+ - **Performance**: allocation-free parsing — `scanParam()` converts validated number substrings without allocating new strings, `finalizeSegment()` builds segments with pre-sized arrays and index-based slicing instead of `splice()`
10
+ - **Performance**: single-pass 2D transforms — `transformPath()` now uses a dedicated `transform2D()` fast path that transforms segments in place (no per-segment absolutize / copy / DOMMatrix projection), falling back to the 3D-capable `iterate()` path for 3D matrices; output is byte-identical to the previous implementation (~2.8x faster 2D transforms)
11
+ - **Performance**: fast 2D branch in `projection2d()`, char-code based command detection in `iterate()` / `getPathBBox()`, allocation-free rounding in `pathToString()`, and a dedicated `C` case in `absolutizeSegment()`
12
+ - Rebuilt `dist` and `docs` bundles
13
+
14
+ ## [2.2.4] - 2026-08-04
15
+ ### Fixed
16
+ - Build warnings: UMD bundle now uses a dedicated `src/browser.ts` entry so the `SVGPathCommander` global remains the class itself (no mixed-exports namespace), and the `output.dir`/`output.file` conflict is resolved — tree-shaking, named exports and type declarations are unaffected
17
+ - ESM bundle exports the `SVGPathCommander` named export alongside the default, with all types available in `dist/index.d.ts`
18
+
19
+
20
+ ## [2.2.3] - 2026-08-04
21
+
22
+ ### Added
23
+ - Named `SVGPathCommander` export alongside the default export for better JSR documentation rendering
24
+ - Full JSDoc coverage for all class statics, instance properties, getters and every interface / type member — zero undocumented symbols per `deno doc --json` on both `index` and `util` entry points
25
+ - JSR `./util` subpath export in `deno.json`, mirroring the npm `svg-path-commander/util` entry
26
+
27
+ ### Changed
28
+ - Documentation moved from the GitHub wiki into the repository `wiki/` folder — the GitHub-hosted wiki pages are no longer available, and the README and wiki pages now reference the local `wiki/` folder instead
29
+ - Merged `NPM.md` and `JSR.md` into a single `Installation.md` (npm, pnpm, bun, Deno/JSR and CDN installation)
30
+ - Updated `Usage-Examples.md` with corrected output values verified against the current implementation
31
+ - Rebuilt `dist` and `docs` bundles
32
+
3
33
  ## [2.2.2] - 2026-08-03
4
34
 
5
35
  ### Added
package/README.md CHANGED
@@ -35,6 +35,36 @@ There are a couple of good reasons for this implementation:
35
35
 
36
36
  This library is available on [CDN](https://www.jsdelivr.com/package/npm/svg-path-commander), [npm](https://www.npmjs.com/package/svg-path-commander) and [JSR](https://jsr.io/@thednp/svg-path-commander).
37
37
 
38
+ <!-- BENCH:start -->
39
+ # Performance
40
+
41
+ A comparison of **SVGPathCommander** with the [SvgPath](https://github.com/fontello/svgpath) library v2.6.0 and its [svg-path-bbox](https://github.com/fontello/svg-path-bbox) helper v2.1.0, run with `pnpm bench` against a sample path with `11650` path segments. All values are in **milliseconds**, reported as `avg / best` over 10 runs after 3 warmups; lower is better. The `vs svgpath` column is the `avg` ratio of SVGPathCommander to svgpath.
42
+
43
+ `transform2d` uses `{ scale: 0.8 }`, `transform3d` uses `{ rotate: [15, 15, 30] }`. [SvgPath](https://github.com/fontello/svgpath) only supports 2D transforms, so `transform3d` is marked `n/a` for it.
44
+
45
+ ## Static methods
46
+
47
+ | Operation | SVGPathCommander (static) | svgpath | vs svgpath |
48
+ | --- | --- | --- | --- |
49
+ | parse | **7.8 / 7** | 9.3 / 9 | **0.8x** |
50
+ | bbox | **5.6 / 5** | 6.9 / 6 | **0.8x** |
51
+ | transform2d | 1.7 / 1 | 1.6 / 1 | 1.1x |
52
+ | transform3d | **14.4 / 10** | n/a | n/a |
53
+ | string | **5.8 / 5** | 5.9 / 5 | **1x** |
54
+
55
+ ## Instance methods
56
+
57
+ | Operation | SVGPathCommander (instance) | svgpath | vs svgpath |
58
+ | --- | --- | --- | --- |
59
+ | parse | **7 / 6** | 9.3 / 9 | **0.8x** |
60
+ | bbox | **5.1 / 4** | 6.9 / 6 | **0.7x** |
61
+ | transform2d | **1 / 0** | 1.6 / 1 | **0.6x** |
62
+ | transform3d | **8.5 / 7** | n/a | n/a |
63
+ | string | 6.8 / 6 | 5.9 / 5 | 1.2x |
64
+
65
+ Last benchmark run on `2026-08-04`. Generated by [`scripts/bench.js`](scripts/bench.js); update with `pnpm bench`.
66
+ <!-- BENCH:end -->
67
+
38
68
 
39
69
  # Install
40
70
 
@@ -284,7 +314,7 @@ const [eq1, eq2] = SVGPathCommander.equalizePaths(
284
314
  ```
285
315
 
286
316
  # WIKI
287
- For developer guidelines, and a complete list of static methods, head over to the [wiki pages](https://github.com/thednp/svg-path-commander/wiki).
317
+ For developer guidelines, and a complete list of static methods, head over to the [`wiki/`](wiki/) folder in this repository.
288
318
 
289
319
 
290
320
  # What Is It For?
@@ -324,4 +354,4 @@ For developer guidelines, and a complete list of static methods, head over to th
324
354
  * a special thanks goes to [@vltansky](https://github.com/vltansky) for fixing tree-shaking in **SVGPathCommander**!
325
355
 
326
356
  # License
327
- **SVGPathCommander** is released under [MIT Licence](https://github.com/thednp/svg-path-commander/blob/master/LICENSE).
357
+ **SVGPathCommander** is released under [MIT Licence](LICENSE).