Socket
Socket
Sign inDemoInstall

sirv

Package Overview
Dependencies
3
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-next.7 to 1.0.0-next.8

26

build.js

@@ -10,3 +10,9 @@ const fs = require('fs');

function toAssume(uri, extns, toIgnore) {
function isMatch(uri, arr) {
for (let i=0; i < arr.length; i++) {
if (arr[i].test(uri)) return true;
}
}
function toAssume(uri, extns) {
let i=0, x, len=uri.length - 1;

@@ -17,8 +23,4 @@ if (uri.charCodeAt(len) === 47) {

for (; i < toIgnore.length; i++) {
if (toIgnore[i].test(uri)) return [uri];
}
let arr=[], tmp=`${uri}/index`;
for (i=0; i < extns.length; i++) {
for (; i < extns.length; i++) {
x = extns[i] ? `.${extns[i]}` : '';

@@ -32,4 +34,4 @@ if (uri) arr.push(uri + x);

function viaCache(ignores, uri, extns) {
let i=0, data, arr=toAssume(uri, extns, ignores);
function viaCache(uri, extns) {
let i=0, data, arr=toAssume(uri, extns);
for (; i < arr.length; i++) {

@@ -40,4 +42,4 @@ if (data = FILES[arr[i]]) return data;

function viaLocal(ignores, dir, isEtag, uri, extns) {
let i=0, arr=toAssume(uri, extns, ignores);
function viaLocal(dir, isEtag, uri, extns) {
let i=0, arr=toAssume(uri, extns);
let abs, stats, name, headers;

@@ -148,3 +150,3 @@ for (; i < arr.length; i++) {

let lookup = opts.dev ? viaLocal.bind(0, ignores, dir, isEtag) : viaCache.bind(0, ignores);
let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache;

@@ -159,3 +161,3 @@ return function (req, res, next) {

let pathname = req.path || parser(req, true).pathname;
let data = lookup(pathname, extns) || isSPA && lookup(fallback, extns);
let data = lookup(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup(fallback, extns);
if (!data) return next ? next() : isNotFound(req, res);

@@ -162,0 +164,0 @@

{
"name": "sirv",
"version": "1.0.0-next.7",
"version": "1.0.0-next.8",
"description": "The optimized & lightweight middleware for serving requests to static assets",

@@ -27,3 +27,3 @@ "repository": "lukeed/sirv",

},
"gitHead": "d08035833198db9b5cc8d1555c653fe9899a431f"
"gitHead": "db1786daf93c078d74809589678ec9b7aa011343"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc