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

jlc-dev-serve

v0.9.8

Published

A simple and efficient HTTP/S server for serving static files, meant to be used during development (with sane defaults).

Downloads

51

Readme

jlc-dev-serve

A simple and efficient HTTP/S server for serving static files, meant to be used during development (with sane defaults).

In my other HTTP-server project I wanted to include "the whole kitchen sink" and hence I never really had anything stable to release.

In this project I'll try keep it simple and only include the most needed features we need for local development (e.g. no minifying of files).

Features

  • HTTPS server with automatic certificates for development (devcert).
  • Directory watcher (chokidar) with LiveReload support.
  • Etag support (utilizes browser cache when possible).
  • Compression support (gzip and Brotli).
  • Directory listing (can be turned off).
  • Bootstrapping index.js files.
  • MIME types support through mime.
  • Very small amount of code written so anyone can understand it!

Usage

npx jlc-dev-serve

(with npx it doesn't have to be installed first)

Will serve the files in the current directory.

Note

It seems that when using npx you'll get the warning The `punycode` module is deprecated. I have a script to fix the dependency which cause this warning, but that script is only executed on the installation of my package.

Hence to get rid of that warning just install my package globally like this:

npm install -g jlc-dev-serve

Configuration

It can be configured by setting environment variables. E.g. like this:

HTTP=1 HOST=0.0.0.0 PORT=1337 npx jlc-dev-serve

Environment variables (all are optional): | Variable | Description | | --- | --- | | HTTP | Set (to 1 or true) to use HTTP instead of HTTPS. | | CERT | The certificate (PEM format) to use with the HTTPS server or a path to it. | | KEY | The private key (PEM format) to use with the HTTPS server or a path to it. | | PASS | The passphrase (if KEY needs one). | | PORT | The port to use (defaults to 8080 for HTTP and 4433 for HTTPS). | | HOST | Defaults to localhost. Use 0.0.0.0 to accept any IPv4 connection or :: to accept any IPv6 and IPv4 connection (on most systems). | | PUBLIC | A shortcut to setting the host to ::. | | PREFIX | Add a prefix which URLs must begin with to access the served files. | | REDIRECT | Redirect any HTTP connections to this port to the HTTPS server. | | COMPRESSION | Whether to support "Brotli" and "gzip" compression. | | IGNORE_INDEX | Ignore any index.html file when browsing path/. | | JS_BOOTSTRAP | Can be set to "bootstrap" index.js and index.mjs files by using "virtual HTML indexes" which just runs them. It can also define a list of scripts to execute before running them. Documentation here. | | NO_DIRECTORY_LISTING | When browsing path/ do NOT list its contents. | | NO_LIVE_RELOAD | Set to NOT start the LiveReload server. |

Documentation of JS_BOOTSTRAP

The JS_BOOTSTRAP environment variable can be set to "bootstrap" index.js and index.mjs files by using "virtual HTML indexes" which just runs them. It can also define a list of scripts to execute before running them.

Setting JS_BOOTSTRAP=1 or to true will enable this feature and depending on their .js or .mjs extension they will run as normal scripts or scripts with type="module" set. But setting it to JS_BOOTSTRAP=module will override this and run them all as modules.

You can even define a static list of scripts to run before them and also define whether each of these should run as normal scripts or modules as well.

E.g. like this:

JS_BOOTSTRAP=module|http://domain.com/script_x.js|/and_my_own_script_to_run_before_any_indexjs.js

Here the first script is loaded as a module while the second one isn't, because it wasn't preceded by module|.

Changing it to:

JS_BOOTSTRAP=module|http://domain.com/script_x.js|/and_my_own_script_to_run_before_any_indexjs.js|module

Will function the same as JS_BOOTSTRAP=module does and load your index.js as modules.

The End

That's it, there's really not much more to it!

If you like it, then please support me so I don't lose my house! 🏠

Your soul or higher self is just a certain perspective higher up than your lower self; meaning it can see, feel and experience everything that your lower self is experiencing.

Basically we have a tree-like structure of branched perspectives where God is the trunk!

❤️