
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
calculate-packing
Advanced tools
calculate-packing is a small TypeScript library that ships the placement / packing algorithm used by the tscircuit tool-chain for automatically laying out PCB components.
The solver turns a user-supplied PackInput (components, pads & strategy
settings) into a collision-free PackOutput while
minGap)networkId close togetherInternally the algorithm:
bun add calculate-packing # or npm i / yarn add
import { pack, PackInput } from "calculate-packing"
const input: PackInput = {
components: [
{
componentId: "C1",
pads: [
{
padId: "C1_1",
networkId: "GND",
type: "rect",
offset: { x: -0.6, y: 0 },
size: { x: 1.2, y: 1 },
},
{
padId: "C1_2",
networkId: "VCC",
type: "rect",
offset: { x: +0.6, y: 0 },
size: { x: 1.2, y: 1 },
},
],
},
/* …more components… */
],
minGap: 0.25,
packOrderStrategy: "largest_to_smallest",
packPlacementStrategy: "shortest_connection_along_outline",
}
const result = pack(input)
console.log(result.components) // → positioned & rotated components
See tests/ for more elaborate examples (SVG snapshots, circuit-json fixtures).
bun install # install deps
bun test # run unit & SVG snapshot tests
bunx tsc --noEmit # type-check
• lib/PackSolver – high-level packing solver
• lib/geometry – computational-geometry helpers
• lib/math – low-level math utilities
• tests/ – unit & snapshot tests
| export | purpose |
|---|---|
pack() | run the solver |
convertPackOutputToPackInput() | strip solver-only fields |
convertCircuitJsonToPackOutput() | circuit-json → PackOutput helper |
getGraphicsFromPackOutput() | build a graphics-debug scene for review |
Everything else is internal and may change without notice.
MIT – see LICENSE.
FAQs
Calculate a packing layout with support for different strategy configurations
The npm package calculate-packing receives a total of 11,356 weekly downloads. As such, calculate-packing popularity was classified as popular.
We found that calculate-packing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.