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

circuit-json-to-lbrn

v0.0.23

Published

Convert Circuit JSON to LBRN XML for PCB fabrication via laser ablation.

Readme

circuit-json-to-lbrn

Convert Circuit JSON to LBRN XML for PCB fabrication via laser ablation.

Usage

import { convertCircuitJsonToLbrn } from "circuit-json-to-lbrn"

// Generate copper layer only
const copperLbrn = convertCircuitJsonToLbrn(circuitJson, {
  includeCopper: true,
  includeSoldermask: false,
})

// Generate soldermask layer only (for cutting polyimide sheet)
const soldermaskLbrn = convertCircuitJsonToLbrn(circuitJson, {
  includeCopper: false,
  includeSoldermask: true,
})

// Generate both layers together in one file
const bothLbrn = convertCircuitJsonToLbrn(circuitJson, {
  includeCopper: true,
  includeSoldermask: true,
})

// Default behavior (copper only, backward compatible)
const defaultLbrn = convertCircuitJsonToLbrn(circuitJson)

Options

  • includeCopper?: boolean - Include copper traces and pads (default: true)
  • includeSoldermask?: boolean - Include soldermask openings for cutting polyimide sheet (default: false)
  • includeSilkscreen?: boolean - Include silkscreen layer (not implemented yet)
  • origin?: { x: number; y: number } - Set the origin point for the conversion
  • margin?: number - Set the margin around the PCB
  • traceMargin?: number - Clearance margin around traces in mm (requires includeCopper: true)
  • laserSpotSize?: number - Laser spot size in mm for crosshatch spacing (default: 0.005)
  • includeLayers?: Array<"top" | "bottom"> - Specify which layers to include (default: ["top", "bottom"])

Soldermask Support

The includeSoldermask flag enables generation of soldermask openings for cutting Kapton tape (polyimide sheet). When enabled:

  • SMT pads and plated holes will have soldermask openings
  • Traces are NOT included in the soldermask layer (to avoid accidental bridging during soldering)
  • Holes are always cut through the board regardless of the mode
  • Soldermask shapes are filled (Scan mode) instead of outlined, which is required for laser-cutting Kapton tape masks where the laser needs to remove material from the pad areas

Laser Cutting Workflow

The soldermask layer uses LightBurn's "Scan" mode with filled shapes. This is designed for the following workflow:

  1. Generate LBRN file: Use includeSoldermask: true to export filled pad shapes
  2. Laser cut Kapton tape: The laser will fill/ablate the pad areas.

You can generate:

  • Copper only: { includeCopper: true, includeSoldermask: false } - Traditional copper cutting
  • Soldermask only: { includeCopper: false, includeSoldermask: true } - Just Kapton tape (polyimide) cutting patterns (filled shapes)
  • Both: { includeCopper: true, includeSoldermask: true } - Complete fabrication file with both layers

Trace Margin Support

The traceMargin option enables smart trace rasterization for creating clearance zones around traces. This is essential for laser PCB fabrication to ensure proper electrical isolation between traces.

How it works

When traceMargin is specified:

  1. Generates trace geometries at normal width (inner trace union)
  2. Generates trace geometries at width + 2×traceMargin (outer trace union)
  3. Calculates clearance area = outer - inner
  4. Outputs clearance area as filled shapes using Scan mode with crosshatch pattern

The crosshatch pattern ablates copper in the margin area, with line spacing determined by laserSpotSize.

Example

const lbrn = convertCircuitJsonToLbrn(circuitJson, {
  includeCopper: true,
  traceMargin: 0.2,      // 0.2mm clearance around traces
  laserSpotSize: 0.005,  // 0.005mm spot size (crosshatch spacing)
})

This will:

  • Cut trace outlines (vector mode)
  • Fill 0.2mm margin zones around traces with crosshatch pattern (scan mode)
  • Use 0.005mm spacing for the crosshatch lines

Note: traceMargin requires includeCopper: true and will throw an error if copper is disabled.