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

@visant/psd-engine

v0.1.0

Published

Isomorphic PSD mockup compositor — ag-psd tree → canvas (perspective warp, blend modes, raster masks, linked smart objects) + Scene Packages for client-side render.

Downloads

143

Readme

@visant/psd-engine

Isomorphic PSD mockup compositor. Takes an ag-psd layer tree and composites it to a canvas — perspective warp, blend modes, raster masks, and linked smart objects — running identically on the server (node-canvas), in the browser (DOM canvas), or in a local CLI.

It powers the Visant Labs mockup render pipeline and the Scene Package format, which pre-processes a PSD once into compact geometry + flattened layer images so the per-art render is a trivial warp + blend on any canvas (no PSD shipped to the client, minimal RAM).

The engine is a generic compositor. The value/secret is the PSD templates — which never ship inside this package.

Install

npm i @visant/psd-engine
# server-side rendering also needs the optional peers:
npm i ag-psd canvas

ag-psd and canvas are optional peer dependencies. The engine core and scene/render never import them — you inject a canvas factory (CreateCanvas). Browser builds pull in nothing extra.

Exports

| Entry | Purpose | | --- | --- | | . | composePsd, flattenLayers, replaceLinkedSmartObjects, perspectiveWarp, coverArtCanvas, BLEND_MAP, computeFaces, constants, types | | ./scene | extractScene (PSD tree → SceneDoc + layer canvases), renderScene (SceneDoc + art → canvas) | | ./adapters/node | createNodeAdapter(){ createCanvas, loadImage, toBuffer }, initializeAgPsdCanvas(agPsd) | | ./adapters/browser | createCanvas, loadImage, toBlob |

Server render (full PSD)

import { flattenLayers, replaceLinkedSmartObjects, composePsd } from '@visant/psd-engine';
import { createNodeAdapter, initializeAgPsdCanvas } from '@visant/psd-engine/adapters/node';
import * as agPsd from 'ag-psd';

const { createCanvas, loadImage, toBuffer } = await createNodeAdapter();
await initializeAgPsdCanvas(agPsd);

const psd = agPsd.readPsd(buffer, { skipThumbnail: true, skipCompositeImageData: true });
const allLayers = flattenLayers(psd.children);
const target = allLayers.find((l) => l.name === 'Design Here');
replaceLinkedSmartObjects(allLayers, target, await loadImage(artBuffer), createCanvas);
const out = toBuffer(composePsd(psd, createCanvas), 'image/png');

Scene Package

import { extractScene, renderScene } from '@visant/psd-engine/scene';

// Once per PSD (server, node adapter):
const { doc, assets } = extractScene(psd, createCanvas);
// → upload `assets` (canvases) + persist `doc` (SceneDoc JSON)

// Per render (browser or node):
const out = renderScene(doc, loadedAssets, { [faceKey]: artImage }, createCanvas);

doc.warnings flags blend modes the Canvas-2D mapping can't reproduce 1:1 — a hint to fall back to the full server compose.

License

MIT