npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lde/iiif-validator

v0.1.5

Published

Validates that a URL dereferences to a valid [IIIF Presentation](https://iiif.io/api/presentation/) Manifest. A small building block for Linked Data tooling that needs to tell a _declared_ IIIF manifest apart from one that actually resolves, parses, and l

Readme

IIIF Validator

Validates that a URL dereferences to a valid IIIF Presentation Manifest. A small building block for Linked Data tooling that needs to tell a declared IIIF manifest apart from one that actually resolves, parses, and loads in a real viewer.

import { validateManifest } from '@lde/iiif-validator';

const verdict = await validateManifest('https://example.org/manifest.json');
if (verdict.valid) {
  // verdict.reason === 'valid-manifest'
}

validateManifest never throws; every outcome is reported as a ManifestValidation:

interface ManifestValidation {
  valid: boolean;
  reason:
    | 'valid-manifest'
    | 'timeout'
    | 'network-error'
    | 'http-error'
    | 'invalid-json'
    | 'binary-content'
    | 'not-a-manifest'
    | 'does-not-load';
}

Behaviour

  • Dereference over HTTP with Accept: */*, following redirects, using the global fetch with an AbortSignal timeout (default 10 000 ms). The wildcard mirrors what real IIIF viewers send (the browser fetch default); a JSON-specific Accept would be more correct but trips up hosts that do backwards content negotiation – serving the manifest to */* while returning 404 for a JSON-specific request. Both fetch and timeoutMs are injectable via the options argument.
  • Version-aware structural check. A document is manifest-shaped when the response is HTTP 2xx, the body parses as JSON, its @context references an IIIF Presentation context, and its type/@type indicates a manifest – accepting both v3 (Manifest) and v2 (sc:Manifest). The @context value may be a string, an array, or an object; all forms are handled. The version segment of the context is accepted version-agnostically.
  • Viewer-load gate. Being manifest-shaped is not enough: a document can pass every structural check yet fail to load in the dominant Vault/@iiif/parser-based viewers (Mirador 4, Clover, Theseus), which eagerly upgrade every manifest to Presentation 3 and normalise the whole tree on load. A single structural slip – e.g. a null where an AnnotationPage belongs – crashes that pass, so the manifest renders in no such viewer. The validator reproduces that load path with @iiif/parser (upgrade() then normalize()); if it throws, the verdict is does-not-load. upgrade() is a no-op for v3, so this one path covers both v2 and v3. There are only two tiers – valid or invalid; cosmetic deviations that still load (a non-canonical rights URI, image/jpg instead of image/jpeg) stay valid.
  • Strict failure semantics, no retries. A timeout, network error, non-2xx status, unparseable body, binary media type, missing IIIF @context, wrong type, or a document that does not load all yield valid: false with the corresponding coarse reason. There is no deep JSON Schema validation and no dependency on the hosted IIIF Presentation Validator service.

Options

interface ValidateManifestOptions {
  /** `fetch` implementation to use. Injectable for testing; defaults to the global `fetch`. */
  fetch?: typeof globalThis.fetch;
  /** Per-request timeout in milliseconds. Defaults to 10 000. */
  timeoutMs?: number;
}