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

@indy-center/adapter-cloudflare

v7.2.8-indy.3

Published

Fork of @sveltejs/adapter-cloudflare — Workers-only, fixes worker output path so users can bring their own entrypoint for scheduled handlers, RPC, etc.

Readme

@indy-center/adapter-cloudflare

Fork of @sveltejs/adapter-cloudflare v7.2.8, Workers-only. Fixes the worker output path so users can bring their own src/worker.ts entrypoint for scheduled handlers, RPC WorkerEntrypoint exports, and any other Cloudflare Worker handlers alongside the SvelteKit fetch handler.

License: MIT

What's different

Pages support is removed. This adapter is Workers-only. If you need Cloudflare Pages, use the upstream @sveltejs/adapter-cloudflare.

Worker output path is fixed. Upstream uses wrangler.jsonc's main field as both the build output destination and the deploy entry point, which means any custom main value gets clobbered on vite build. This fork always writes to .svelte-kit/cloudflare/_worker.js regardless of main, so you can safely point main at your own wrapper. This is the fix proposed in sveltejs/kit#14029 and will land properly in Kit 3.

Usage

npm install -D @indy-center/adapter-cloudflare
// svelte.config.js
import adapter from "@indy-center/adapter-cloudflare";

export default {
  kit: { adapter: adapter() },
};

Set main in wrangler.jsonc to your own worker wrapper:

{
  "main": "src/worker.ts",
  "assets": {
    "binding": "ASSETS",
    "directory": ".svelte-kit/cloudflare",
  },
}
// src/worker.ts
import sv from "../.svelte-kit/cloudflare/_worker.js";
import { WorkerEntrypoint } from "cloudflare:workers";

export default {
  fetch: sv.fetch,

  async scheduled(event, env, ctx) {
    // cron logic here
  },
} satisfies ExportedHandler<Env>;

// optional — exposes RPC methods to other Workers via service bindings
export class Website extends WorkerEntrypoint<Env> {
  async myMethod() { ... }
}

Typing env

ambient.d.ts declares a global Env (and App.Platform.env: Env) that picks up bindings from Cloudflare.Env. Augment Cloudflare.Env in your project to type your specific bindings:

// src/app.d.ts
declare global {
  namespace Cloudflare {
    interface Env {
      DB: D1Database;
      MY_KV: KVNamespace;
    }
  }
  // ...your App.Locals etc.
}

export {};

This is necessary because the file generated by wrangler types (worker-configuration.d.ts) does not reliably merge into the global Cloudflare.Env interface in SvelteKit projects. Declaring bindings in app.d.ts is the workaround.

Using $env/dynamic/* from worker code

Your src/worker.ts (and anything it imports) is bundled by wrangler's esbuild, not vite — so SvelteKit's $env/dynamic/private and $env/dynamic/public virtual modules don't resolve. The adapter ships a runtime shim with the same { env } shape; alias $env/dynamic/* to it in wrangler.jsonc and call setEnv from your worker entrypoint before invoking any code that reads from it:

// wrangler.jsonc
{
  "alias": {
    "$env/dynamic/private": "@indy-center/adapter-cloudflare/env-shim",
    "$env/dynamic/public": "@indy-center/adapter-cloudflare/env-shim",
  },
}
// src/worker.ts
import { setEnv } from "@indy-center/adapter-cloudflare/env-shim";
import sv from "../.svelte-kit/cloudflare/_worker.js";

export default {
  fetch: sv.fetch,
  async scheduled(_event, env, _ctx) {
    setEnv(env as unknown as Record<string, string | undefined>);
    // ...now `$env/dynamic/*` reads inside imported modules work
  },
} satisfies ExportedHandler<Env>;

Vite ignores wrangler's alias block, so SvelteKit routes keep using the real $env plugin untouched.

Testing scheduled handlers locally

Miniflare doesn't auto-fire cron triggers. Start wrangler with the test flag and hit the endpoint manually:

npx wrangler dev --test-scheduled
curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"

Project layout

  • src/worker.js — source for the bundled SvelteKit worker template.
  • files/worker.js — pre-built output of src/worker.js; copied into the SvelteKit build by the adapter.
  • index.js — adapter implementation.
  • utils.js — wrangler config validation.
  • index.d.ts — TypeScript types for adapter options.
  • ambient.d.ts — global App.Platform, Env, and Cloudflare.Env type augmentation.
  • env-shim.js / env-shim.d.ts — runtime shim for $env/dynamic/* when bundled by wrangler.

Local development

npm install
npm run build        # rebuild files/worker.js from src/worker.js
npm run format       # prettier
npm run format:check

Deployment

npm publish

prepublishOnly runs build and format:check automatically. Requires publish access to the @indy-center npm org.

Upstream tracking

Based on @sveltejs/adapter-cloudflare v7.2.8. To pick up upstream changes, diff packages/adapter-cloudflare in the sveltejs/kit repo against the version noted above and apply relevant patches. This fork exists as a stopgap until Kit 3 ships proper support for custom worker entrypoints.

Disclaimer

We are not affiliated with the FAA or any aviation governing body. This software is for flight simulation use on the VATSIM network.