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

@potoru/authoring

v0.1.1

Published

Author Potoru 2D animation from code: the authoring API, check / export / lint as functions, and the potoru command line.

Downloads

464

Readme

@potoru/authoring

Make Potoru 2D animation from code: a typed authoring API, check / export / lint as functions, and the potoru command line. Projects are format v4 source folders (small YAML files that people and LLM agents edit directly); export writes the .poto package the player plays.

npm install @potoru/authoring

API

import { Project } from "@potoru/authoring";

const project = Project.create({ id: "sunrise", name: "Sunrise", format: 4 });
project.scene("hill", { stage: { width: 960, height: 540 }, duration: 3 }, (scene) => {
  scene.rect("sky", { at: [0, 0], size: [960, 540], fill: "#203a6b" });
  scene.ellipse("sun", { at: [430, 400], size: [100, 100], fill: "#ffcc33" });
  scene.state("main", { duration: 3 }, (t) => {
    t.tween("sun", "y", { from: 400, to: 120, duration: 3, easing: "easeOut" });
  });
});
await project.save("stories/sunrise");          // a v4 source folder ("sunrise.potoru": one zip file)

const again = await Project.load("stories/sunrise");   // folder, .potoru zip, or legacy JSON
const bytes = await again.toBytes();                    // Project.fromBytes(bytes) reads them

Part references take a handle, the key the part was made with, its full id, or a slash path of names. Every error is a PotoruError with a stable code, a diagnostic ({code, severity, message, file?, path?, fix?, didYouMean?}) and, for validation, every finding in diagnostics.

| Entry | What | |---|---| | @potoru/authoring | Project and the builders, gradients, presets, measureText, PotoruError | | @potoru/authoring/node | file helpers: imageFile, audioFile, fontFile, importSvgFile, openLibraryFolder, builtinFonts, loadEngines | | @potoru/authoring/tools | check, exportPackage, lint, simulate, size, render, presets, measure, runPotoru | | @potoru/authoring/experimental | rigging (drives, skins, meshes, spring bones, constraints), strokes, hops, the engines, the format toolkit: may change in a minor release | | @potoru/authoring/legacy | schema-3 JSON (openProject, serializeProject): deprecated |

Strokes, interaction (on: / machine:) and path guides use WebAssembly engines; in Node, call await loadEngines() from @potoru/authoring/node once before using them.

Tools as functions

import { check, exportPackage, render } from "@potoru/authoring/tools";

const result = await check("stories/sunrise");
for (const d of result.diagnostics) console.log(`${d.file}: ${d.severity} [${d.code}] ${d.message}`);
if (result.ok) {
  await exportPackage("stories/sunrise", "dist/sunrise.poto");
  await render("dist/sunrise.poto", { out: "dist/sunrise.png", times: [1.5], scale: 0.5 });
}

Each returns {ok, command, exitCode, diagnostics, outputs, stats, data, text} and never throws for a finding or a usage mistake. Paths in results are relative or base names.

Command line

npx potoru new stories/sunrise --id sunrise --scene hill --width 960 --height 540 --duration 3
npx potoru check stories/sunrise
npx potoru export stories/sunrise dist/sunrise.poto
npx potoru render dist/sunrise.poto --time 1.5 --scale 0.5 --out dist/sunrise.png
npx potoru size dist/sunrise.poto --json
npx potoru help
  • --json on every command prints one JSON document (the same result as the functions).
  • Exit codes: 0 ok (warnings allowed; --strict makes warnings fail), 1 findings or errors, 2 usage or missing input. Unknown options are refused with a "did you mean".
  • lint, simulate, skin, mesh, strokes, bones, machine are experimental.
  • Library folders: --lib-dir <folder> or POTORU_LIB_DIR.
  • potoru video is not part of 0.1 (it needs Chrome or a native renderer); render draws PNG frames through @potoru/render without either.

Runtimes

Node 20 or newer, ES modules only. The root entry loads no Node built-ins, so bundlers can use the API in other runtimes; file helpers, tools and the CLI need Node. Versions move in lockstep with @potoru/web (which also compiles source folders in browsers: compile({ yaml })), @potoru/react and @potoru/render.

Licence

Apache-2.0 (LICENSE, NOTICE). The wasm engines contain third-party Rust crates and the package ships three fonts under the SIL Open Font License 1.1: see THIRD-PARTY-NOTICES.txt. Depends on @xmldom/xmldom (MIT) and @potoru/render. "Potoru" is a trademark of The Potoru Authors.