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

arthus

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arthus - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

lib/profiler.js

34

lib/dispatcher.js

@@ -13,2 +13,3 @@ //

var cookie = require('cookie');
var profiler = require('./profiler');

@@ -87,7 +88,10 @@ //

Dispatcher.prototype.dispatch = function (req, res) {
var start = Date.now();
var self = this;
var info = this.app.getLogger('info');
var warn = this.app.getLogger('error');
var self = this;
var info = this.app.getLogger('info');
var warn = this.app.getLogger('error');
var prof = this.app.getLogger('profiling');
req.profiler = new profiler(req.url, this.app.config.get('profiling'));
req.profiler.start('request');
var requestDomain = domain.create();

@@ -100,4 +104,5 @@ requestDomain.add(req);

req.on('finish', function () {
info('[%dms] %s', Date.now() - start, req.url);
res.on('finish', function () {
req.profiler.stop('request');
req.profiler.complete();
});

@@ -160,2 +165,3 @@

requestDomain.run(function () {
req.profiler.start('cookie_parsing');
if (req.headers && req.headers.cookie) {

@@ -167,7 +173,11 @@ req.cookies = cookie.parse(req.headers.cookie);

}
req.profiler.stop('cookie_parsing');
req.isAJAX = self.requestIsAJAX(req);
req.profiler.start('pre_request');
self.dispatchPreRequest(req, res, function (err) {
req.profiler.stop('pre_request');
if (err) throw err;
var method = req.method.toLowerCase();

@@ -191,3 +201,5 @@ var url = urllib.parse(req.url);

if (hasCallback) {
req.profiler.start('controller');
controller[action](req, res, target, function (err, views) {
req.profiler.stop('controller');
self.app.renderer.render(req, res, views);

@@ -197,3 +209,5 @@ });

else {
req.profiler.start('controller');
var views = controller[action](req, res, target);
req.profiler.stop('controller');
if (views) {

@@ -218,4 +232,6 @@ self.app.renderer.render(req, res, views);

function dispatch(func, req, res) {
function dispatch(func, req, res, name) {
return function (fn, result) {
fn = req.profiler.decorateCallback(name, fn);
req.profiler.start(name);
func(req, res, fn);

@@ -230,7 +246,7 @@ };

var handler = fn.pop();
var newHandler = dispatch(handler, req, res);
var newHandler = dispatch(handler, req, res, 'prerequest: ' + name);
fn.push(newHandler);
}
else if (typeof fn === 'function') {
fn = dispatch(fn, req, res);
fn = dispatch(fn, req, res, 'prerequest:' + name);
}

@@ -237,0 +253,0 @@

@@ -99,2 +99,3 @@ //

Renderer.prototype.render = function (req, res, struct) {
req.profiler.start('render');
var views = [];

@@ -211,2 +212,3 @@

req.profiler.stop('render');
res.end();

@@ -229,2 +231,3 @@ };

// End JSON response.
req.profiler.stop('render');
stream.end();

@@ -231,0 +234,0 @@ };

{
"name": "arthus",
"version": "0.0.9",
"version": "0.0.10",
"description": "Yet another web framework.",

@@ -5,0 +5,0 @@ "main": "application.js",

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