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 🙏

© 2025 – Pkg Stats / Ryan Hefner

xiv-lang

v1.2.0

Published

XIV is a simple template engine for creating component-based HTML.

Readme

Test Status Compile Docs Publish to Bun

XIV

A simple, component-based template engine that evolves into a lightweight JavaScript framework.

XIV allows you to write clean, reusable HTML components and bring them to life with minimal JavaScript, all powered by the Bun runtime.

Features

XIV provides a powerful set of directives to make your HTML dynamic and interactive.

  • x-data: Initializes a component's state as a JavaScript object.

    <div x-data="{ count: 0, message: 'Hello' }">...</div>
  • x-init: Runs an expression when a component is initialized.

    <div x-data="{ users: [] }" x-init="users = await (await fetch('/api/users')).json()">...</div>
  • x-text: Binds the text content of an element to a state property.

    <span x-text="message"></span>
  • x-on:<event>: Attaches an event listener to an element.

    <button x-on:click="count++">Increment</button>
  • x-bind:<attribute>: Binds an element's attribute to a state property.

    <a x-bind:href="url">Visit Site</a>
  • x-model: Creates a two-way data binding on an input element.

    <input type="text" x-model="message">
  • x-if: Conditionally renders an element based on an expression.

    <template x-if="isOpen">
      <div>Now you see me.</div>
    </template>
  • x-for: Renders a list of elements from an array.

    <template x-for="user in users">
      <div x-text="user.name"></div>
    </template>
  • x-ref: Provides a way to directly access a DOM element within your component.

    <input type="text" x-ref="myInput">
    <button x-on:click="$refs.myInput.focus()">Focus Input</button>

Installation

First, ensure you have Bun installed.

# Install from the Bun package registry
bun add xiv-lang

Usage

Compiling with the CLI

Use the xiv command to compile your .xiv files into a single HTML file.

xiv <input_file> [options]

Example:

xiv docs/main.xiv -o dist/index.html

Options:

  • -o, --output_file <path>: Path for the output HTML file (default: ./index.html)

Creating Reusable Components

You can create reusable components and load them into your main file using the <x-temp> element.

templates/my-card.xiv:

<div class="card">
    <h2 x-text="user.name"></h2>
    <p><a x-bind:href="`mailto:${user.email}`" x-text="user.email"></a></p>
    <p><strong>Website:</strong> <a x-bind:href="`http://${user.website}`" target="_blank" x-text="user.website"></a></p>
</div>

main.xiv:

<xiv type="main">
    <body>
        <div x-data="{ users: [] }" x-init="/* fetch users from an API */">
            <h1>User Directory</h1>
            <div class="grid">
                <template x-for="user in users">
                    <!-- Pass the 'user' object to the component's scope -->
                    <div x-data="{ user: user }">
                         <x-temp src="templates/my-card.xiv"></x-temp>
                    </div>
                </template>
            </div>
        </div>
    </body>
</xiv>

Development

To contribute or run the project locally:

# Clone the repository
git clone https://github.com/sktryo/XIV.git
cd XIV

# Install dependencies
bun install

# Build the runtime (after making changes in src/runtime/)
bun run build:runtime

# Run tests
bun test

How It Works

The xiv compiler takes a main .xiv file, extracts the content from <head> and <body> tags inside a <xiv type="main"> block, and embeds it into a standard HTML5 boilerplate. It also includes the xiv.js runtime via a <script> tag, which powers all the client-side interactive features.

License

This project is licensed under the MIT License. See the LICENSE file for details.