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

steal-hmr

v0.1.1

Published

Hot module replacement (reload) for StealJS/System.js

Downloads

1

Readme

Steal-HMR

Frictionless hot module replacement for apps loaded with StealJS

js-standard-style

##What is it

StealJS is a great module loader on top of System.js that allows you to load ES6/CJS/AMD modules right inside your browser while working with NPM packages too.

And Steal-HMR is a small add-on for StealJS/System.js that allow to tune hot module replacement nicely.

Hot module replacement/reloading with StealJS/System.js works actually faster (in terms of DX) than alternative solutions for example Webpack. Because there is no need to prepare something (for example diff bundle) on on server side, it just loads only changed file(s) and replaces already loaded modules using SystemJS mechanics.

####This demo shows hot reloading implemented with Steal-HMR for CanJS UI framework can-hot

##Install

npm install steal-hmr

##Usage

NB! To use HMR module you need something that will notify it about file changes. This example uses Watchalive Dev Server that generously provides HMR not only with a list of changes but also supplies with sources of changed files so loader will not even have to make a single request to the server.

<script src="/node_modules/steal/steal.js" config="/package.json!npm">
  import HMR from 'steal-hmr'

  // map styles to use build-in support for css hot-reload
  System.config({map: {
    $css: 'steal-hmr/css',
    $less: 'steal-hmr/css'
  }})

  new HMR({
    // auto load of main module will happen
    main: 'app/app',
    
    // to output some debug messages
    debug: true,
    
    // tells HRM to reload dependants for all *.js, 
    // `false` by default
    dependants: /\.js$/,
        
    // tells when to reload whole page
    page: [/index\.html/, /node_modules/],
    
    // event that provides file changes: 
    // it should be a function that produces an array of changes 
    // that are file names (relative to host root) or urls,  
    // changes can also contain a source data in format 
    // {name: ... , source: ....}
    handle: watchalive.onFiles,
    
    // teardown happens when 'main' reloads
    teardown: () => document.body.innerHTML = ''
  })
</script> 

##Try demo app

Try and test how all this works with module's demo app.

git clone http://github.com/whitecolor/steal-hmr
npm install # please, use NPM 3, otherwice remove system.npmAlgorithm in package.json
npm run start # app will run on 7000, to use other port: npm run start -- --port your_port
  • Open your browser http://localhost:7000
  • You can changes files js/css/less inside the app folder and see what happens
  • Notice that css/less reload do not made any changes to apps current state
  • See example of hot reloading for CanJS UI framework

##Licence

ISC.