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

foundryvtt-sync

v2.2.2

Published

A cross-bundler plugin to sync FoundryVTT compendiums with your file system. Supports Vite, Rollup, Webpack, and esbuild.

Readme

FoundryVTT-Sync

A cross-bundler plugin to sync FoundryVTT compendiums with your file system. Supports Vite, Rollup, Webpack, and esbuild.

Installation

npm install --save-dev foundryvtt-sync
# or
bun add -d foundryvtt-sync
# or
pnpm add -D foundryvtt-sync

Usage

Vite (Recommended)

The Vite integration includes full dev server support with HMR and WebSocket communication.

// vite.config.ts
import { defineConfig } from 'vite';
import foundryvttSync from 'foundryvtt-sync/vite';
import moduleJSON from './module.json' with { type: 'json' };

export default defineConfig({
  plugins: [
    foundryvttSync(moduleJSON, {
      dataDirectory: 'data',
      outputDirectory: 'packs',
    }),
  ],
});

Rollup

// rollup.config.mjs
import foundryvttSync from 'foundryvtt-sync/rollup';
import moduleJSON from './module.json' with { type: 'json' };

export default {
  input: 'src/index.js',
  output: {
    dir: 'dist',
    format: 'es',
  },
  plugins: [
    foundryvttSync(moduleJSON, {
      dataDirectory: 'data',
      outputDirectory: 'packs',
    }),
  ],
};

Webpack

// webpack.config.js
const foundryvttSync = require('foundryvtt-sync/webpack');
const moduleJSON = require('./module.json');

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
  },
  plugins: [
    foundryvttSync(moduleJSON, {
      dataDirectory: 'data',
      outputDirectory: 'packs',
    }),
  ],
};

esbuild

// build.js
import * as esbuild from 'esbuild';
import foundryvttSync from 'foundryvtt-sync/esbuild';
import { readFileSync } from 'fs';

const moduleJSON = JSON.parse(readFileSync('./module.json'));

await esbuild.build({
  entryPoints: ['src/index.js'],
  bundle: true,
  outfile: 'dist/bundle.js',
  plugins: [foundryvttSync(moduleJSON)],
});

Backwards Compatible Import

The default export is still available for backwards compatibility:

// vite.config.ts
import vttSync from 'foundryvtt-sync'; // Returns Plugin[] for Vite
import moduleJSON from './module.json' with { type: 'json' };

export default {
  plugins: [
    ...vttSync(moduleJSON, { dataDirectory: 'data' }),
  ],
};

Options

interface PluginOptions {
  // Your root JSON directory (default: "data")
  dataDirectory?: string;
  // Your root Foundry DB directory (default: "packs")
  outputDirectory?: string;
  // Runs on the server. Returning false invalidates the entry.
  transformer?: (doc: Document["_source"]) => Promise<void> | void | Promise<false> | false;
}

What Does It Do?

The plugin comes in two parts:

  1. Dev Server (Vite only): During development, it syncs any changes made in your module compendiums to your local file system. Any updates you make to the compendium are immediately exported to the module files you are working on. This connection is two-way — you can also do quick edits inside your editor and it will be reflected in Foundry!

  2. Build: During build, it compiles the JSON files using foundryvtt-cli into the LevelDB database directories.

Isn't This Unsafe?

The plugin does not access the underlying database at all! Instead, it uses websockets to prompt Foundry to update the documents using its own connection, or export the JSON and send it back to Vite to update the module data.

Why?

So you don't have to manually disable the module in order to update your local files, if not outright forgetting to run your extract-packs script. This package also takes care of making the JSON → LevelDB build step for you.

Bundler Support Matrix

| Feature | Vite | Rollup | Webpack | esbuild | |---------|------|--------|---------|---------| | Pack compilation | ✅ | ✅ | ✅ | ✅ | | Code transform | ✅ | ✅ | ✅ | ✅ | | Define globals | ✅ | ✅ | ✅ | ✅ | | Dev server HMR | ✅ | ❌ | ❌ | ❌ | | WebSocket sync | ✅ | ❌ | ❌ | ❌ |

Types

The plugin requires the module JSON file, easily importable in Node.js:

import moduleJSON from './module.json' with { type: 'json' };

You may also use an object with an id string ({ id: string }), but this may be expanded upon in the future.

License

MIT