Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hot-loader

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hot-loader - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

notify.js

18

index.js

@@ -0,13 +1,27 @@

var path = require('path'),
loaderUtils = require('loader-utils');
module.exports = function () {};
module.exports.pitch = function (remainingRequest) {
this.cacheable && this.cacheable();
var patchedModuleRequest = '!!' + require.resolve('./replaceCreateClass') + '!' + remainingRequest;
var patchedModuleRequest = '!!' + require.resolve('./replaceCreateClass') + '!' + remainingRequest,
originalFilename = path.basename(remainingRequest),
query = loaderUtils.parseQuery(this.query);
query.notify = query.notify || 'none';
return [
'var React = require("react")',
'var hot = require(' + JSON.stringify(require.resolve('./hot')) + ')(React);',
'var notify = require(' + JSON.stringify(require.resolve('./notify')) + ')(' + JSON.stringify(query.notify) + ');',
'module.exports = require(' + JSON.stringify(patchedModuleRequest) + ')(hot.createClass);',
'if (module.hot) {',
' module.hot.accept(' + JSON.stringify(patchedModuleRequest) + ', function () {',
' module.exports = require(' + JSON.stringify(patchedModuleRequest) + ')(hot.updateClass);',
' try {',
' module.exports = require(' + JSON.stringify(patchedModuleRequest) + ')(hot.updateClass);',
' notify.success(' + JSON.stringify(originalFilename) + ')',
' } catch (err) {',
' notify.failure(' + JSON.stringify(originalFilename) + ', err)',
' }',
' });',

@@ -14,0 +28,0 @@ '}',

3

package.json
{
"name": "react-hot-loader",
"version": "0.1.7",
"version": "0.1.8",
"description": "Webpack loader that enables live-editing React components without unmounting or losing their state",

@@ -11,2 +11,3 @@ "main": "index.js",

"jsx-loader": "^0.10.2",
"loader-utils": "^0.2.3",
"react": "^0.10.0",

@@ -13,0 +14,0 @@ "webpack": "^1.3.1"

@@ -39,2 +39,6 @@ # react-hot-loader

### Options
* `notify`: Loader can use desktop Notification API to show notifications when a module has been reloaded, or if it loads with an error. By default, this feature is disabled because it doesn't work well with `webpack-dev-server` iframe mode used in the example. If you don't use `webpack-dev-server`'s iframe mode, you might want to enable notifications. Valid values are `none` (default), `errors` and `all`. If `notify` is `errors` or `all`, module load errors won't cause page refresh.
## Running Example

@@ -41,0 +45,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc