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

@cas8398/bridge-cli

v1.0.1

Published

Write logic once in .bridge and compile to PHP, TypeScript, and Node.js.

Readme

🌉 Bridge CLI

Write your logic once. Compile it everywhere.

Bridge lets you define business logic in a clean .bridge syntax and compile it into PHP (Laravel), TypeScript, and Node.js (ESM) — all from a single source of truth.

npm License: MIT


Table of Contents


Installation

npm install -g @cas8398/bridge-cli

Verify the install:

bridge --help

Quick Start

# 1. Create a new project
bridge new my-app
cd my-app

# 2. Edit your logic
# src/logic.bridge is created automatically — open it and define your functions

# 3. Compile to all targets
bridge build

After bridge build, your outputs land in .bridge/:

my-app/
├── .bridge/
│   ├── php/        ← Laravel-ready PHP class
│   ├── ts/         ← TypeScript with typed signatures
│   └── node/       ← Node.js ESM module
├── bridge.config.json
└── src/
    └── logic.bridge

Commands

| Command | Description | | ------------------------- | ----------------------------------------------------------- | | bridge new <name> | Scaffold a new Bridge project | | bridge build | Compile all .bridge files in src/ to configured targets | | bridge to-bridge <file> | Reverse-compile a PHP or TS file back into .bridge syntax | | bridge help | Show available commands |


The .bridge Syntax

Bridge uses a TypeScript-like syntax with a small set of familiar types.

function calculateTotal(price: float, tax: float): float {
  let total = price * (1 + tax)
  return total
}

Supported types

| Bridge type | PHP | TypeScript / Node | | ----------- | -------- | ----------------- | | float | float | number | | int | int | number | | string | string | string | | bool | bool | boolean |


Configuration

bridge.config.json controls what gets compiled and where:

{
  "src": "src",
  "outDir": ".bridge",
  "targets": ["php", "ts", "node"],
  "preserveName": true
}

| Field | Default | Description | | -------------- | --------------------- | -------------------------------------------------------- | | src | "src" | Directory containing your .bridge source files | | outDir | ".bridge" | Output directory for compiled files | | targets | ["php","ts","node"] | Compile targets — any combination of php, ts, node | | preserveName | true | Keep the original filename casing in output |


Output Examples

Given this source:

// src/logic.bridge

function calculateTotal(price: float, tax: float): float {
  let total = price * (1 + tax)
  return total
}

TypeScript (.bridge/ts/logic.ts)

/**
 * Generated by Bridge from logic.bridge
 */

export function calculateTotal(price: number, tax: number): number {
  let total = price * (1 + tax);
  return total;
}

Node.js ESM (.bridge/node/logic.js)

/**
 * Generated by Bridge from logic.bridge
 * Target: Node.js (Bare JavaScript)
 */

export function calculateTotal(price, tax) {
  let total = price * (1 + tax);
  return total;
}

PHP / Laravel (.bridge/php/Logic.php)

<?php

namespace App\Bridge;

/**
 * Generated by Bridge
 */
class Logic
{
    public function calculateTotal(float $price, float $tax): float
    {
        $total = $price * (1 + $tax);
        return $total;
    }
}

Reverse Compilation

You can reverse an existing PHP or TypeScript file back into .bridge syntax:

bridge to-bridge .bridge/php/Logic.php

The reversed file lands in .bridge/to-bridge/. Move it to src/ to include it in future builds:

mv .bridge/to-bridge/Logic.bridge src/

Note: to-bridge works best on files that were originally compiled by Bridge. Hand-written PHP or TS with complex patterns may not reverse cleanly.


VS Code Extension

Get syntax highlighting and snippets for .bridge files:

👉 Bridge Language Support on the VS Code Marketplace


License

MIT