@11ty/eleventy-plugin-rss
Advanced tools
Comparing version 1.2.0 to 2.0.0-beta.1
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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14655
266
4
10
1
1
+ Added@11ty/eleventy-utils@^1.0.3
+ Added@11ty/posthtml-urls@1.0.0
+ Added@11ty/eleventy-utils@1.0.3(transitive)
+ Added@11ty/posthtml-urls@1.0.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedevaluate-value@2.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhttp-equiv-refresh@2.0.1(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.entries@1.1.8(transitive)
+ Addedset-function-length@1.2.2(transitive)
- Removedposthtml-urls@1.0.0
- Removedany-promise@0.1.0(transitive)
- Removedhttp-equiv-refresh@1.0.0(transitive)
- Removedposthtml-urls@1.0.0(transitive)
- Removedpromise-each@2.2.0(transitive)
Updateddebug@^4.3.5