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

@nilvn/core

v0.19.0

Published

NilVN shared core — the project document model (IR), command / plugin-manifest schemas, script-package format and serializers

Readme

@nilvn/core

The contract layer of NilVN, a small visual-novel engine. No DOM, no dependencies. Every other NilVN piece — the runtime, the studio that authors games, plugins and tooling — agrees on the shapes defined here, so they can be versioned and shipped separately.

pnpm add @nilvn/core

What is in it

| Module | Exports | Use it to | |---|---|---| | IR | Project, Scene, SceneNode (SayNode, NarrateNode, CommandNode, ChoiceNode, SetNode, JumpNode, LabelNode, …), Actor, VariableDef, ResourceRegistry, PluginRef, CURRENT_SCHEMA_VERSION, migrateProject | Read, generate or transform a NilVN project: the structured document the studio edits. Text lives in per-language catalogs and nodes hold keys. migrateProject brings an older project to the current schema. | | Command schema | CommandSchema, ParamSchema, BUILTIN_COMMANDS, BUILTIN_COMMAND_MAP, getCommandSchema | Know every built-in script command's parameters, types and defaults — the same data the studio builds its forms from and a linter checks against. | | Plugin manifest | PluginManifest, PluginContributions, validatePluginManifest, manifestErrors, isPluginId, PLUGIN_API_VERSION, PLUGIN_MANIFEST_FILE, EXTENSION_POINTS, PERMISSIONS, matchPermission, hasEngineHalf, hasEditorHalf | Validate a plugin.json and introspect the extension-point and permission catalogs. | | Plugin ids | FIRST_PARTY_ID_PREFIX, resolvePluginId, isFirstPartyId, pluginSlug, manifestCommandMap, commandRegistry | The id conventions (textfx → app.nilvn.textfx, the reserved first-party namespace) and manifest-derived command registries; commandRegistry(manifests) is built-ins plus the commands those manifests contribute, what the serializer needs. The first-party plugins themselves live in @nilvn/plugins. | | Script package | PackageManifest, PackageActor, PackagePlugin, PACKAGE_FORMAT, PACKAGE_MANIFEST_FILE, isPackageManifest, buildScriptPackage, fillPackageAssets, packageLanguages, packageActors | Produce a nilvn.json package from a project (pure: returns the manifest and file contents; you write the files). | | Chunks | ChunkManifest, ScriptChunk, TextCatalogSlice, ContentLoader, CHUNK_MANIFEST_FORMAT, isChunkManifest, buildChunkedExport, sceneTextKeys | The streaming wire format and the loader interface a custom host implements. | | Serialization | serializeProject, serializeChunk, SerializeOptions, isAssetRef | IR → the .nvn script the engine plays (keepKeys emits @key references for runtime language switching; scenes scopes the output to a chunk). | | Catalogs | exportCatalog, importCatalog, catalogToText, catalogFromText, catalogCompleteness, authoredKeys, nativeLangName | Round-trip a project's text through a plain-text translation file. | | Screenplay | parseScreenplay, formatScreenplay, stripScreenplayMarkup | A human-readable markdown screenplay grammar and its normalizer, for writing tools. | | Chrome i18n | createI18n, applyCatalogs, registerEnabledPluginCatalogs | Stable-id UI string lookup shared by hosts and plugins (a plugin's own messages register into it). | | Versions | FORMAT_VERSIONS, parseSemVer, compareSemVer, isValidRange, satisfiesRange | Every independently-versioned format in one table, and the semver subset plugin manifests use. |

Examples

Validate a plugin manifest against an engine version:

import { validatePluginManifest } from '@nilvn/core'

const { errors, warnings } = validatePluginManifest(manifest, { engineVersion: '0.14.0' })
if (errors.length) throw new Error(errors.join('\n'))

Turn a project into a playable package:

import { buildScriptPackage, fillPackageAssets, serializeProject } from '@nilvn/core'

const plan = buildScriptPackage(project, { engine: '0.14.0' })
// plan.manifest  → nilvn.json (chunks.assets still empty)
// plan.files     → chunk + locale JSON files to write
// plan.assetRefs → asset references to resolve, then:
const manifest = fillPackageAssets(plan.manifest, { 'assets/bg/street.svg': { url: 'assets/bg/street.svg', bytes: 12034, kind: 'bg' } })

const script = serializeProject(project)   // or a single .nvn for the whole project

Walk a project:

for (const scene of project.scenes) {
  for (const node of scene.nodes) {
    if (node.kind === 'say') console.log(node.actor, project.catalogs[project.meta.defaultLang][node.textKey])
  }
}

Versioning

FORMAT_VERSIONS lists the on-disk and on-wire shapes that version independently of the package: the IR schema (migrateProject steps older projects forward), the chunk manifest, the script package, the engine save state and the plugin API. Each bumps only when its own shape changes incompatibly.

The runtime that plays what this package describes is @nilvn/engine; plugin authors start from @nilvn/plugin-sdk.

MIT.