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

connect-livereload

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-livereload - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

18

index.js
module.exports = function livereload(opt) {
// options
var opt = opt || {};
var ignore = opt.ignore || opt.excludeList ||
[/\.js(\?.*)?$/, /\.css(\?.*)?$/, /\.svg(\?.*)?$/, /\.ico(\?.*)?$/, /\.woff(\?.*)?$/, /\.png(\?.*)?$/, /\.jpg(\?.*)?$/, /\.jpeg(\?.*)?$/];
var ignore = opt.ignore || opt.excludeList || [/\.js(\?.*)?$/, /\.css(\?.*)?$/, /\.svg(\?.*)?$/, /\.ico(\?.*)?$/,
/\.woff(\?.*)?$/, /\.png(\?.*)?$/, /\.jpg(\?.*)?$/, /\.jpeg(\?.*)?$/, /\.gif(\?.*)?$/, /\.pdf(\?.*)?$/
];
var include = opt.include || [/.*/];

@@ -15,3 +17,3 @@ var html = opt.html || _html;

}, {
match: /<\!DOCTYPE.+>/i,
match: /<\!DOCTYPE.+?>/i,
fn: append

@@ -31,3 +33,3 @@ }];

return new RegExp(matches);
return new RegExp(matches, 'i');
})();

@@ -79,5 +81,5 @@

function check(str, arr) {
if (!str) return true;
if (!str) return true;
return arr.some(function(item) {
if ( (item.test && item.test(str) ) || ~str.indexOf(item)) return true;
if ((item.test && item.test(str)) || ~str.indexOf(item)) return true;
return false;

@@ -142,4 +144,4 @@ });

var header = res.getHeader( 'content-length' );
if ( header ) res.removeHeader( 'content-length' );
var header = res.getHeader('content-length');
if (header) res.removeHeader('content-length');

@@ -146,0 +148,0 @@ writeHead.apply(res, arguments);

{
"name": "connect-livereload",
"description": "connect middleware for adding the livereload script to the response",
"version": "0.5.0",
"version": "0.5.1",
"author": "Andi Neck <andi.neck@intesso.com>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -59,3 +59,3 @@ connect-livereload

include: [/.*/],
// this function is used to determine if the content of `res.write` or `res.end` is html.

@@ -65,3 +65,3 @@ html: function (str) {

},
// rules are provided to find the place where the snippet should be inserted.

@@ -72,9 +72,9 @@ // the main problem is that on the server side it can be tricky to determine if a string will be valid html on the client.

rules: [{
match: /<\/body>(?![\s\S]*<\/body>)/,
match: /<\/body>(?![\s\S]*<\/body>)/i,
fn: prepend
}, {
match: /<\/html>(?![\s\S]*<\/html>)/,
match: /<\/html>(?![\s\S]*<\/html>)/i,
fn: prepend
}, {
match: /<\!DOCTYPE.+>/,
match: /<\!DOCTYPE.+?>/i,
fn: append

@@ -87,3 +87,3 @@ }],

// location where the script is provided (not by connect-livereload). Change this e.g. when serving livereload with a proxy.
src: "http://localhost:35729/livereload.js?snipver=1",
src: "http://localhost:35729/livereload.js?snipver=1",
```

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