Socket
Socket
Sign inDemoInstall

ecstatic

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecstatic - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

lib/ecstatic/aliases.json

3

CHANGELOG.md

@@ -0,1 +1,4 @@

2015/10/02 Version 1.1.2
- Properly handle defaults in CLI args
2015/10/02 Version 1.1.1

@@ -2,0 +5,0 @@ - Properly handle boolean CLI args

18

lib/ecstatic.js

@@ -321,16 +321,10 @@ #! /usr/bin/env node

if (!module.parent) {
var defaults = require('./ecstatic/defaults.json')
var http = require('http'),
opts = require('minimist')(process.argv.slice(2), {
boolean: [
'showdir', 'showDir',
'humanreadable', 'humanReadable', 'human-readable',
'si', 'index',
'handleError', 'handleerror',
'cors', 'CORS',
'gzip',
'serverHeader', 'serverheader', 'server-header',
'weakEtags', 'weaketags', 'weak-etags',
'weakcompare', 'weakCompare', 'weak-compare', 'weak-Compare',
'handleOptionsMethod', 'handleoptionsmethod', 'handle-options-method'
]
alias: require('./ecstatic/aliases.json'),
default: defaults,
boolean: Object.keys(defaults).filter(function (key) {
return typeof defaults[key] === 'boolean'
})
}),

@@ -337,0 +331,0 @@ envPORT = parseInt(process.env.PORT, 10),

// This is so you can have options aliasing and defaults in one place.
var defaults = require('./defaults.json');
var aliases = require('./aliases.json')
module.exports = function (opts) {
var autoIndex = true,
showDir = true,
humanReadable = true,
si = false,
cache = 'max-age=3600',
gzip = false,
defaultExt = '.html',
handleError = true,
var autoIndex = defaults.autoIndex,
showDir = defaults.showDir,
humanReadable = defaults.humanReadable,
si = defaults.si,
cache = defaults.cache,
gzip = defaults.gzip,
defaultExt = defaults.defaultExt,
handleError = defaults.handleError,
headers = {},
serverHeader = true,
contentType = 'application/octet-stream',
serverHeader = defaults.serverHeader,
contentType = defaults.contentType,
mimeTypes,
weakEtags = false,
weakCompare = false,
handleOptionsMethod = false;
weakEtags = defaults.weakEtags,
weakCompare = defaults.weakCompare,
handleOptionsMethod = defaults.handleOptionsMethod;

@@ -26,6 +28,3 @@ function isDeclared(k) {

if (opts) {
[
'autoIndex',
'autoindex'
].some(function (k) {
aliases.autoIndex.some(function (k) {
if (isDeclared(k)) {

@@ -37,6 +36,3 @@ autoIndex = opts[k];

[
'showDir',
'showdir'
].some(function (k) {
aliases.showDir.some(function (k) {
if (isDeclared(k)) {

@@ -48,7 +44,3 @@ showDir = opts[k];

[
'humanReadable',
'humanreadable',
'human-readable'
].some(function (k) {
aliases.humanReadable.some(function (k) {
if (isDeclared(k)) {

@@ -60,6 +52,3 @@ humanReadable = opts[k];

[
'si',
'index'
].some(function (k) {
aliases.si.some(function (k) {
if (isDeclared(k)) {

@@ -88,6 +77,3 @@ si = opts[k];

[
'handleError',
'handleerror'
].some(function (k) {
aliases.handleError.some(function (k) {
if (isDeclared(k)) {

@@ -99,6 +85,3 @@ handleError = opts[k];

[
'cors',
'CORS'
].forEach(function(k) {
aliases.cors.forEach(function(k) {
if (isDeclared(k) && k) {

@@ -111,7 +94,3 @@ handleOptionsMethod = true;

[
'H',
'header',
'headers'
].forEach(function (k) {
aliases.headers.forEach(function (k) {
if (!isDeclared(k)) return;

@@ -135,7 +114,3 @@ if (Array.isArray(opts[k])) {

[
'serverHeader',
'serverheader',
'server-header'
].some(function (k) {
aliases.serverHeader.some(function (k) {
if (isDeclared(k)) {

@@ -147,7 +122,3 @@ serverHeader = opts[k];

[
'contentType',
'contenttype',
'content-type'
].some(function (k) {
aliases.contentType.some(function (k) {
if (isDeclared(k)) {

@@ -159,12 +130,3 @@ contentType = opts[k];

[
'mimetype',
'mimetypes',
'mimeType',
'mimeTypes',
'mime-type',
'mime-types',
'mime-Type',
'mime-Types'
].some(function (k) {
aliases.mimeType.some(function (k) {
if (isDeclared(k)) {

@@ -176,7 +138,3 @@ mimeTypes = opts[k];

[
'weakEtags',
'weaketags',
'weak-etags'
].some(function (k) {
aliases.weakEtags.some(function (k) {
if (isDeclared(k)) {

@@ -188,8 +146,3 @@ weakEtags = opts[k];

[
'weakcompare',
'weakCompare',
'weak-compare',
'weak-Compare',
].some(function (k) {
aliases.weakCompare.some(function (k) {
if (isDeclared(k)) {

@@ -201,9 +154,5 @@ weakCompare = opts[k];

[
'handleOptionsMethod',
'handleoptionsmethod',
'handle-options-method'
].some(function (k) {
aliases.handleOptionsMethod.some(function (k) {
if (isDeclared(k)) {
handleOptionsMethod = opts[k];
handleOptionsMethod = handleOptionsMethod || opts[k];
return true;

@@ -210,0 +159,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "A simple static file server middleware that works with both Express and Flatiron",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/jfhbrook/node-ecstatic",

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

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