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

@ptahjs/build

v1.1.5

Published

PtahJs Building Tool

Readme

@ptahjs/build

A unified Vite build configuration tool for the PtahJs ecosystem. Provides ready-to-use build presets for Vue apps, Vapor apps, library mode, and Module Federation.

Installation

pnpm add -D @ptahjs/build

Quick Start

Create vite.config.js in your project root:

import { buildConfig } from '@ptahjs/build'

export default buildConfig({
    mode: ['vue'],
})

API

buildConfig(options)

Returns a Vite config object (wrapped in defineConfig).

General Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | mode | string[] | ['vue'] | Build mode. Accepted values: vue / vapor / library | | base | string | './' | Vite public base path | | external | string[] | [] | Dependencies to exclude from the bundle | | input | string | '' | Custom entry file | | minify | boolean | true | Minify output | | plugins | Plugin[] | [] | Additional Vite plugins | | server | object | {} | Vite dev server options (default host: 0.0.0.0) | | resolveAlias | object | {} | Path aliases | | developmentResolveAlias | object | {} | Path aliases applied only in development mode | | pluginOption | object | {} | Options for Vue / JSX Vapor plugins (vueConfig / jsxVaporConfig) | | codeSplitting | object[] | [] | Rollup code splitting groups | | autoImport | object | {} | Auto-import configuration (reserved) | | test | object | {} | Vitest unit test configuration |

Library Mode (mode: ['library'])

| Option | Type | Default | Description | |--------|------|---------|-------------| | libraryEntry | string | './src/index.js' | Library entry file | | libraryFileName | string | 'lib' | Output filename (without extension) | | styleId | string | '' | Style ID used when injecting CSS into JS |

Module Federation (remote: true)

| Option | Type | Default | Description | |--------|------|---------|-------------| | remote | boolean | false | Enable Module Federation remote module | | federation.exposes | object | {} | Module map exposed to other apps | | federation.shared | string[] | [] | Shared dependency list |

Code Obfuscation

| Option | Type | Default | Description | |--------|------|---------|-------------| | obfuscator | boolean | false | Enable code obfuscation | | obfuscatorLevel | 0\|1\|2 | 1 | Obfuscation level: 0 no compression, 1 standard, 2 advanced |

Serve Configuration

| Option | Type | Description | |--------|------|-------------| | serveConfig.path | string | JSON config file path; enables @ptahjs/vite-plugin-json when set | | serveConfig.outputDirectory | string | Output directory | | serveConfig.outputName | string | Output filename |

License Validation

| Option | Type | Default | Description | |--------|------|---------|-------------| | licenseValidator | boolean | false | Inject license validation logic (used by core packages) |

Examples

Vue App

import { buildConfig } from '@ptahjs/build'

export default buildConfig({
    mode: ['vue'],
    external: ['vue'],
    server: { port: 3000 },
})

Vapor (JSX) App

import { buildConfig } from '@ptahjs/build'

export default buildConfig({
    mode: ['vapor'],
    pluginOption: {
        jsxVaporConfig: { /* vue-jsx-vapor options */ },
    },
})

Library Mode

import { buildConfig } from '@ptahjs/build'

export default buildConfig({
    mode: ['library'],
    libraryEntry: './src/index.js',
    libraryFileName: 'my-lib',
    external: ['vue'],
    minify: true,
})

Module Federation (Remote Module)

import { buildConfig } from '@ptahjs/build'

export default buildConfig({
    mode: ['vue'],
    remote: true,
    federation: {
        exposes: {
            './Button': './src/components/Button.vue',
        },
        shared: ['vue'],
    },
})

Code Splitting with Auto Version Injection

In vue / vapor mode, chunks listed in codeSplitting automatically have the corresponding package version injected into their filename:

import { buildConfig } from '@ptahjs/build'

export default buildConfig({
    mode: ['vue'],
    codeSplitting: [
        { name: 'runtime', match: /^\/packages\/runtime\// },
    ],
})
// Output example: assets/runtime-1.2.3-abc123.js

Built-in Plugins

| Plugin | Condition | Description | |--------|-----------|-------------| | @vitejs/plugin-vue | mode includes vue | Vue SFC support | | vue-jsx-vapor/vite | mode includes vapor | Vue JSX Vapor support | | @module-federation/vite | remote: true | Module Federation support | | StyleInjectPlugin | mode includes library | Inlines CSS into JS output (library mode) | | ObfuscatorPlugin | obfuscator: true | Code obfuscation via javascript-obfuscator | | LicenseCodePlugin | licenseValidator: true | Injects license validation code | | VirtualLicensePlugin | licenseValidator: true | Provides a virtual license module | | @ptahjs/vite-plugin-json | serveConfig.path is set | Serves JSON configuration files |

Notes

  • __VUE_OPTIONS_API__ is disabled by default in all modes to reduce bundle size.
  • The dev server listens on 0.0.0.0 by default for LAN access.
  • developmentResolveAlias only takes effect when mode=development, useful for local monorepo source debugging.