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

@syma-lang/vite-plugin

v0.5.0

Published

Vite plugin for Syma module bundling with HMR

Downloads

10

Readme

@syma/vite-plugin

Vite plugin for Syma module compilation with Hot Module Replacement (HMR).

Installation

npm install -D @syma/vite-plugin @syma/cli
npm install @syma/platform-browser

Usage

Add the plugin to your vite.config.js:

import { defineConfig } from 'vite';
import symaPlugin from '@syma/vite-plugin';

export default defineConfig({
  plugins: [
    symaPlugin({
      entryModule: 'App/Main',
      modulesDir: 'src/modules'
    })
  ]
});

Options

entryModule

  • Type: string
  • Default: 'App/Main'

The name of the entry module to bundle. This should match the module name in your .syma file.

entryFile

  • Type: string
  • Default: null

Path to a specific .syma file to use as entry. When provided, overrides entryModule. The plugin will automatically extract the module name from the file.

modulesDir

  • Type: string
  • Default: 'src/modules'

Directory where .syma module files are located.

pretty

  • Type: boolean
  • Default: true

Whether to pretty-print the compiled JSON output.

include

  • Type: RegExp
  • Default: /\.syma$/

Files to include for HMR watching.

exclude

  • Type: RegExp
  • Default: /node_modules/

Files to exclude from HMR watching.

How It Works

The plugin:

  1. Scans all .syma files in modulesDir and standard library
  2. Resolves dependencies by parsing Import declarations
  3. Bundles all modules using the Syma compiler
  4. Provides a virtual module virtual:syma-universe with the compiled AST
  5. Watches for changes and triggers HMR updates

Virtual Module

Import the compiled universe in your JavaScript entry point:

import { boot } from '@syma/platform-browser/runtime';
import universe from 'virtual:syma-universe';

boot(universe, '#app', 'dom', { debug: false });

Hot Module Replacement

The plugin automatically watches .syma files and triggers full page reloads when changes are detected. For smoother HMR:

boot(universe, '#app', 'dom', { debug: false })
  .then((app) => {
    if (import.meta.hot) {
      import.meta.hot.accept('virtual:syma-universe', (newModule) => {
        if (newModule) {
          app.reload();
        }
      });
    }
  });

Environment Variables

You can override the entry file using an environment variable:

VITE_SYMA_ENTRY=src/demos/counter.syma npm run dev

Module Resolution

The plugin supports both name-based and file-based imports:

; Name-based (searches in modulesDir and stdlib)
{Import Core/List as List}

; File-based (relative to current module)
{Import Utils/Helpers as H from "./helpers.syma"}

Error Handling

The plugin provides helpful error messages when:

  • Entry module is not found
  • Module files are malformed
  • Compilation fails

Errors are displayed both in the terminal and in the browser during development.

License

MIT