New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lego-bigpipe

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lego-bigpipe - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

test.js

53

index.js

@@ -12,9 +12,15 @@ 'use strict';

var pagelet = {};
var bigpipe = '';
var quickling = '';
pagelet.id = data.code;
pagelet.js = data.js || [];
var bigpipe = '<script>lego.onPageletArrive(' + JSON.stringify(pagelet) + ')</script>';
if (data.js) {
pagelet.js = data.js;
bigpipe = '<script>lego.onPageletArrive(' + JSON.stringify(pagelet) + ')</script>';
}
if (data.source && data.data) {
pagelet.html = ejs.render(data.source, {locals: data.data});
} else if (data.source) {
pagelet.html = data.source;
}

@@ -24,4 +30,6 @@

pagelet.css = data.css || [];
var quickling = 'lego.onPageletArrive(' + JSON.stringify(pagelet) + ');';
if (data.css) pagelet.css = data.css;
if (pagelet.html || pagelet.js || pagelet.css) {
quickling = 'lego.onPageletArrive(' + JSON.stringify(pagelet) + ');';
}

@@ -36,2 +44,4 @@ return {

exports.view = function (data, config) {
if (!data.code) data.code = uuid();
var pre = '<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n';

@@ -58,16 +68,28 @@ if (data.head) {

});
}
// combo units' css
if (data.body) {
var comboIds = [];
each(data.body.units, function (unit) {
if (unit.css) comboIds = comboIds.concat(unit.css);
// put units' css in head
if (data.body) {
var comboIds = {};
each(data.body.units, function (unit) {
each(unit.css, function (c) {
comboIds[c] = 1;
});
if (comboIds.length) {
});
comboIds = Object.keys(comboIds);
if (comboIds.length) {
if (config.combo) {
pre += ejs.render(styleLinkTpl, {locals: {
url: genUrl(comboIds, '.css.js', config)
}});
} else {
each(comboIds, function (id) {
pre += ejs.render(styleLinkTpl, {locals: {
url: genUrl(id, '.css.js', config)
}});
});
}
}
}
pre += ' </head>\n<body>\n';

@@ -133,3 +155,4 @@

function genUrl(ids, ext, config) {
ids = ids.slice();
if (type(ids) === 'string') ids = [ids];
else ids = ids.slice();
ext = ext || '';

@@ -143,2 +166,10 @@ each(ids, function (id, i) {

return url;
}
// from jqMobi
function uuid() {
function s4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
}
{
"name": "lego-bigpipe",
"version": "0.1.0",
"version": "0.1.1",
"description": "a bigpipe builder for scrat-lego",
"license": "MIT",
"main": ".",
"scripts": {
"test": "mocha"
},
"author": {

@@ -18,3 +21,7 @@ "name": "Hinc Liu",

"ejs": "^1.0.0"
},
"devDependencies": {
"mocha": "^1.21.4",
"should": "^4.0.4"
}
}
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