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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@papit/server

v0.0.24

Published

**Papit Server** is a fast, lightweight static file server that dynamically compiles your JavaScript and handles themes, assets, and dependencies on-the-fly. With built-in support for theme switching, customizable templates, and live reloading for develop

Downloads

44

Readme

Papit Server

Papit Server is a fast, lightweight static file server that dynamically compiles your JavaScript and handles themes, assets, and dependencies on-the-fly. With built-in support for theme switching, customizable templates, and live reloading for development, it’s perfect for quickly serving web content without hassle. Simplify your static site hosting with Papit Server's powerful yet easy-to-use configuration.


Github Repo Layer Type

Tests NPM version

Introduction

@papit/server is a highly configurable, lightweight static file server designed to serve your content dynamically while intelligently handling dependencies and assets. By leveraging esbuild, the server compiles JavaScript on-the-fly, ensuring optimal performance and seamless integration with themes and assets. Ideal for applications requiring rapid setup, flexibility, and scalability, @papit/server provides built-in support for themes, bundles, and fallback mechanisms.

Whether you're developing a theme-driven application or need to serve static files with precision, @papit/server helps you stay in control with its customizable configurations and robust dependency management.

Features

  • Dynamic Compilation: All JavaScript files are compiled on-the-fly using esbuild, ensuring fast and optimized serving of your assets.
  • Theme Support: Serve themes or theme bundles, with automatic fallback to a default (core) if no specific theme is found.
  • Asset Management: Automatically detects and serves assets like public, assets, and custom asset directories through a smart dependency extraction mechanism.
  • Customizable Templates: Easily customize the error page (404), directory listings, and common template wrappers.
  • Live Reload: Optionally enables live reloading with the --live flag for development convenience.
  • Configurable Ports and Logs: Control the server's port, logging verbosity, and location through straightforward CLI flags.
  • Robust Cleanup: Ensures smooth process shutdowns, including clean handling of temporary files and server termination signals.

Getting Started

To install @papit/server:

npm install @papit/server

Once installed, you can start serving your static files by specifying the location of your content:

npx @papit/server --location=/path/to/your/files

CLI Options

@papit/server offers a variety of command-line options to control how your content is served:

  • --location=<path>: Specifies the directory from which files will be served.
  • --port=<number>: Changes the server port (default: 3000).
  • --log-level=<level>: Sets the log level (none, verbose, critical, debug).
  • --theme=<name>: Specifies the theme to be used.
  • --live: Enables live reloading for development purposes.
  • --output-translations=<path>: Exports translations to the specified directory.
  • --open: Automatically opens the server URL in your default browser.
  • Template Options: Customize paths to HTML templates:
    • --notfound=<path>: Path to the 404 error page.
    • --directory=<path>: Path to the directory listing template.
    • --common=<path>: Path to a common template wrapper.

Example Usage

Here’s an example of starting the server with specific options:

npx @papit/server --location=./public --port=8080 --theme=dark --log-level=debug --open

This starts the server on port 8080, using the dark theme, enables debug-level logs, and automatically opens the server in your browser.

Asset Management

@papit/server is designed to intelligently manage and serve assets. It traverses your project directories to locate asset folders (e.g., public, assets) and avoid conflicts with similarly named packages. The server dynamically extracts dependencies, ensuring all assets are served correctly.

Themes

You can serve multiple themes, or even bundles of themes, by ensuring they share the same name pattern. If a theme isn't found, the server will fallback to the core theme by default, making theme handling simple and reliable.

Custom Dependency Management

The server utilizes a smart system for managing project dependencies. It scans your package-lock.json to locate and load packages, allowing for cross-package dependencies within a monorepo. Only relevant local dependencies are loaded, ensuring an optimized and modular approach to serving assets.