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

@openfairygui/functions

v0.7.0

Published

FairyGUI Headless Authoring SDK — composable transform functions.

Readme

@openfairygui/functions

Composable authoring workflows and thin application seams built on top of @openfairygui/core.

Install

npm install --save @openfairygui/core @openfairygui/functions

Usage

import { NodeIO } from '@openfairygui/core/node';
import { inspect } from '@openfairygui/functions';
import { publishNode, restoreNode, validateProjectNode } from '@openfairygui/functions/node';

const io = new NodeIO();
const doc = await io.readProject('./MyProject/MyProject.fairy');

const report = inspect(doc);
const validation = await validateProjectNode('./MyProject/MyProject.fairy');
const published = await publishNode({ document: doc, output: './release' });
console.log(published.files); // Actual writes: final absolute paths and byte sizes.

await restoreNode({
	inputDir: './release',
	output: './restored-project',
});

validateProjectNode combines detailed project reads, UAM integrity checks, source checks, and Sharp image decoding without writing files. publishNode owns the standard Node filesystem, Sharp raster backend, and project plugin discovery. restoreNode owns the Node filesystem and Sharp image extraction required by trusted-local artifact recovery. The root validateProject(), publish(), and restore() exports remain lower-level workflows for custom hosts.

Browser LayaBox publish

Use @openfairygui/core/web to read the raw project, then publish through the browser-only entry. Both filesystems are caller-owned, so they can be File System Access, OPFS, IndexedDB, ZIP, or memory adapters.

import { liftDocumentToUamProject } from '@openfairygui/core';
import { WebIO } from '@openfairygui/core/web';
import { publishBrowser, validateProjectWeb } from '@openfairygui/functions/web';

const document = await new WebIO(sourceFileSystem).readProject('Project.fairy', { hydrateResourceBytes: true });
const validation = await validateProjectWeb(liftDocumentToUamProject(document));
const result = await publishBrowser({
	document,
	sourceFileSystem,
	outputFileSystem,
	projectType: 'layabox',
	output: '.fairygui-runtime',
});

if (!result.success) console.error(result.diagnostics);

The browser entry uses native Canvas APIs for atlas PNGs, writes only through outputFileSystem, and supplies no Node plugin capability. Persisted Laya publish compression, atlas, and safe file-extension settings apply; explicit compressed and atlas options override their corresponding settings. Explicit output, branch, and packages also keep their normal precedence, so desktop-only configured output paths are not used when output is supplied.

Browser code generation is not supported. If global code generation is enabled and a selected package requests it, preflight returns unsupported_publish_setting with setting and path before Canvas checks or output writes. On any failure, files lists only writeFileRaw operations that completed successfully; success: false with a non-empty list therefore means built-in output is partial. Callers needing atomic publication should provide a transactional or staging outputFileSystem.

Publish plugins are documented in the repository guide:

  • https://github.com/OpenFairyGUI/OpenFairyGUI/blob/main/docs/publish-plugins.md

UAM authoring seam

@openfairygui/functions also exposes a thin stateless wrapper over the UAM transaction contract from @openfairygui/core.

This seam:

  • accepts UamProject + UamTransactionOperation[]
  • returns structured app-level success / failure results
  • does not expose Document
  • does not define a second selector / operation grammar
  • does not wrap publish or restore

The transaction surface includes component size/root properties, component-instance extension overlays, resource rename/move, complete image-resource property snapshots, byte-backed binary resource add/replace/remove, and add/update/remove for display, display2, look, xy, size, color, animation, text, icon, and fontSize gears. Resource rename/move/replace/remove requires sourceBytes; opt in with ProjectReader.read(path, { hydrateResourceBytes: true }) before lifting a project to UAM. Source bytes are written back with the project, and stale source files are removed only after all replacement content succeeds.

import {
	type UamProject,
	type UamTransactionOperation,
} from '@openfairygui/core';
import { applyUamTransactionApp } from '@openfairygui/functions';

const project: UamProject = /* project read and lifted with hydrateResourceBytes */;
const operations: UamTransactionOperation[] = [
	{
		kind: 'renameResource',
		selector: { packageId: 'pkg001', resourceId: 'img001' },
		newName: 'renamed.png',
	},
];

const result = applyUamTransactionApp({ project, operations });
if (!result.ok) {
	console.error(result.error.code, result.error.stage, result.error.message);
}

Repository:

  • https://github.com/OpenFairyGUI/OpenFairyGUI