New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hotrequire

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hotrequire - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

examplemodule.js

4

hotrequire.js

@@ -22,3 +22,4 @@ /**

*
* @todo make this function global
* @todo extend require object to require.hot(path, callback);
* require.prototype.hot = function(path, callback) doesn't work.
*/

@@ -51,2 +52,3 @@ function hotRequire(path, callback)

require.prototype.__proto__.hot = hotRequire;
module.exports = exports = hotRequire;
{
"name": "hotrequire",
"description": "hot-load modules into current scope",
"version": "0.1.0",
"description": "Extends require object by adding the require.hot(path, callback) method. This enables you to hot-load modules into the current scope.",
"version": "0.2.0",
"author": "Kai Dorschner https://github.com/krnlde/",

@@ -6,0 +6,0 @@ "repository": {

# hotRequire
hotRequire hot-loads modules by extending the system's require() function using the fs.fileWatch() routine (which already comes with node).
Hot-loading means it watches the file for changes and then reloades it's parsed content into the variable set by the user.
Hot-loading means it watches the file for changes and then reloades it's eval'd content into the variable set by the user.
Important: It does NOT rewrite the require(); method rahter than utilizing and extending it.
The file watcher emits catchable events to the process. These events are "modified", "removed" and "reloaded".

@@ -10,10 +12,22 @@

require('./hotrequire.js');
var hotrequire = require('./hotrequire.js');
var example = hotrequire('./example.js', function(module) {
example = module
});
// or
var example = require.hot('./example.js', function(module) {
example = module
});
console.log(example.message);
hotrequire('./example.js', this, 'module');
## Requirements
console.log(this.module.message);
* fs.js & node-waf & v8.h (Comes with node)
## Requirements
## Installation
* fs.js & node-waf & v8.h (Comes with node)
npm install hotrequire
var hotrequire = require('./hotrequire.js');
var example = hotrequire('./example.js', function(module) {
var example = require.hot('./examplemodule.js', function(module) {
example = module;

@@ -5,0 +5,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