@enslo/sd-metadata 2.1.1 → 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/CHANGELOG.md CHANGED
@@ -5,6 +5,46 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.3.0] - 2026-05-30
9
+
10
+ ### Improved
11
+
12
+ - **ComfyUI metadata parsing** (#219): Improved accuracy and coverage for
13
+ non-standard workflow topologies and custom nodes (`ShowText|pysssss`,
14
+ `PromptStashSaver`). Several edge cases that previously caused parse failures
15
+ or incorrect results — including workflows with `NaN`-containing JSON, node
16
+ references in model fields, and workflow-only PNG files — are now handled
17
+ correctly.
18
+
19
+ ### Maintenance
20
+
21
+ - Add `index.d.ts.map` (declaration sourcemaps) to the published output (#216)
22
+ - Update development dependencies
23
+
24
+ ## [2.2.0] - 2026-02-27
25
+
26
+ ### Added
27
+
28
+ - **Draw Things parser** (#181): Read and write metadata from [Draw Things](https://drawthings.ai/) (macOS/iOS) generated images
29
+ - Extract generation parameters from XMP (Adobe XML Metadata) packets
30
+ - Native XMP read/write for JPEG (APP1 segment) and WebP (XMP chunk)
31
+ - XMP reading from PNG iTXt chunks
32
+
33
+ ### Potentially Breaking Changes
34
+
35
+ - **New `GenerationSoftware` member** (#181): `'draw-things'` added. TypeScript users with exhaustive `switch` or `Record<GenerationSoftware, ...>` will need to handle the new value.
36
+ - **New `MetadataSegmentSource` variant** (#181): `{ type: 'xmpPacket' }` added for XMP segment tracking. Exhaustive patterns on `MetadataSegmentSource` will need updating.
37
+
38
+ ### Security
39
+
40
+ - **XMP regex ReDoS protection** (#181): Add 64KB size limit on XMP text input to prevent exponential backtracking on malformed XML
41
+ - **XML entity decoder hardening** (#181): Catch `RangeError` from `String.fromCodePoint` on invalid Unicode code points in XMP entities
42
+ - **JPEG COM segment overflow guard** (#181): Add 64KB size limit check to `buildComSegment`, matching the existing guard on `buildXmpApp1Segment`
43
+
44
+ ### Maintenance
45
+
46
+ - Update development dependencies
47
+
8
48
  ## [2.1.1] - 2026-02-24
9
49
 
10
50
  ### Fixed
@@ -380,6 +420,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
380
420
  - Biome for code formatting and linting
381
421
  - CONTRIBUTING.md for community contributions
382
422
 
423
+ [2.2.0]: https://github.com/enslo/sd-metadata/releases/tag/core@2.2.0
383
424
  [2.1.1]: https://github.com/enslo/sd-metadata/releases/tag/core@2.1.1
384
425
  [2.1.0]: https://github.com/enslo/sd-metadata/releases/tag/v2.1.0
385
426
  [2.0.1]: https://github.com/enslo/sd-metadata/releases/tag/v2.0.1
package/README.ja.md CHANGED
@@ -1,4 +1,4 @@
1
- # sd-metadata
1
+ # @enslo/sd-metadata
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@enslo/sd-metadata.svg)](https://www.npmjs.com/package/@enslo/sd-metadata)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@enslo/sd-metadata.svg)](https://www.npmjs.com/package/@enslo/sd-metadata)
@@ -6,6 +6,8 @@
6
6
 
7
7
  🌐 **[English version](./README.md)**
8
8
 
9
+ 🔗 **[ライブデモ](https://sd-metadata.pages.dev/)**
10
+
9
11
  AI生成画像に埋め込まれたメタデータを読み書きするためのTypeScriptライブラリです。
10
12
 
11
13
  ## 特徴
@@ -45,6 +47,7 @@ npm install @enslo/sd-metadata
45
47
  | [Fooocus](https://github.com/lllyasviel/Fooocus) | ⚠️ | ⚠️ | ⚠️ |
46
48
  | [Ruined Fooocus](https://github.com/runew0lf/RuinedFooocus) | ✅ | 🔄️ | 🔄️ |
47
49
  | [Easy Diffusion](https://github.com/easydiffusion/easydiffusion) | ⚠️ | ⚠️ | ⚠️ |
50
+ | [Draw Things](https://drawthings.ai/) | ⚠️ | ⚠️ | ⚠️ |
48
51
 
49
52
  **凡例:**
50
53
 
@@ -145,7 +148,7 @@ fileInput.addEventListener('change', async (e) => {
145
148
  // ==UserScript==
146
149
  // @name My Script
147
150
  // @namespace https://example.com
148
- // @require https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@2.1.1/dist/index.global.js
151
+ // @require https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@2.3.0/dist/index.global.js
149
152
  // ==/UserScript==
150
153
 
151
154
  const response = await fetch(imageUrl);
@@ -362,7 +365,8 @@ if (text) {
362
365
  **パラメータ:**
363
366
 
364
367
  - `input` - 画像ファイルデータ(PNG、JPEG、またはWebP)
365
- - `options` - オプションの読み込み設定(詳細は[型ドキュメント](./docs/types.ja.md)を参照)
368
+ - `options` - オプションの読み込み設定
369
+ - `strict?: boolean`(デフォルト: `false`)— `true` の場合、寸法(`width` / `height`)はメタデータからのみ取得します。`false` の場合、メタデータに寸法がなければ画像ヘッダーから取得します。
366
370
 
367
371
  **戻り値:**
368
372
 
@@ -557,7 +561,8 @@ type GenerationSoftware =
557
561
  | 'novelai' | 'comfyui' | 'swarmui' | 'tensorart' | 'stability-matrix'
558
562
  | 'sd-webui' | 'forge' | 'forge-classic' | 'forge-neo'
559
563
  | 'reforge'| 'easy-reforge' | 'sd-next' | 'civitai' | 'hf-space'
560
- | 'invokeai' | 'easydiffusion' | 'fooocus' | 'ruined-fooocus';
564
+ | 'invokeai' | 'easydiffusion' | 'fooocus' | 'ruined-fooocus'
565
+ | 'draw-things';
561
566
  ```
562
567
 
563
568
  ### `EmbedMetadata`
package/README.md CHANGED
@@ -1,10 +1,12 @@
1
- # sd-metadata
1
+ # @enslo/sd-metadata
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@enslo/sd-metadata.svg)](https://www.npmjs.com/package/@enslo/sd-metadata)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@enslo/sd-metadata.svg)](https://www.npmjs.com/package/@enslo/sd-metadata)
5
5
  [![license](https://img.shields.io/npm/l/@enslo/sd-metadata.svg)](https://github.com/enslo/sd-metadata/blob/main/LICENSE)
6
6
 
7
- 🇯🇵 **[日本語版はこちら](./README.ja.md)**
7
+ 🌐 **[日本語版はこちら](./README.ja.md)**
8
+
9
+ 🔗 **[Live Demo](https://sd-metadata.pages.dev/)**
8
10
 
9
11
  A TypeScript library to read and write metadata embedded in AI-generated images.
10
12
 
@@ -45,6 +47,7 @@ npm install @enslo/sd-metadata
45
47
  | [Fooocus](https://github.com/lllyasviel/Fooocus) | ⚠️ | ⚠️ | ⚠️ |
46
48
  | [Ruined Fooocus](https://github.com/runew0lf/RuinedFooocus) | ✅ | 🔄️ | 🔄️ |
47
49
  | [Easy Diffusion](https://github.com/easydiffusion/easydiffusion) | ⚠️ | ⚠️ | ⚠️ |
50
+ | [Draw Things](https://drawthings.ai/) | ⚠️ | ⚠️ | ⚠️ |
48
51
 
49
52
  **Legend:**
50
53
 
@@ -145,7 +148,7 @@ For userscripts (Tampermonkey, Violentmonkey, etc.), load the IIFE build via `@r
145
148
  // ==UserScript==
146
149
  // @name My Script
147
150
  // @namespace https://example.com
148
- // @require https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@2.1.1/dist/index.global.js
151
+ // @require https://cdn.jsdelivr.net/npm/@enslo/sd-metadata@2.3.0/dist/index.global.js
149
152
  // ==/UserScript==
150
153
 
151
154
  const response = await fetch(imageUrl);
@@ -359,7 +362,8 @@ Reads and parses metadata from an image file.
359
362
  **Parameters:**
360
363
 
361
364
  - `input` - Image file data (PNG, JPEG, or WebP)
362
- - `options` - Optional read options (see [Type Documentation](./docs/types.md) for details)
365
+ - `options` - Optional read options
366
+ - `strict?: boolean` (default: `false`) — When `true`, dimensions (`width` / `height`) are taken strictly from metadata only. When `false`, missing dimensions are extracted from image headers.
363
367
 
364
368
  **Returns:**
365
369
 
@@ -557,7 +561,8 @@ type GenerationSoftware =
557
561
  | 'novelai' | 'comfyui' | 'swarmui' | 'tensorart' | 'stability-matrix'
558
562
  | 'sd-webui' | 'forge' | 'forge-classic' | 'forge-neo'
559
563
  | 'reforge'| 'easy-reforge' | 'sd-next' | 'civitai' | 'hf-space'
560
- | 'invokeai' | 'easydiffusion' | 'fooocus' | 'ruined-fooocus';
564
+ | 'invokeai' | 'easydiffusion' | 'fooocus' | 'ruined-fooocus'
565
+ | 'draw-things';
561
566
  ```
562
567
 
563
568
  ### `EmbedMetadata`