Legacy JS libraries
Semantic standard and registry for third-party UMD/IIFE scripts in Chroma apps — distinct from @chroma plugins.
Some Chroma apps still depend on classic global scripts (Chart.js, dayjs, lodash, and similar) that predate ESM-first app code in .chr files. Those libraries are not Chroma plugins: they do not ship chroma.plugin.json, lifecycle hooks, or loadPlugins() integration.
This section defines a shared registry and a chroma.json declaration so teams can:
- Pin versions and vendor paths consistently across internal apps
- Document CDN fallbacks for offline dev or air-gapped deploys
- Align static-mode
build.scriptsandindex.htmlinjection without ad-hoc copy-paste
Architecture: The native CLI tree Chroma/cli/legacy-libs/ is the single source for registry.json, plugins-registry.json, schemas, and the maintainer vendor mirror; repo-root chroma-legacy-libs/ is redirect-only.
Plugins vs legacy libs: Plugins are first-party or @chroma/* ESM packages under plugins/<id>/. Legacy libraries are third-party globals loaded before (or beside) the Chroma engine bundle. Prefer ESM imports and small wrappers when you can; use this standard when porting existing jQuery-era code.
Contents
| Page | Purpose |
|---|---|
| Standard | Field definitions, chroma.json shape, load hooks, vendoring workflow |
| Catalog | Six third-party UMD globals — registry IDs, versions, and chroma add install commands |
CLI (chroma add) | Vendor UMD globals into vendor/ and legacyLibraries[] — use chroma install for plugins |
| Registry (repo) | Chroma/cli/legacy-libs/registry.json — UMD globals (bundled with CLI) |
| Plugin sync registry | Chroma/cli/legacy-libs/plugins-registry.json — maintainer sync for plugins/ |
| JSON Schema | legacy-lib-registry.schema.json |
Quick declare
Add entries to chroma.json (validated by chroma.schema.json):
{
"name": "my-app",
"mode": "dynamic",
"legacyLibraries": [
{ "id": "dayjs", "source": "vendor" },
{ "id": "chartjs", "source": "cdn", "version": "4.4.1" }
]
}Resolve id against the registry, copy files under vendor/ when using source: "vendor", or let tooling emit <script src="…"> tags from cdn.primary and cdn.fallbacks. CLI automation for injection is incremental; the contract is stable so validators and docs can ship first.
Related docs
- JSON Schemas —
chroma.jsonand published schema catalog - Plugins — ESM plugin model (
chroma.plugin.json) .chrformat — preferred app source for new UI