Comfy-Org / Comfy-Org/ComfyUI_frontend
refactor: consolidate metadata parsers out of pnginfo.ts and audit public API surface
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 704
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 512
Description
## Background
Currently, metadata parsers are split awkwardly between two locations:
- Most parsers live under `src/scripts/metadata/`
- PNG parsing and WebP parsing both live in `src/scripts/pnginfo.ts`
The reason `pnginfo.ts` exists in `src/scripts` is that files there are exposed to extensions and are technically part of the public API.
Raised in: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11307#discussion_r3104349019
Requested by: @christian-byrne
---
## Proposed Steps
### 1. Move parsers into `src/scripts/metadata/`
- Move WebP/EXIF parsing logic from `src/scripts/pnginfo.ts` → `src/scripts/metadata/riff.ts` (new file)
- Move PNG parsing from `src/scripts/pnginfo.ts` → `src/scripts/metadata/png.ts` (already partially done)
### 2. Keep `pnginfo.ts` as a re-export shim
- After moving logic, `pnginfo.ts` should contain only import + re-export statements for backwards compatibility with custom nodes.
### 3. Audit ecosystem usage
- Use the ComfyUI code search (https://cs.comfy.org/search) to check whether any extensions are directly importing from `src/scripts/metadata/`.
- **If no extensions import from `src/scripts/metadata/`:** Move the entire metadata domain out of `src/scripts/` and into `src/base/` (non-public), since it would not be part of the exposed API surface.
- **If a small number of extensions do import from `src/scripts/metadata/`:** Keep those specific modules in place but add import/export redirect shims and add `console.warn` deprecation notices at module scope directing consumers to the new paths.
---
## Goals
- Cleaner separation between public (`src/scripts/`) and internal (`src/base/`) code
- All metadata parsers consolidated under a single `metadata/` directory
- Backwards compatibility maintained for custom nodes via re-exports and/or deprecation warnings
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11354-refactor-consolidate-metadata-parsers-out-of-pnginfo-ts-and-audit-public-API-surface-3466d73d365081ef8e42c3880c6cecc7) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.