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

wolpi-pattern-resolver

v0.1.0

Published

An extension for the Wolpi IIIF image server that uses regular expressions to resolve identifiers to images.

Downloads

122

Readme

Wolpi Pattern Resolver

An extension for the Wolpi IIIF image server that resolves identifiers to image files by checking them against a set of regular expressions and corresponding substitutions.

It allows you to define a list of regular expression patterns with one or more substitutions. These are then used for resolving identifiers to a path on the local file system or a remote HTTP endpoint. You can specify multiple substitutions - the resolving extension will then verify if the corresponding resource actually exists and return the first matching substitution. If multiple pattern/substitution groups are defined, the first matching substitution (according to their order in the configuration) will be used as the resolving result.

Usage

Create a directory called images in your working directory and save the image file wolpi.png to it.

Configure the resolving extension in your wolpi.yml:

extensions:
  - npm:
      pkg: "wolpi-pattern-resolver"
      version: "0.1.0"
    config:
      resolvingPatterns:
        - pattern: ^test-(\w+)$
          substitutions:
            - '/images/$1.tif'
            - '/images/$1.jpg'
            - '/images/$1.png'

Start the Wolpi container, mounting the image directory and your custom wolpi.yml:

docker run -p 8080:8080 \
    -v "./wolpi.yml:/app/wolpi.yml" \
    -v "./images:/images" \
    ghcr.io/dbmdz/wolpi:latest

You can now access the image at http://localhost:8080/v3/test-wolpi/full/max/0/default.jpg.

Development

Live Reload

Install dependencies:

npm install

Watch source files for changes and recompile if necessary:

npm run dev

Configure live reloading and resolving patterns for your extension in wolpi.yml:

extensions:
  - path: /app/extensions/resolving/
    live-reload: true
    config:
      resolvingPatterns:
        - pattern: ^(\w{3}\d{8})_(\d{5})$
          substitutions:
            - '/images/$1/original/$1_$2.tif'
            - '/images/$1/300/$1_$2.jpg'
            - '/images/$1/150/$1_$2.jpg'

Start Wolpi container, mounting compiled package files and image directory as well as custom wolpi.yml:

docker run -p 8080:8080 \
    -v "./src:/app/extensions/resolving/src" \
    -v "./package.json:/app/extensions/resolving/package.json" \
    -v "./wolpi.yml:/app/wolpi.yml" \
    -v "./images:/images" \
    ghcr.io/dbmdz/wolpi:latest

Debugging

Additionally enable debugging in your wolpi.yml and make sure that the path to your extension in the container exactly matches the path on your local machine:

extension-debug:
    enabled: true
    host: 0.0.0.0
    port: 4711
    suspend: false
    waitAttached: false

extensions:
  - path: /my/local/path/to/wolpi-resolving-extension/
    live-reload: true
    config:
      resolvingPatterns:
        - pattern: ^(\w{3}\d{8})_(\d{5})$
          substitutions:
            - '/images/$1/original/$1_$2.tif'
            - '/images/$1/300/$1_$2.jpg'
            - '/images/$1/150/$1_$2.jpg'

Start the Wolpi container, mounting compiled package files and image directory as well as your custom wolpi.yml. This time, we also expose the debugging port 4711 and we mount the package to the same path as on our local machine:

docker run -p 8080:8080 \
    -p 4711:4711 \
    -v "./src:$(realpath ./src)" \
    -v "./package.json:$(realpath ./package.json)" \
    -v "./wolpi.yml:/app/wolpi.yml" \
    -v "./images:/images" \
    ghcr.io/dbmdz/wolpi:latest

Attach to the debugging server as described in the Wolpi documentation and make sure to set your breakpoints in the compiled javascript file (src/index.js).

Testing

Run tests:

npm run test

The wolpi and Java globals as well as the modules wolpi:fs and wolpi:fetch, which are provided by Wolpi at runtime, are mocked in ./test/setup.ts.

License

MIT