Socket
Socket
Sign inDemoInstall

fastboot

Package Overview
Dependencies
Maintainers
7
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastboot - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

4

package.json
{
"name": "fastboot",
"version": "3.0.2",
"version": "3.0.3",
"description": "Library for rendering Ember apps in node.js",

@@ -49,3 +49,3 @@ "keywords": [

"release-it": "^12.4.3",
"release-it-lerna-changelog": "^1.0.3",
"release-it-lerna-changelog": "^2.0.0",
"rimraf": "^3.0.1",

@@ -52,0 +52,0 @@ "temp": "^0.9.1"

@@ -55,5 +55,7 @@ 'use strict';

this._htmlAttributes,
this._htmlClass,
this._head,
this._body,
this._bodyAttributes
this._bodyAttributes,
this._bodyClass
);

@@ -77,5 +79,7 @@ }

this._htmlAttributes,
this._htmlClass,
this._head,
this._body,
this._bodyAttributes
this._bodyAttributes,
this._bodyClass
).then(html => {

@@ -179,13 +183,9 @@ let docParts = html.match(HTML_HEAD_REGEX);

if (htmlElement.attributes.length > 0) {
this._htmlAttributes = HTMLSerializer.attributes(htmlElement.attributes);
} else {
this._htmlAttributes = null;
}
let { klass: htmlClass, attributes: htmlAttributes } = extractExtraAttributes(htmlElement);
this._htmlClass = htmlClass;
this._htmlAttributes = htmlAttributes;
if (body.attributes.length > 0) {
this._bodyAttributes = HTMLSerializer.attributes(body.attributes);
} else {
this._bodyAttributes = null;
}
let { klass: bodyClass, attributes: bodyAttributes } = extractExtraAttributes(body);
this._bodyClass = bodyClass;
this._bodyAttributes = bodyAttributes;

@@ -205,2 +205,25 @@ if (head) {

function extractExtraAttributes(element) {
let klass;
let attributes;
if (element.attributes.length > 0) {
let elementClass = element.attributes.find(attr => attr.name === 'class');
if (elementClass) {
klass = elementClass;
let otherAttrs = element.attributes.filter(attr => attr.name !== 'class');
if (otherAttrs.length > 0) {
attributes = HTMLSerializer.attributes(otherAttrs);
} else {
attributes = null;
}
} else {
attributes = HTMLSerializer.attributes(element.attributes);
klass = null;
}
} else {
klass = attributes = null;
}
return { klass, attributes };
}
function missingTag(tag) {

@@ -212,3 +235,24 @@ throw new Error(

async function insertIntoIndexHTML(html, htmlAttributes, head, body, bodyAttributes) {
function addClass(html, regex, newClass) {
return html.replace(regex, function(_, tag, attributes) {
if (/class="([^"]*)"/i.test(attributes)) {
attributes = attributes.replace(/class="([^"]*)"/i, function(_, klass) {
return `class="${klass} ${newClass}"`;
});
} else {
attributes += ' class="' + newClass + '"';
}
return `<${tag}${attributes}>`;
});
}
async function insertIntoIndexHTML(
html,
htmlAttributes,
htmlClass,
head,
body,
bodyAttributes,
bodyClass
) {
if (!html) {

@@ -231,2 +275,5 @@ return Promise.resolve(html);

if (htmlClass) {
html = addClass(html, /<(html)(.*)>/i, htmlClass.value);
}
if (htmlAttributes) {

@@ -238,2 +285,5 @@ html = html.replace(/<html[^>]*/i, function(match) {

if (bodyClass) {
html = addClass(html, /<(body)(.*)>/i, bodyClass.value);
}
if (bodyAttributes) {

@@ -240,0 +290,0 @@ html = html.replace(/<body[^>]*/i, function(match) {

Sorry, the diff of this file is not supported yet

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