New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@node-static/node-static

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

@node-static/node-static - npm Package Compare versions

Comparing version
0.8.0
to
0.8.1
+2
-2
.github/workflows/node.js.yml

@@ -5,6 +5,6 @@ name: Node.js CI

branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:

@@ -11,0 +11,0 @@ build:

# CHANGES for `@node-static/node-static`
## 0.8.1
- fix: guard to avoid resending headers
## 0.8.0

@@ -4,0 +8,0 @@

'use strict';
var fs$1 = require('node:fs');
var fs = require('node:fs');
var events = require('node:events');
var http = require('node:http');
var path$1 = require('node:path');
var path = require('node:path');
var isHiddenFile = require('is-hidden-file');
var mime = require('mime');
var minimatch = require('minimatch');
var fs = require('fs');
var path = require('path');
var node_zlib = require('node:zlib');

@@ -51,2 +49,3 @@ var promises = require('node:stream/promises');

mtime: stats.reduce((latest, stat) => {
/* c8 ignore next -- Suppressing error for CI */
return latest > stat.mtime ? latest : stat.mtime;

@@ -68,4 +67,4 @@ }, new Date(-864e13)),

const gzip = node_zlib.createGzip();
const source = fs$1.createReadStream(input);
const destination = fs$1.createWriteStream(output);
const source = fs.createReadStream(input);
const destination = fs.createWriteStream(output);
return await promises.pipeline(source, gzip, destination);

@@ -92,3 +91,3 @@ }

// @ts-expect-error Works fine
fs$1.readFileSync(
fs.readFileSync(
new URL('../package.json', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('node-static.cjs', document.baseURI).href)))

@@ -106,3 +105,3 @@ )

try {
fs$1.stat(p, callback);
fs.stat(p, callback);
} catch (e) {

@@ -154,3 +153,3 @@ callback(/** @type {NodeJS.ErrnoException} */ (e));

// resolve() doesn't normalize (to lowercase) drive letters on Windows
this.root = path$1.normalize(path$1.resolve(root || '.'));
this.root = path.normalize(path.resolve(root || '.'));
/** @type {Required<Pick<ServerOptions, 'indexFile'>> & ServerOptions} */

@@ -225,3 +224,3 @@ this.options = {

const htmlIndex = path$1.join(pathname, this.options.indexFile);
const htmlIndex = path.join(pathname, this.options.indexFile);

@@ -251,3 +250,4 @@ tryStat(htmlIndex, (e, stat) => {

// Stream a directory of files as a single file.
fs$1.readFile(path$1.join(pathname, 'index.json'), function (e, contents) {
fs.readFile(path.join(pathname, 'index.json'), function (e, contents) {
/* c8 ignore next -- Suppressing error for CI */
if (e) { return finish(404, {}) }

@@ -326,4 +326,8 @@ const index = JSON.parse(contents.toString());

else {
res.writeHead(status, headers);
res.end();
if (!res.headersSent) {
res.writeHead(status, headers);
}
if (!res.writableEnded) {
res.end();
}
}

@@ -421,3 +425,3 @@ }

resolve (pathname) {
return path$1.resolve(path$1.join(this.root, pathname));
return path.resolve(path.join(this.root, pathname));
}

@@ -808,6 +812,6 @@

if (file) {
file = path$1.resolve(file) === path$1.normalize(file) ? file : path$1.join(pathname || '.', file);
file = path.resolve(file) === path.normalize(file) ? file : path.join(pathname || '.', file);
// Create the read stream
const readStream = fs$1.createReadStream(file, {
const readStream = fs.createReadStream(file, {
flags: 'r',

@@ -814,0 +818,0 @@ mode: 0o666,

@@ -188,2 +188,3 @@ import fs from 'node:fs';

fs.readFile(path.join(pathname, 'index.json'), function (e, contents) {
/* c8 ignore next -- Suppressing error for CI */
if (e) { return finish(404, {}) }

@@ -262,4 +263,8 @@ const index = JSON.parse(contents.toString());

else {
res.writeHead(status, headers);
res.end();
if (!res.headersSent) {
res.writeHead(status, headers);
}
if (!res.writableEnded) {
res.end();
}
}

@@ -266,0 +271,0 @@ }

@@ -1,3 +0,3 @@

import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';

@@ -39,2 +39,3 @@ /**

mtime: stats.reduce((latest, stat) => {
/* c8 ignore next -- Suppressing error for CI */
return latest > stat.mtime ? latest : stat.mtime;

@@ -41,0 +42,0 @@ }, new Date(-8640000000000000)),

{
"name": "@node-static/node-static",
"version": "0.8.0",
"version": "0.8.1",
"description": "simple, compliant file streaming module for node",

@@ -34,12 +34,2 @@ "author": "Alexis Sellier <alexis@cloudhead.io>",

},
"scripts": {
"prepublishOnly": "npm run build",
"tsc": "tsc",
"gzip": "node test/gzip.js",
"build": "rollup -c && tsc -p tsconfig-prod.json",
"start": "./bin/cli.js",
"lint": "eslint .",
"mocha": "mocha test/integration --parallel",
"test": "c8 npm run mocha"
},
"dependencies": {

@@ -90,3 +80,12 @@ "colors": "1.4.0",

"test": "test"
},
"scripts": {
"tsc": "tsc",
"gzip": "node test/gzip.js",
"build": "rollup -c && tsc -p tsconfig-prod.json",
"start": "./bin/cli.js",
"lint": "eslint .",
"mocha": "mocha test/integration --parallel",
"test": "npm run gzip && c8 npm run mocha"
}
}
}

@@ -1,2 +0,2 @@

# node-static
# @node-static/node-static

@@ -3,0 +3,0 @@ [![Node.js CI status](http://github.com/node-static/node-static/workflows/Node.js%20CI/badge.svg)](https://github.com/node-static/node-static/actions)