Socket
Socket
Sign inDemoInstall

@bradymholt/ampify

Package Overview
Dependencies
25
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.4.0

40

index.js

@@ -13,7 +13,5 @@ const fs = require("fs");

xmlMode: options.xmlMode || false,
decodeEntities: options.decodeEntities || false
decodeEntities: options.decodeEntities || false,
};
const round = cheerioOptions.round
? numb => Math.round(numb / 5) * 5
: numb => numb;
const round = cheerioOptions.round ? (numb) => Math.round(numb / 5) * 5 : (numb) => numb;

@@ -30,5 +28,3 @@ // Load html

// add amp atrribute on root <html/>
$("html")
.first()
.attr("amp", "");
$("html").first().attr("amp", "");

@@ -41,5 +37,3 @@ // set charset to utf-8

headElement.find("meta[name='viewport']").remove();
headElement.append(
'<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">'
);
headElement.append('<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">');

@@ -53,6 +47,3 @@ // AMP boilerplate styles

// AMP script
if (
headElement.find("script[src='https://cdn.ampproject.org/v0.js']")
.length === 0
) {
if (headElement.find("script[src='https://cdn.ampproject.org/v0.js']").length === 0) {
scripts += "<script async src='https://cdn.ampproject.org/v0.js'></script>";

@@ -91,3 +82,3 @@ }

promises.push(
axios.get(imageUrl, { responseType: "arraybuffer" }).then(response => {
axios.get(imageUrl, { responseType: "arraybuffer" }).then((response) => {
externalSrcContent[src] = response;

@@ -119,3 +110,3 @@ })

promises.push(
axios.get(cssSrc).then(response => {
axios.get(cssSrc).then((response) => {
externalSrcContent[src] = response;

@@ -148,3 +139,3 @@ })

width: round(size.width),
height: round(size.height)
height: round(size.height),
});

@@ -160,3 +151,3 @@ }

width: round(size.width),
height: round(size.height)
height: round(size.height),
});

@@ -246,4 +237,3 @@ }

if (addYouTubeScript) {
scripts +=
"<script async custom-element='amp-youtube' src='https://cdn.ampproject.org/v0/amp-youtube-0.1.js'>";
scripts += "<script async custom-element='amp-youtube' src='https://cdn.ampproject.org/v0/amp-youtube-0.1.js'>";
}

@@ -255,6 +245,12 @@ if (addIFrameScript) {

// Remove <canvas/> elements
$("canvas").each((index, element) => {
const el = $(element);
el.remove();
});
// Convert other tags to AMP tags
let addVideoScript = false;
const includeTags = {
amp: ["img", "video"]
amp: ["img", "video"],
};

@@ -267,3 +263,3 @@ $(includeTags.amp.join(",")).each((index, element) => {

const ampElement = Object.assign(element, {
name: `amp-${element.name}`
name: `amp-${element.name}`,
});

@@ -270,0 +266,0 @@ $(element).html($(ampElement).html());

{
"name": "@bradymholt/ampify",
"version": "1.3.0",
"version": "1.4.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc