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

st

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

st - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

test/cli/tap-parallel-not-ok

3

bin/server.js
#!/usr/bin/env node
const st = require('../st.js')
const http = require('http')
const { STATUS_CODES } = http
let port = +(process.env.PORT || 1337)

@@ -183,3 +184,3 @@ let host

s.statusCode = 404
s.end('not found')
s.end(STATUS_CODES[s.statusCode])
}).listen(port, host, function () {

@@ -186,0 +187,0 @@ const addr = this.address()

{
"name": "st",
"version": "2.0.0",
"version": "3.0.0",
"description": "A module for serving static files. Does etags, caching, etc.",

@@ -9,5 +9,5 @@ "main": "st.js",

"async-cache": "^1.1.0",
"bl": "^4.0.0",
"fd": "~0.0.2",
"mime": "^2.4.4",
"bl": "^5.0.0",
"fd": "~0.0.3",
"mime": "^2.5.2",
"negotiator": "~0.6.2"

@@ -19,10 +19,10 @@ },

"devDependencies": {
"request": "^2.88.0",
"rimraf": "^3.0.0",
"standard": "^14.3.1",
"tap": "^14.9.2"
"request": "^2.88.2",
"rimraf": "^3.0.2",
"standard": "^16.0.3",
"tap": "^15.0.9"
},
"scripts": {
"lint": "standard",
"test": "npm run lint && tap test/*.js test/cli/*-test.js"
"test": "npm run lint && tap test/*.js test/cli/*-test.js --no-coverage"
},

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

@@ -16,2 +16,3 @@ const mime = require('mime')

const bl = require('bl')
const { STATUS_CODES } = http

@@ -118,4 +119,6 @@ const defaultCacheOptions = {

this.path = opt.path
this._index = opt.index === false ? false
: typeof opt.index === 'string' ? opt.index
this._index = opt.index === false
? false
: typeof opt.index === 'string'
? opt.index
: true

@@ -256,3 +259,3 @@ this.fdman = FD()

res.statusCode = 403
res.end('Forbidden')
res.end(STATUS_CODES[res.statusCode])
return true

@@ -353,5 +356,8 @@ }

error (er, res) {
res.statusCode = typeof er === 'number' ? er
: er.code === 'ENOENT' || er.code === 'EISDIR' ? 404
: er.code === 'EPERM' || er.code === 'EACCES' ? 403
res.statusCode = typeof er === 'number'
? er
: er.code === 'ENOENT' || er.code === 'EISDIR'
? 404
: er.code === 'EPERM' || er.code === 'EACCES'
? 403
: 500

@@ -365,3 +371,3 @@

res.setHeader('content-type', 'text/plain')
res.end(http.STATUS_CODES[res.statusCode] + '\n')
res.end(STATUS_CODES[res.statusCode] + '\n')
}

@@ -567,6 +573,10 @@

}).sort((a, b) => {
return a[2] === '-' && b[2] !== '-' ? -1 // dirs first
: a[2] !== '-' && b[2] === '-' ? 1
: a[0].toLowerCase() < b[0].toLowerCase() ? -1 // then alpha
: a[0].toLowerCase() > b[0].toLowerCase() ? 1
return a[2] === '-' && b[2] !== '-' // dirs first
? -1
: a[2] !== '-' && b[2] === '-'
? 1
: a[0].toLowerCase() < b[0].toLowerCase() // then alpha
? -1
: a[0].toLowerCase() > b[0].toLowerCase()
? 1
: 0

@@ -573,0 +583,0 @@ }).forEach((line) => {

@@ -7,3 +7,3 @@ const { test } = require('tap')

req('/st.js', (er, res, body) => {
t.ifError(er) &&
t.error(er) &&
t.equal(res.statusCode, 200) &&

@@ -13,3 +13,3 @@ t.equal(body.toString(), stExpect)

}, (er, stdout, stderr) => {
t.ifError(er)
t.error(er)
t.match(stdout, /^listening at http:\/\/(\[::\]|0\.0\.0\.0):[0-9]+\n$/)

@@ -24,3 +24,3 @@ t.equal(stderr, '')

req('/st.js', (er, res, body) => {
t.ifError(er) &&
t.error(er) &&
t.equal(res.statusCode, 200) &&

@@ -30,3 +30,3 @@ t.equal(body.toString(), stExpect)

}, (er, stdout, stderr) => {
t.ifError(er)
t.error(er)
t.match(stdout, /^listening at http:\/\/localhost:[0-9]+\n$/)

@@ -33,0 +33,0 @@ t.equal(stderr, '')

@@ -47,3 +47,3 @@ const os = require('os')

}, (err, stdout, stderr) => {
t.ifError(err)
t.error(err)
t.equal(stderr, '')

@@ -63,3 +63,3 @@ if (addr) {

if (canConnect) {
t.ifError(er, url) && t.equal(res.statusCode, 200, url)
t.error(er, url) && t.equal(res.statusCode, 200, url)
} else {

@@ -66,0 +66,0 @@ t.ok(er, url)

@@ -5,3 +5,3 @@ const path = require('path')

const request = require('request')
const { test, tearDown } = require('tap')
const { test, teardown } = require('tap')

@@ -60,3 +60,3 @@ const st = require('../st.js')

tearDown(() => {
teardown(() => {
server.close()

@@ -63,0 +63,0 @@ })

const path = require('path')
const http = require('http')
const request = require('request')
const { test, tearDown } = require('tap')
const { test, teardown } = require('tap')

@@ -40,3 +40,3 @@ const st = require('../st.js')

tearDown(() => {
teardown(() => {
server.close()

@@ -43,0 +43,0 @@ })

@@ -28,3 +28,3 @@ global.options = {

t.ok(body, 'returned a body')
t.notEqual(body.toString(), stExpect, 'gzipped string')
t.not(body.toString(), stExpect, 'gzipped string')

@@ -31,0 +31,0 @@ zlib.gunzip(body, (er, body) => {

const st = require('../st.js')
const { test, tearDown } = require('tap')
const { test, teardown } = require('tap')
const path = require('path')

@@ -45,3 +45,3 @@ const http = require('http')

tearDown(() => {
teardown(() => {
server.close()

@@ -48,0 +48,0 @@ })

Sorry, the diff of this file is not supported yet

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