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 🙏

© 2025 – Pkg Stats / Ryan Hefner

zone5

v1.3.1

Published

Image gallery system for SvelteKit with optimized image processing, lightbox functionality, and MDX support.

Readme

Zone5

Image gallery system for SvelteKit with optimized image processing, lightbox functionality, and MDX support.

Features

  • 🖼️ Optimized image processing with variants, blurhash, and color extraction
  • 🔍 Lightbox component with keyboard navigation
  • 📝 MDX integration for markdown-based galleries
  • 🎨 Tailwind CSS 4 support
  • ⚡ Vite plugin for automatic image processing
  • 🛠️ CLI tool for quick project scaffolding

CLI Tool

The zone5 CLI tool helps you quickly create a new SvelteKit gallery project:

npx zone5 create <input-folder> <output-folder> [options]

Options

  • -m, --mode <type> - How to handle images: copy, link, or move (default: copy)
  • -p, --package-manager <pm> - Package manager: npm, pnpm, yarn, bun, or skip (default: npm)
  • --no-interactive - Skip prompts and use defaults

Example

npx zone5 create ./my-photos ./my-gallery --package-manager pnpm

Usage in SvelteKit Projects

Installation

npm install zone5

Basic Setup

  1. Add the Vite plugin to your vite.config.ts:
import { sveltekit } from '@sveltejs/kit/vite';
import { zone5 } from 'zone5/vite';
import { defineConfig } from 'vite';

export default defineConfig({
 plugins: [zone5(), sveltekit()],
});
  1. Wrap your layout with Zone5Provider:
<script>
 import { Zone5Provider } from 'zone5/components';
</script>

<Zone5Provider>
 <slot />
</Zone5Provider>
  1. Create a .zone5.toml config file:
[base]
root = "src/routes"
cache = ".zone5"
namespace = "@zone5"

[processor]
widths = [400, 800, 1200, 1600, 2400]

Using in Components

<script>
 import { Zone5 } from 'zone5/components';

 import image1 from './photo1.jpg?z5';
 import image2 from './photo2.jpg?z5';
</script>

<Zone5 images={[image1, image2]} />

Using in Markdown/MDX

Add the remark plugin to your svelte.config.js:

import { remarkZ5Images } from 'zone5/remark';
import { mdsvex } from 'mdsvex';

export default {
 preprocess: [
  mdsvex({
   extensions: ['.md'],
   remarkPlugins: [remarkZ5Images],
  }),
 ],
};

Then simply reference images with the ?z5 query parameter:

![Mountain view](./mountains.jpg?z5)
![Beach sunset](./beach.jpg?z5)

Development

Prerequisites

  • Node.js 18+
  • pnpm (recommended package manager)

Getting Started

# Install dependencies
pnpm install

# Run development server
pnpm dev

# Run tests in watch mode
pnpm test --watch

# Type check
pnpm check

Project Structure

src/
├── lib/                    # Main library code
│   ├── components/         # Svelte components
│   ├── processor/          # Image processing pipeline
│   ├── vite.ts            # Vite plugin
│   ├── remark.ts          # Remark MDX plugin
│   └── config.ts          # Configuration loader
├── cli/                   # CLI tool
└── routes/                # Demo/documentation site

Testing

The project uses a comprehensive test suite organized by purpose:

pnpm test - Unit Tests (⚡ ~2.7s)

Fast unit tests for core functionality:

  • Component tests (portal)
  • Processor tests (blurhash, color, variants, exif)
  • Remark plugin tests

Use this during development for quick feedback on code changes.

To run a single test file:

pnpm vitest src/lib/processor/blurhash.test.ts

pnpm test:ui - Integration UI Tests

Playwright tests on the local project (currently placeholder for future tests).

pnpm test:cli - CLI Integration Tests (~47.8s)

Integration tests for CLI functionality:

  • Project creation and configuration
  • Package manager support (npm, pnpm, yarn, bun)
  • Template file generation
  • Utility functions

Run this before committing CLI-related changes.

pnpm test:e2e - End-to-End Tests (~24.1s)

Playwright E2E tests that validate the complete workflow:

  • Creates a new project using the CLI
  • Builds the generated project
  • Tests the lightbox UI functionality
  • Validates Tailwind CSS integration

Run this to verify the complete user experience.

pnpm test:all - All Tests (~74.6s)

Runs all test suites in sequence: unit → CLI → E2E.

Run this before releases to ensure everything works together.

Build Commands

pnpm dev           # Watch mode for development (full demo site)
pnpm build         # Build the package (runs svelte-package + CLI build + publint)
pnpm build:cli     # Build just the CLI tool
pnpm build:watch   # Build the package in watch mode
pnpm check         # Type checking with svelte-check
pnpm check:watch   # Type checking in watch mode
pnpm lint          # Run ESLint

Architecture Overview

Zone5 consists of four main components:

  1. Image Processor (src/lib/processor/) - Uses Sharp to generate image variants, extract EXIF data, create blurhashes, and determine dominant colors. Results are cached in .zone5/ directory.

  2. Vite Plugin (src/lib/vite.ts) - Intercepts .jpg?z5 imports at build time, processes images, and serves them during development.

  3. Remark Plugin (src/lib/remark.ts) - Transforms markdown images with ?z5 query parameters into Zone5 Svelte components.

  4. Component System (src/lib/components/) - Svelte 5 components with a centralized registry for managing lightbox state and navigation across multiple galleries.

See CLAUDE.md for detailed architecture documentation.

Contributing

  1. Make your changes
  2. Run pnpm test to ensure unit tests pass
  3. Run pnpm check to verify types
  4. Run pnpm lint to check code style
  5. If you changed the CLI, run pnpm test:cli
  6. Before submitting, run pnpm test:all to validate everything

Commit Messages:

This project uses Conventional Commits. Commit messages are validated via Husky hooks.

Format: <type>: <description>

Valid types: feat, fix, docs, style, refactor, test, chore

Examples:

  • feat: add lightbox keyboard navigation
  • fix: resolve EXIF parsing error
  • docs: update installation instructions

License

MIT