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

yog-view

Package Overview
Dependencies
Maintainers
4
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yog-view - npm Package Compare versions

Comparing version 0.3.1 to 0.3.3

71

index.js

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

'use strict';
var layer = require('./lib/layer.js');

@@ -13,4 +15,4 @@ var combine = require('./lib/combine.js');

settings.views = app.get('views');
var engineClass = _.resolveEngine(engine);
this.engine = new engineClass(app, settings);
var EngineClass = _.resolveEngine(engine);
this.engine = new EngineClass(app, settings);
this.settings = settings;

@@ -35,34 +37,39 @@ }

this.engine.makeStream(filepath, _.mixin(locals, {
_yog: prototols
}))
// 合并 tpl 流 和 bigpipe 流。
.pipe(combine(prototols))
// 设置默认content-type
.on('data', function () {
sentData = true;
if (!res.get('Content-Type')) {
res.type('html');
}
})
// bigpipe异步回调异常
.on('error', function (error) {
// 属于 chunk error
if (sentData) {
if (typeof settings.chunkErrorHandler === 'function') {
settings.chunkErrorHandler(error, res);
} else {
res.write('<script>window.console && console.error("chunk error", "' + error.message.replace(
/"/g,
"\\\"") + '")</script>');
_yog: prototols
}))
// 合并 tpl 流 和 bigpipe 流。
.pipe(combine(prototols))
// 设置默认content-type
.on('data', function () {
sentData = true;
if (!res.get('Content-Type')) {
res.type('html');
}
res.end();
} else {
// 模板渲染前报错,传递至next
done(error);
}
})
// 直接输出到 response.
.pipe(res);
setImmediate(function () {
res.flush();
});
})
// bigpipe异步回调异常
.on('error', function (error) {
// 属于 chunk error
if (sentData) {
if (typeof settings.chunkErrorHandler === 'function') {
settings.chunkErrorHandler(error, res);
}
else {
res.write('<script>window.console && console.error("chunk error", "' + error.message.replace(
/"/g,
'\\\"') + '")</script>');
}
res.end();
}
else {
// 模板渲染前报错,传递至next
done(error);
}
})
// 直接输出到 response.
.pipe(res);
};
module.exports = yogViewEngine;
module.exports = yogViewEngine;
{
"name": "yog-view",
"version": "0.3.1",
"version": "0.3.3",
"description": "An express.js middleware for optimizing the order of js\\css output, and enabling render template in bigpipe mode.",

@@ -5,0 +5,0 @@ "main": "index.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