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

@flare-engine/pathfinding

v0.4.12

Published

A* grid pathfinding, Jump Point Search, and navmesh for 2D scenes and apps

Readme

@flare-engine/pathfinding

Grid pathfinding — A* (findPath), Jump-Point Search (findPathJPS) for uniform-cost grids (a weighted grid delegates to A*, see below), and a polygon navmesh fallback (findNavMeshPath). Pure data, no classes. Heuristics (manhattanDistance, octileDistance, chebyshevDistance, euclideanDistance) are exported as named functions for tree-shake.

Status: beta — no production consumer yet. Every other @flare-engine/* package is exercised by a shipping game; this one is not. The API is covered by tests and the algorithms are correct for the cases below, but it has not been through the shakedown that real use provides. Treat signatures as stable and behaviour as less battle-tested than the rest of the scope.

findPath and findPathJPS disagree about corner cutting

They are not drop-in replacements for each other. Given a diagonal step whose two shared cardinal neighbours are both blocked:

. X .     start (0,0), goal (1,1)
X . .     findPath      → null   (refuses to squeeze the corner)
. . .     findPathJPS   → [{x:0,y:0},{x:1,y:1}]   (takes the diagonal)

findPath requires both cardinal neighbours of a diagonal to be walkable; findPathJPS does not. Swapping one for the other to gain speed therefore changes movement semantics, and on a map with tight diagonal gaps it changes which routes exist at all. Pinned by tests in tests/jps.test.ts. If your game's collision shape is a circle or box wider than a point, you almost certainly want findPath's rule.

findPathJPS on weighted grids

JPS pruning is only correct when every walkable tile costs 1. If any tile's cost is above 1, findPathJPS detects it with one linear scan of grid.data and delegates the call to findPath with diagonal: true, forwarding maxIterations and heuristic. The result is a cost-correct weighted A* path — with A*'s corner-cutting rule above, not JPS's — never a JPS path that ignored the costs. A grid whose tiles all share a cost above 1 (createGrid({ defaultCost: 2 })) delegates on every call too: same path as JPS, cost doubled to the true weighted total, and no JPS speed-up. Keep every cost at 1 to get the JPS speed-up.

Install

bun add @flare-engine/pathfinding

Usage

import { createGrid, setWalkable, findPathJPS, octileDistance } from '@flare-engine/pathfinding';

const grid = createGrid({ width: 32, height: 32 });
setWalkable(grid, 5, 5, false);

const result = findPathJPS(grid, 0, 0, 30, 30, {
  heuristic: octileDistance,
});
if (result !== null) console.log(result.path);

See API spec.

License

Apache-2.0