gatsby-transformer-sharp
Advanced tools
Comparing version 1.0.0-alpha13-alpha.0189ea42 to 1.0.0-alpha13-alpha.215cabc2
@@ -1,27 +0,52 @@ | ||
const Promise = require("bluebird") | ||
"use strict"; | ||
const { onNodeCreate } = require("../src/gatsby-node") | ||
var _regenerator = require("babel-runtime/regenerator"); | ||
describe(`Process image nodes correctly`, () => { | ||
it(`correctly creates an ImageSharp node from a file image node`, async () => { | ||
const node = { | ||
id: "whatever", | ||
contentDigest: "whatever", | ||
extension: `png`, | ||
children: [], | ||
} | ||
const createNode = jest.fn() | ||
const updateNode = jest.fn() | ||
const boundActionCreators = { createNode, updateNode } | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
await onNodeCreate({ | ||
node, | ||
boundActionCreators, | ||
}).then(() => { | ||
expect(createNode.mock.calls).toMatchSnapshot() | ||
expect(updateNode.mock.calls).toMatchSnapshot() | ||
expect(createNode).toHaveBeenCalledTimes(1) | ||
expect(updateNode).toHaveBeenCalledTimes(1) | ||
}) | ||
}) | ||
}) | ||
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator"); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var Promise = require(`bluebird`); | ||
var _require = require(`../gatsby-node`), | ||
onNodeCreate = _require.onNodeCreate; | ||
describe(`Process image nodes correctly`, function () { | ||
it(`correctly creates an ImageSharp node from a file image node`, (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() { | ||
var node, createNode, updateNode, boundActionCreators; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
node = { | ||
id: `whatever`, | ||
contentDigest: `whatever`, | ||
extension: `png`, | ||
children: [] | ||
}; | ||
createNode = jest.fn(); | ||
updateNode = jest.fn(); | ||
boundActionCreators = { createNode, updateNode }; | ||
_context.next = 6; | ||
return onNodeCreate({ | ||
node, | ||
boundActionCreators | ||
}).then(function () { | ||
expect(createNode.mock.calls).toMatchSnapshot(); | ||
expect(updateNode.mock.calls).toMatchSnapshot(); | ||
expect(createNode).toHaveBeenCalledTimes(1); | ||
expect(updateNode).toHaveBeenCalledTimes(1); | ||
}); | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, undefined); | ||
}))); | ||
}); |
@@ -21,3 +21,3 @@ "use strict"; | ||
createNode = boundActionCreators.createNode, updateNode = boundActionCreators.updateNode; | ||
extensions = ["jpeg", "jpg", "png", "webp", "tif", "tiff", "svg"]; | ||
extensions = [`jpeg`, `jpg`, `png`, `webp`, `tif`, `tiff`, `svg`]; | ||
@@ -34,4 +34,4 @@ if (_.includes(extensions, node.extension)) { | ||
logical: true, | ||
id: `${ node.id } >> ImageSharp`, | ||
contentDigest: `${ node.id }`, | ||
id: `${node.id} >> ImageSharp`, | ||
contentDigest: `${node.id}`, | ||
parent: node.id, | ||
@@ -65,4 +65,4 @@ type: `ImageSharp`, | ||
var _ = require("lodash"); | ||
var _ = require(`lodash`); | ||
exports.onNodeCreate = onNodeCreate; |
{ | ||
"name": "gatsby-transformer-sharp", | ||
"version": "1.0.0-alpha13-alpha.0189ea42", | ||
"version": "1.0.0-alpha13-alpha.215cabc2", | ||
"description": "Gatsby transformer plugin for images using Sharp", | ||
@@ -18,8 +18,8 @@ "scripts": { | ||
"dependencies": { | ||
"bluebird": "^3.4.6", | ||
"bluebird": "^3.5.0", | ||
"unist-util-select": "^1.5.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.18.0" | ||
"babel-cli": "^6.24.1" | ||
} | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
6281
91
4
Updatedbluebird@^3.5.0