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

blog-engine-sac

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blog-engine-sac - npm Package Compare versions

Comparing version 7.12.0 to 7.13.0

4

changelog.md
# changelog
## 7.13.0
* Support every image type
## 7.12.0

@@ -4,0 +8,0 @@

2

html/category.html.js

@@ -25,3 +25,3 @@ export { createCategoryHtml };

<meta name="author" content="${author}">
<meta name="robots" content="noindex"></meta>
<meta name="robots" content="noindex">
<title>${options.tabTitle} - ${escapedCategoryName}</title>

@@ -28,0 +28,0 @@ ${styleSheets(options, topLevel)}

@@ -39,3 +39,4 @@ export { makeBackGroundPicture, makePostImagePicture, openGraphImage };

const makePostImagePicture = (name, alt) => {
const makePostImagePicture = (parsed, alt) => {
const { name, ext } = parsed
let prePath;

@@ -50,6 +51,6 @@ const topLevel = false;

return `<picture >
<source srcset="${prePath}/${imageDirectory}${name}.jpg" media="(min-width: 2000px)">
<source srcset="${prePath}/${imageDirectory}${standard}-${name}.jpg" media="(min-width: 992px)">
<img alt="${alt}" src="${prePath}/${imageDirectory}${small}-${name}.jpg" class="">
<source srcset="${prePath}/${imageDirectory}${name}${ext}" media="(min-width: 2000px)">
<source srcset="${prePath}/${imageDirectory}${standard}-${name}${ext}" media="(min-width: 992px)">
<img alt="${alt}" src="${prePath}/${imageDirectory}${small}-${name}${ext}">
</picture>`;
};

@@ -53,3 +53,3 @@ export { createIndexHtml };

return post.lang === lang;
})
});
const {length} = postsFromCategoryAndLang;

@@ -56,0 +56,0 @@ if (!length) {

@@ -6,3 +6,2 @@ export { makeUrl, linkFromPost, linkFromCategory, escapeHtml, indexFileName, indexLink, categoryFileName, postStartName};

import * as urls from "../defaultSettings/urls.js";
import { isLocalUrl } from '../source/urls.js';
import { translate } from '../translations/translate.js';

@@ -14,3 +13,3 @@

const linkFromCategory = (categoryName, {extensionLinks, lang, defaultLang}, subPath=``) => {
const linkFromCategory = (categoryName, {extensionLinks, lang, defaultLang}, subPath = ``) => {
return `<a href="${subPath}./${urls.categories}${categoryNameStart(categoryName, lang, defaultLang)}${extensionLinks}">${escapeHtml(translate(lang, categoryName))}</a>`;

@@ -25,3 +24,3 @@ };

if (post.isTranslation) {
base = `${base}-${post.lang}`
base = `${base}-${post.lang}`;
}

@@ -28,0 +27,0 @@ return slugify(base);

@@ -47,3 +47,3 @@ export {createPostHtml};

if (!options.indexed) {
indexMeta = `<meta name="robots" content="noindex"></meta>`;
indexMeta = `<meta name="robots" content="noindex">`;
}

@@ -50,0 +50,0 @@ let categoriesHtml = ``;

@@ -30,2 +30,3 @@ {

"html-minifier": "^4.0.0",
"http-code-from-text": "^1.0.1",
"is-relative-url": "^3.0.0",

@@ -39,12 +40,12 @@ "lunr": "^2.3.9",

"rollup-plugin-terser": "^7.0.2",
"sharp": "^0.28.1",
"stream-sac": "^1.14.0",
"sharp": "^0.28.2",
"stream-sac": "^1.15.14",
"utilsac": "^14.1.0"
},
"devDependencies": {
"cssnano": "^4.1.10",
"eslint": "^7.19.0",
"cssnano": "^5.0.2",
"eslint": "^7.26.0",
"eslint-config-red": "^1.8.1",
"import-postcss": "^8.0.2",
"postcss": "^7.0.15"
"postcss": "^8.2.15"
},

@@ -51,0 +52,0 @@ "eslintConfig": {

@@ -13,4 +13,6 @@ export { postFromFileDetails, processExternalPost, supportedFormats, getDetailsFromPost, initialPost, processPostAs, getPostDefault };

import { processPostAsMulti, formatMulti } from "./processors/multi.js";
import {
httpCodeFromText,
} from "http-code-from-text";
const supportedFormats = [

@@ -74,3 +76,3 @@ ...formatMulti,

return fetch(src).then(response => {
if (response.ok || response.status === 304 /* cache hit */) {
if (response.ok || response.status === Number(httpCodeFromText[`Not Modified`])) {
contentType = contentType || response.headers.get(`Content-Type`);

@@ -89,6 +91,8 @@ return response.text();

}
post.getContentPromise = () => Promise.resolve(text);
post.getContentPromise = () => {
return Promise.resolve(text);
};
post.getContentStream = () => {
return Readable.from(text);
}
};
return processPostAs(extension, post).getHtmlBody();

@@ -95,0 +99,0 @@ }).catch(error => {

@@ -17,3 +17,3 @@ /* stats.birthtime, can be later than modified date

import { /*generateTags, wordCount,*/ setFinalTags } from "./tags.js";
import { niceDateString, normalizeDate } from "./dates.js";
import { normalizeDate } from "./dates.js";
import { imageDirectory, staticCopies } from "./staticCopies.js";

@@ -97,3 +97,3 @@ import { generateSearchCode } from "./search.js";

}))
}));

@@ -149,3 +149,3 @@ };

return createPostHtml(Object.assign({}, commonOptions, post)).then(function (postInsideHTML) {
createNecessaryDirectoriesSync(`${blogPath}${postStartName(post)}.html`)
createNecessaryDirectoriesSync(`${blogPath}${postStartName(post)}.html`);
const dest = fs.createWriteStream(`${blogPath}${postStartName(post)}.html`);

@@ -171,4 +171,4 @@ postInsideHTML.pipe(dest);

translationsForThatLang[category.tag] = value;
})
})
});
});
};

@@ -248,3 +248,3 @@

return postFromFileDetails(detailedSource, metaArray, commonOptions);
}
};
}))).flat(Infinity)

@@ -278,3 +278,3 @@ .filter(Boolean).filter(post => {

if (postWithTranslation.externalMeta) {
externalMeta = postWithTranslation.externalMeta;;
externalMeta = postWithTranslation.externalMeta;
}

@@ -298,3 +298,3 @@ const temp = Object.assign({}, externalMeta, post);

const temp = Object.assign(getPostDefault(post), post);
Object.assign(post, temp)
Object.assign(post, temp);
});

@@ -301,0 +301,0 @@

@@ -35,3 +35,3 @@ export {

height: undefined, // scale with width
})
});
}

@@ -46,9 +46,9 @@ const standardPromise = standardImage.toFile(`${pathOut}${standard}-${imageName}`);

height: undefined, // scale with width
})
});
}
const smallPromise = smallImage.toFile(`${pathOut}${small}-${imageName}`);
return Promise.all([standardPromise, smallPromise]);
}).then(resolve).catch(reject)
}).then(resolve).catch(reject);
});
};

@@ -30,19 +30,18 @@ export { processPostAsMD, formatMD };

post.medias.push(source);
const temp = new URL(source, "https://example.com/");
const temp = new URL(source, `https://example.com/`);
const parsed = path.parse(temp.pathname);
const directory = parsed.dir;
const mime = mimeTypes.lookup(parsed.base);
if (mime.includes("audio")) {
if (mime.includes(`audio`)) {
return `<audio src="${source}" controls>${altText}</audio>`;
}
if (mime.includes("video")) {
if (mime.includes(`video`)) {
return `<video src="${source}" controls>${altText}</video>`;
}
if (!directory.includes(`images`)) {
console.warn(`relative image with source ${source} outside of /images`)
console.warn(`relative image with source ${source} outside of /images`);
return `<img alt="${altText}" src="${source}">`;
} else {
const baseName = parsed.name;
return makePostImagePicture(baseName, altText);
}
}
return makePostImagePicture(parsed, altText);
}

@@ -59,7 +58,7 @@ let temp;

i += 1;
let newName = `${slugify(post.base)}-${i}.${extension}`;
const newName = `${slugify(post.base)}-${i}.${extension}`;
let newPath = `${post.builtBlog}${imageDirectory}${newName}`;
let newSource = `../${imageDirectory}${newName}`;
// todo deduplicate
if (mime.includes("audio")) {
if (mime.includes(`audio`)) {
newPath = `${post.builtBlog}${audioDirectory}${newName}`;

@@ -70,3 +69,3 @@ newSource = `../${audioDirectory}${newName}`;

}
if (mime.includes("video")) {
if (mime.includes(`video`)) {
newPath = `${post.builtBlog}${videoDirectory}${newName}`;

@@ -79,3 +78,3 @@ newSource = `../${videoDirectory}${newName}`;

return `<img alt="${altText}" src="${newSource}">`;
}
},
}));

@@ -82,0 +81,0 @@ };

@@ -30,4 +30,4 @@ export { processPostAsMulti, formatMulti };

if (isLocalUrl(src)) {
const fileDetails = getDetailsFromPost(`${commonOptions.postsPath}${src}`)
const {fullPath, extension} = fileDetails
const fileDetails = getDetailsFromPost(`${commonOptions.postsPath}${src}`);
const {fullPath, extension} = fileDetails;

@@ -41,4 +41,4 @@ const post = initialPost(fileDetails, commonOptions);

};
processPostAs(extension, post, commonOptions)
Object.assign(post, postObject)
processPostAs(extension, post, commonOptions);
Object.assign(post, postObject);
basePromise = post;

@@ -51,5 +51,5 @@ } else {

return !isLocalUrl(translation.src)
return !isLocalUrl(translation.src);
}).map((translation) => {
return processExternalPost({ ...post, ...postObject, ...translation })
return processExternalPost({ ...post, ...postObject, ...translation });
}).concat(basePromise));

@@ -56,0 +56,0 @@ }

@@ -29,3 +29,5 @@ export { renderMarkdown };

return hljs.highlight(code, {language}).value;
} catch (__) {}
} catch (__) {
}
}

@@ -32,0 +34,0 @@

@@ -16,3 +16,3 @@ export {

const __dirname = path.dirname(__filename);
const modules = `${__dirname}/../node_modules/`
const modules = `${__dirname}/../node_modules/`;
const imageDirectory = `images/`;

@@ -66,5 +66,5 @@ const audioDirectory = `audio/`;

const { builtBlog, inputFolder } = options;
return copyDirectory(`${inputFolder}${videoDirectory}`, `${builtBlog}${videoDirectory}`).catch(function () {});;
return copyDirectory(`${inputFolder}${videoDirectory}`, `${builtBlog}${videoDirectory}`).catch(function () {});
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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