Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-feed

Package Overview
Dependencies
Maintainers
1
Versions
520
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-feed - npm Package Compare versions

Comparing version 1.0.9 to 1.3.0

111

gatsby-node.js

@@ -11,2 +11,6 @@ "use strict";

var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _promise = require("babel-runtime/core-js/promise");

@@ -16,6 +20,2 @@

var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");

@@ -37,2 +37,6 @@

var _lodash = require("lodash.merge");
var _lodash2 = _interopRequireDefault(_lodash);
var _internals = require("./internals");

@@ -46,4 +50,5 @@

var serialize = function serialize(_ref) {
var site = _ref.site,
allMarkdownRemark = _ref.allMarkdownRemark;
var _ref$query = _ref.query,
site = _ref$query.site,
allMarkdownRemark = _ref$query.allMarkdownRemark;
return allMarkdownRemark.edges.map(function (edge) {

@@ -63,3 +68,3 @@ return (0, _extends3.default)({}, edge.node.frontmatter, {

var _defaultOptions$plugi, query, setup, feeds, rest, globals, _loop, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, f;
var options, _loop, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, f;

@@ -76,10 +81,19 @@ return _regenerator2.default.wrap(function _callee$(_context2) {

*/
_defaultOptions$plugi = (0, _extends3.default)({}, _internals.defaultOptions, pluginOptions), query = _defaultOptions$plugi.query, setup = _defaultOptions$plugi.setup, feeds = _defaultOptions$plugi.feeds, rest = (0, _objectWithoutProperties3.default)(_defaultOptions$plugi, ["query", "setup", "feeds"]);
_context2.next = 4;
return (0, _internals.runQuery)(graphql, query);
options = (0, _extends3.default)({}, _internals.defaultOptions, pluginOptions);
case 4:
globals = _context2.sent;
if (!("query" in options)) {
_context2.next = 6;
break;
}
_context2.next = 5;
return (0, _internals.runQuery)(graphql, options.query);
case 5:
options.query = _context2.sent;
case 6:
_loop = _regenerator2.default.mark(function _loop(f) {
var locals, output, ctx, feed, items;
var _options$f, setup, locals, feed, serializer, items;
return _regenerator2.default.wrap(function _loop$(_context) {

@@ -89,4 +103,2 @@ while (1) {

case 0:
locals = {};
if (!f.query) {

@@ -97,13 +109,19 @@ _context.next = 5;

_context.next = 4;
_context.next = 3;
return (0, _internals.runQuery)(graphql, f.query);
case 4:
locals = _context.sent;
case 3:
f.query = _context.sent;
if (options.query) {
f.query = (0, _lodash2.default)(options.query, f.query);
delete options.query;
}
case 5:
output = _path2.default.join(publicPath, f.output);
ctx = (0, _extends3.default)({}, globals, locals);
feed = new _rss2.default(setup((0, _extends3.default)({}, rest, ctx)));
items = f.serialize ? f.serialize(ctx) : serialize(ctx);
_options$f = (0, _extends3.default)({}, options, f), setup = _options$f.setup, locals = (0, _objectWithoutProperties3.default)(_options$f, ["setup"]);
feed = new _rss2.default(setup(locals));
serializer = f.serialize && typeof f.serialize === "function" ? f.serialize : serialize;
items = serializer(locals);

@@ -114,5 +132,4 @@

});
_context.next = 12;
return (0, _internals.writeFile)(output, feed.xml());
return (0, _internals.writeFile)(_path2.default.join(publicPath, f.output), feed.xml());

@@ -129,8 +146,8 @@ case 12:

_iteratorError = undefined;
_context2.prev = 9;
_iterator = (0, _getIterator3.default)(feeds);
_context2.prev = 10;
_iterator = (0, _getIterator3.default)(options.feeds);
case 11:
case 12:
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context2.next = 17;
_context2.next = 18;
break;

@@ -140,22 +157,22 @@ }

f = _step.value;
return _context2.delegateYield(_loop(f), "t0", 14);
return _context2.delegateYield(_loop(f), "t0", 15);
case 14:
case 15:
_iteratorNormalCompletion = true;
_context2.next = 11;
_context2.next = 12;
break;
case 17:
_context2.next = 23;
case 18:
_context2.next = 24;
break;
case 19:
_context2.prev = 19;
_context2.t1 = _context2["catch"](9);
case 20:
_context2.prev = 20;
_context2.t1 = _context2["catch"](10);
_didIteratorError = true;
_iteratorError = _context2.t1;
case 23:
_context2.prev = 23;
case 24:
_context2.prev = 24;
_context2.prev = 25;

@@ -166,7 +183,7 @@ if (!_iteratorNormalCompletion && _iterator.return) {

case 26:
_context2.prev = 26;
case 27:
_context2.prev = 27;
if (!_didIteratorError) {
_context2.next = 29;
_context2.next = 30;
break;

@@ -177,12 +194,12 @@ }

case 29:
return _context2.finish(26);
case 30:
return _context2.finish(23);
return _context2.finish(27);
case 31:
return _context2.finish(24);
case 32:
return _context2.abrupt("return", _promise2.default.resolve());
case 32:
case 33:
case "end":

@@ -192,3 +209,3 @@ return _context2.stop();

}
}, _callee, undefined, [[9, 19, 23, 31], [24,, 26, 30]]);
}, _callee, undefined, [[10, 20, 24, 32], [25,, 27, 31]]);
}));

@@ -195,0 +212,0 @@

@@ -45,6 +45,7 @@ "use strict";

// Setup a few RSS object, merging on various feed-speciupfic options.
// Setup an RSS object, merging on various feed-specific options.
setup: function setup(_ref) {
var siteMetadata = _ref.site.siteMetadata,
rest = (0, _objectWithoutProperties3.default)(_ref, ["site"]);
var _ref$query = _ref.query,
siteMetadata = _ref$query.site.siteMetadata,
rest = (0, _objectWithoutProperties3.default)(_ref$query, ["site"]);

@@ -56,3 +57,3 @@ return (0, _extends3.default)({}, siteMetadata, rest);

feeds: [{
query: "\n {\n allMarkdownRemark(\n limit: 1000,\n sort: {\n order: DESC,\n fields: [frontmatter___date]\n },\n frontmatter: {\n draft: { ne: true }\n }\n ) {\n edges {\n node {\n frontmatter {\n title\n date\n }\n fields {\n slug\n }\n excerpt\n html\n }\n }\n }\n }\n ",
query: "\n {\n allMarkdownRemark(\n limit: 1000,\n sort: {\n order: DESC,\n fields: [frontmatter___date]\n },\n filter: {\n frontmatter: {\n draft: { ne: true }\n }\n }\n ) {\n edges {\n node {\n frontmatter {\n title\n date\n }\n fields {\n slug\n }\n excerpt\n html\n }\n }\n }\n }\n ",

@@ -59,0 +60,0 @@ // Where we will save the feed generated by this query.

{
"name": "gatsby-plugin-feed",
"version": "1.0.9",
"version": "1.3.0",
"description": "Creates an RSS feed for your Gatsby site.",

@@ -23,2 +23,3 @@ "main": "index.js",

"dependencies": {
"lodash.merge": "^4.6.0",
"pify": "^3.0.0",

@@ -25,0 +26,0 @@ "rss": "^1.2.2"

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