Socket
Socket
Sign inDemoInstall

@11ty/eleventy-plugin-rss

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@11ty/eleventy-plugin-rss - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0-beta.1

src/virtualTemplate.js

32

.eleventy.js
const pkg = require("./package.json");
const dateRfc3339 = require("./src/dateRfc3339");
const dateRfc822 = require("./src/dateRfc822");
const getNewestCollectionItemDate = require("./src/getNewestCollectionItemDate");
const virtualTemplate = require("./src/virtualTemplate.js");
const absoluteUrl = require("./src/absoluteUrl");
const convertHtmlToAbsoluteUrls = require("./src/htmlToAbsoluteUrls");
const getNewestCollectionItemDate = require("./src/getNewestCollectionItemDate");
module.exports = function(eleventyConfig, options = {}) {
function eleventyRssPlugin(eleventyConfig, options = {}) {
try {

@@ -15,4 +17,6 @@ eleventyConfig.versionCheck(pkg["11ty"].compatibility);

// Deprecated in favor of the HTML <base> plugin bundled with Eleventy 2.0
eleventyConfig.addNunjucksFilter("absoluteUrl", absoluteUrl);
// Deprecated in favor of the HTML <base> plugin bundled with Eleventy 2.0
eleventyConfig.addNunjucksAsyncFilter("htmlToAbsoluteUrls", (htmlContent, base, callback) => {

@@ -39,11 +43,25 @@ if(!htmlContent) {

// Deprecated, these names are incorrect! Issue #8
eleventyConfig.addNunjucksFilter("rssLastUpdatedDate", collection => {
return dateRfc3339(getNewestCollectionItemDate(collection));
// Removed, this name is incorrect! Issue #8, #21
eleventyConfig.addNunjucksFilter("rssLastUpdatedDate", () => {
throw new Error("The `rssLastUpdatedDate` filter was removed. Use `getNewestCollectionItemDate | dateToRfc3339` (for Atom) or `getNewestCollectionItemDate | dateToRfc822` (for RSS) instead.")
});
// Deprecated, this name is incorrect! Issue #8
eleventyConfig.addNunjucksFilter("rssDate", dateRfc3339);
// Removed, this name is incorrect! Issue #8, #21
eleventyConfig.addNunjucksFilter("rssDate", () => {
throw new Error("The `rssDate` filter was removed. Use `dateToRfc3339` (for Atom) or `dateToRfc822` (for RSS) instead.");
});
};
Object.defineProperty(eleventyRssPlugin, "eleventyPackage", {
value: pkg.name
});
Object.defineProperty(eleventyRssPlugin, "eleventyPluginOptions", {
value: {
unique: true
}
});
module.exports = eleventyRssPlugin;
module.exports.feedPlugin = virtualTemplate;
module.exports.dateToRfc3339 = dateRfc3339;

@@ -50,0 +68,0 @@ module.exports.dateToRfc822 = dateRfc822;

{
"name": "@11ty/eleventy-plugin-rss",
"version": "1.2.0",
"version": "2.0.0-beta.1",
"description": "A pack of Eleventy plugins for generating an RSS feed using the Nunjucks templating engine.",

@@ -37,3 +37,3 @@ "publishConfig": {

"11ty": {
"compatibility": ">=0.11"
"compatibility": ">=2.0.0"
},

@@ -44,6 +44,7 @@ "devDependencies": {

"dependencies": {
"debug": "^4.3.4",
"posthtml": "^0.16.6",
"posthtml-urls": "1.0.0"
"@11ty/eleventy-utils": "^1.0.3",
"@11ty/posthtml-urls": "1.0.0",
"debug": "^4.3.5",
"posthtml": "^0.16.6"
}
}
const { URL } = require("url");
const debug = require("debug")("EleventyPluginRSS");
const debug = require("debug")("Eleventy:Rss");
// This is deprecated! Use the Eleventy HTML <base> plugin instead (2.0+)
module.exports = function(url, base) {

@@ -5,0 +6,0 @@ try {

@@ -1,8 +0,22 @@

const decompose = require("./decomposeDate");
module.exports = function pubDateRFC822(value) {
const date = new Date(value);
const options = {
weekday: 'short',
day: '2-digit',
month: 'short',
year: 'numeric',
module.exports = function(date) {
const { dayName, day, monthName, year, hours, minutes, seconds } = decompose(
date
);
return `${dayName}, ${day} ${monthName} ${year} ${hours}:${minutes}:${seconds} +0000`;
};
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
timeZoneName: 'short',
};
const formatedDate = new Intl.DateTimeFormat('en-US', options).format(date);
const [wkd, mmm, dd, yyyy, time, z] = formatedDate.replace(/([,\s+\-]+)/g, ' ').split(' ');
const tz = `${z}`.replace(/UTC/, 'GMT');
return `${wkd}, ${dd} ${mmm} ${yyyy} ${time} ${tz}`;
}
const posthtml = require('posthtml');
const urls = require('posthtml-urls')
const urls = require('@11ty/posthtml-urls')
const absoluteUrl = require("./absoluteUrl");
// This is deprecated! Use the Eleventy HTML <base> plugin instead (2.0+)
module.exports = async function(htmlContent, base, processOptions = {}) {
if( !base ) {
throw new Error( "eleventy-plugin-rss, htmlToAbsoluteUrls(absolutePostUrl) was missing the full URL base `absolutePostUrl` argument.")
throw new Error( "eleventy-plugin-rss: htmlToAbsoluteUrls(absolutePostUrl) was missing the full URL base `absolutePostUrl` argument.")
}

@@ -9,0 +10,0 @@

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