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

jspm-hmr

v1.0.0-rc7

Published

Dev-Server with Hot-Reload for JSPM & SystemJS

Downloads

13

Readme

Dev-Server with Hot-Reload for JSPM & SystemJS

NodeJS/Express Server ehnanced with Chokidar WebSocket Server emitting events on file changes

Npm package:

  • https://www.npmjs.com/package/jspm-hmr

Project Starter using this Dev-Server (React / Redux / TypeScript / JSPM):

  • https://github.com/piotrwitek/react-redux-typescript-starter-kit

Motivation

When starting development in JSPM / SystemJS Ecosystem you'll find out there is no standard dev-server, that could be equivalent in features to webpack-dev-server. Although there are several projects such as jspm-server (a fork of live-server), these are not well-maintained and have missing or broken support for Hot-Reload and Live-Reload which is the main focus of this project. Adding and configuring Hot-Reload manually is often hard and require advanced knowledge that not every developer needs to master in order to simply use the tool.

For that reasons I have decided to create library that is providing the dev-server with hot-reload preconfigured with best-practices in mind, battle-tested in production and open-source project and extended with new features requested by community.

Features

  • Configurable and feature-full web-server based on NodeJS/Express (built-in ssl, HTML5 history api fallback, proxy, cache, browser auto-start)
  • Project initialization wizard - create new or update an exisintg project with preconfigured server and client scripts with battle-tested Hot-Reload setup, using systemjs-hot-reloader
  • jspm-hmr CLI utility to run a local web-server in any folder

Quick Start

  • Bootstrap Minimal App Boilerplate guided by CLI Wizard
  • Transpilation workflow setup: choose Babel or TypeScript

Tip: Confirm all Wizard Questions with Enter for default Babel setup

ONE-LINER
npm i jspm@beta jspm-hmr -D && ./node_modules/.bin/jspm init && ./node_modules/.bin/jspm i systemjs-hot-reloader && ./node_modules/.bin/jspm-hmr -I && npm start

Now open app.js or es6module.js file from src, make some changes and save to see Hot-Reload updates in running application without page reload!


Project prerequisite

  • http://jspm.io - package manager and bundler for JS apps (webpack alternative)
    npm i jspm@beta -D
  • use jspm-cli to init project build workflow
    ./node_modules/.bin/jspm init
  • install client web-socket receiver for hot-reload
    ./node_modules/.bin/jspm i systemjs-hot-reloader

Install

$ npm i jspm-hmr -D

Tip: You can install this module globally using -g flag and use it as a simple static http server in any folder on your machine

Pro-Tip: You can use --init flag to initialize your project with index.html, app.js, server.js files - configured with hot-module-reload out-of-the-box


Usage

$ jspm-hmr [path] [options]

Path: (default: .)

Options:

-h, --help                      output usage information
-V, --version                   output the version number
-I, --init                      run CLI Wizard to bootstrap your project
-O, --open                      open default browser on server start
--port <number>                 change default port number (default: 3000)
--address <address>             change default address (default: localhost)
--cache <seconds>               change default Cache-Control header max-age=<seconds> (default: -1)
--proxy <address:port>          enable proxy of all requests to specified target
--proxy-route <route_pattern>   change default route pattern to filter proxied requests (default: *)
-S, --ssl                       enable https (by default will use built-in self-signed cert)
--key <path>                    set path to ssl-key .pem file (will override built-in ssl-key)
--cert <path>                   set path to ssl-cert .pem file (will override built-in ssl-cert)
-F, --fallback [rewrite_target] enable HTML5 History Api Fallback (default: /index.html) [optional: change rewrite target]
--disable-hmr                   disable Hot-Reload (Chokidar Socket Server)
--verbose                       enable verbose logging for: fallback rewrites

Programmatic Usage

https://github.com/piotrwitek/jspm-hmr/blob/master/boilerplate/server.js


Examples:

  • Start dev server in (by default) current directory with enabled HTML5 History Api Fallback (by default rewrite set to /index.html)
$ jspm-hmr --fallback
  • Start dev server in current directory on port 4444 & open browser on server start (last active window takes precedence)
$ jspm-hmr . --port 4444 --open
  • Start dev server in dist directory with enabled proxy and target set to "http://localhost:1234" and proxy route pattern set to /api/
$ jspm-hmr dist --proxy http://localhost:1234 --proxy-route /api/
  • Start dev server in current directory with enabled https using built-in self-signed cert
$ jspm-hmr --ssl
  • Start dev server in current directory with caching headers set to "3600 sec"
$ jspm-hmr --ssl --cache 3600

How it works

Chokidar process on dev server watches specified path for file changes and emits events through web socket to the browser web socket client to reload that particular JavaScript module that has been changed.

Uses:

Peer Dependencies:


License

MIT License

Copyright (c) 2016 Piotr Witek [email protected] (http://piotrwitek.github.io)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.