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

gatsby-transformer-javascript-frontmatter

Package Overview
Dependencies
Maintainers
1
Versions
310
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-transformer-javascript-frontmatter - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

67

gatsby-node.js

@@ -21,3 +21,3 @@ "use strict";

loadNodeContent = _ref.loadNodeContent;
var createNode, createParentChildLink, code, options, exportsData, frontmatter, ast, parseData, objStr, contentDigest, nodeData;
var createNode, createParentChildLink, code, options, exportsData, frontmatter, error, ast, parseData, objStr, contentDigest, nodeData;
return _regenerator2.default.wrap(function _callee$(_context) {

@@ -49,3 +49,3 @@ while (1) {

};
exportsData = void 0, frontmatter = void 0;
exportsData = void 0, frontmatter = void 0, error = void 0;

@@ -81,2 +81,3 @@ try {

frontmatter = {};
error = false;
traverse(ast, {

@@ -106,40 +107,42 @@ AssignmentExpression: function AssignmentExpression(astPath) {

});
exportsData = (0, _extends3.default)({}, frontmatter, {
error: false
});
} catch (e) {
// stick the error on the query so the user can
// react to an error as they see fit
exportsData = (0, _extends3.default)({}, frontmatter, {
error: {
err: true,
code: e.code,
message: e.message,
stack: e.stack
}
});
error = {
err: true,
code: e.code,
message: e.message,
stack: e.stack
};
} finally {
objStr = JSON.stringify(node);
contentDigest = crypto.createHash(`md5`).update(objStr).digest(`hex`);
nodeData = {
id: `${node.id} >>> JavascriptFrontmatter`,
children: [],
parent: node.id,
node: (0, _extends3.default)({}, node),
internal: {
contentDigest,
type: `JavascriptFrontmatter`
}
};
// only create node if frontmatter is not empty
if (!_.isEmpty(frontmatter)) {
exportsData = (0, _extends3.default)({}, frontmatter, {
error: error
});
nodeData.frontmatter = (0, _extends3.default)({}, exportsData);
objStr = JSON.stringify(node);
contentDigest = crypto.createHash(`md5`).update(objStr).digest(`hex`);
nodeData = {
id: `${node.id} >>> JavascriptFrontmatter`,
children: [],
parent: node.id,
node: (0, _extends3.default)({}, node),
internal: {
contentDigest,
type: `JavascriptFrontmatter`
}
};
if (node.internal.type === `File`) {
nodeData.fileAbsolutePath = node.absolutePath;
nodeData.frontmatter = (0, _extends3.default)({}, exportsData);
if (node.internal.type === `File`) {
nodeData.fileAbsolutePath = node.absolutePath;
}
createNode(nodeData);
createParentChildLink({ parent: node, child: nodeData });
}
createNode(nodeData);
createParentChildLink({ parent: node, child: nodeData });
}

@@ -146,0 +149,0 @@

{
"name": "gatsby-transformer-javascript-frontmatter",
"version": "1.0.1",
"version": "1.0.2",
"description": "Gatsby transformer plugin for JavaScript to extract exports.frontmatter statically.",

@@ -5,0 +5,0 @@ "scripts": {

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