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

micro

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro - npm Package Compare versions

Comparing version 7.0.6 to 7.1.0

license.md

7

bin/micro.js

@@ -7,3 +7,2 @@ #!/usr/bin/env node

// Packages
const asyncToGen = require('async-to-gen/register')
const updateNotifier = require('update-notifier')

@@ -59,2 +58,3 @@ const nodeVersion = require('node-version')

if (!isAsyncSupported()) {
const asyncToGen = require('async-to-gen/register')
// Support for keywords "async" and "await"

@@ -64,4 +64,7 @@ const pathSep = process.platform === 'win32' ? '\\\\' : '/'

// This is required to make transpilation work on Windows
const fileDirectoryPath = path.parse(file).dir.split(path.sep).join(pathSep)
asyncToGen({
includes: new RegExp(`.*${directoryName}?${pathSep}(lib|bin)|${file}.*`),
includes: new RegExp(`.*${directoryName}?${pathSep}(lib|bin)|${fileDirectoryPath}.*`),
excludes: null,

@@ -68,0 +71,0 @@ sourceMaps: false

@@ -8,10 +8,10 @@ // Native

const isStream = require('isstream')
const Q = require('q')
const Promise = require('bluebird')
const {resolve} = Promise
const DEV = process.env.NODE_ENV === 'development'
const TESTING = process.env.NODE_ENV === 'test'
const serve = fn => server(Q.async(function * (req, res) {
yield exports.run(req, res, fn)
}))
const serve = fn => server((req, res) => exports.run(req, res, fn))

@@ -24,19 +24,16 @@ module.exports = exports = serve

exports.run = Q.async(function * (req, res, fn) {
try {
const val = yield fn(req, res)
exports.run = (req, res, fn) =>
resolve(fn(req, res))
.then(val => {
if (val === null) {
send(res, 204, null)
}
if (val === null) {
send(res, 204, null)
}
// Return a undefined-null value -> send
if (undefined !== val) {
send(res, res.statusCode || 200, val)
}
})
.catch(err => sendError(req, res, err))
// Return a undefined-null value -> send
if (undefined !== val) {
send(res, res.statusCode || 200, val)
}
} catch (err) {
sendError(req, res, err)
}
})
// maps requests to buffered raw bodies so that

@@ -129,5 +126,5 @@ // multiple calls to `json` work as expected

function sendError(req, res, {statusCode, message, stack}) {
function sendError(req, res, {statusCode, status, message, stack}) {
if (statusCode) {
send(res, statusCode, DEV ? stack : message)
send(res, statusCode || status, DEV ? stack : message)
} else {

@@ -134,0 +131,0 @@ send(res, 500, DEV ? stack : 'Internal Server Error')

{
"name": "micro",
"version": "7.0.6",
"version": "7.1.0",
"description": "Asynchronous HTTP microservices",

@@ -47,5 +47,5 @@ "main": "./lib/server.js",

"devDependencies": {
"ava": "0.18.1",
"husky": "0.13.1",
"request": "2.74.0",
"ava": "0.18.2",
"husky": "0.13.2",
"request": "2.80.0",
"request-promise": "4.1.1",

@@ -55,7 +55,8 @@ "resumer": "0.0.0",

"then-sleep": "1.0.1",
"xo": "0.17.0"
"xo": "0.17.1"
},
"dependencies": {
"args": "2.2.4",
"args": "2.3.0",
"async-to-gen": "1.3.2",
"bluebird": "3.5.0",
"boxen": "1.0.0",

@@ -65,3 +66,3 @@ "chalk": "1.1.3",

"detect-port": "1.1.0",
"ip": "1.1.4",
"ip": "1.1.5",
"is-async-supported": "1.2.0",

@@ -71,6 +72,5 @@ "isstream": "0.1.2",

"node-version": "1.0.0",
"q": "1.4.1",
"raw-body": "2.2.0",
"update-notifier": "1.0.3"
"update-notifier": "2.1.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