Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.queue(null);
} catch (e) { this.emit('error', e); }
}
}
// To get a writable stream for use as a browserify transform, call
// require("regenerator")().
module.exports = exports;
// To include the runtime globally in the current node process, call
// require("regenerator").runtime().
function runtime() {
regeneratorRuntime = require("regenerator-runtime");
}
exports.runtime = runtime;
runtime.path = require("regenerator-runtime/path.js").path;
var cachedRuntimeCode;
function getRuntimeCode() {
return cachedRuntimeCode ||
(cachedRuntimeCode = fs.readFileSync(runtime.path, "utf8"));
}
var transformOptions = {
presets: [require("regenerator-preset")],
parserOpts: {
sourceType: "module",
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
allowSuperOutsideMethod: true,
strictMode: false,
plugins: ["*", "jsx", "flow"]
// NOTE: need to avoid hoisting generator functions or they'll happen
// before this definition. See garbageCollector definition below, e.g.
// TODO: The `Effect` type is not actually defined. Because 'redux-saga' does
// not use annotations, flow pretends that this import succeeds.
var regeneratorRuntime = require('regenerator-runtime');
var delay = function delay(ms) {
return new Promise(function (resolve) {
return setTimeout(resolve, ms);
});
};
var garbageCollector = regeneratorRuntime.mark(function garbageCollector() {
return regeneratorRuntime.wrap(function garbageCollector$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0, _effects.call)(delay, _cachePeriod.cachePeriod);
case 2:
_context.next = 4;
return (0, _effects.call)(delay, _cachePeriod.halfCachePeriod);
case 4:
_context.next = 6;
return (0, _effects.put)({ type: _actionTypes.GARBAGE_COLLECT, meta: { now: Date.now() } });
case 6:
var generateImagesAndUpdateNode = function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(node, resolve) {
var defaults, options, parentNode, imagePath, imageNode, fwToken, isFullWidth, nlToken, isNoLink, responsiveSizesResult, ratio, originalImg, fallbackSrc, srcSet, presentationWidth, srcSplit, fileName, fileNameNoExt, defaultAlt, rawHTML;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
defaults = {
maxWidth: 650,
wrapperStyle: '',
backgroundColor: 'white',
linkImagesToOriginal: true,
pathPrefix: pathPrefix
};
options = _.assign({}, pluginOptions, defaults);
// Check if this markdownNode has a File parent. This plugin
// won't work if the image isn't hosted locally.
return new Promise(function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(resolve, reject) {
var fileType, rawHTML;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
fileType = node.url.slice(-3);
// Ignore gifs as we can't process them,
// svgs as they are already responsive by definition
if (!(isRelativeUrl(node.url) && fileType !== 'gif' && fileType !== 'svg')) {
_context2.next = 10;
break;
}
_context2.next = 4;
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(node, resolve) {
var defaults, options, parentNode, imagePath, imageNode, fwToken, isFullWidth, nlToken, isNoLink, responsiveSizesResult, ratio, originalImg, fallbackSrc, srcSet, presentationWidth, srcSplit, fileName, fileNameNoExt, defaultAlt, rawHTML;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
defaults = {
maxWidth: 650,
wrapperStyle: '',
backgroundColor: 'white',
linkImagesToOriginal: true,
pathPrefix: pathPrefix
};
options = _.assign({}, pluginOptions, defaults);
// Check if this markdownNode has a File parent. This plugin
// won't work if the image isn't hosted locally.
parentNode = getNode(markdownNode.parent);
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(resolve, reject) {
var fileType, rawHTML;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
fileType = node.url.slice(-3);
// Ignore gifs as we can't process them,
// svgs as they are already responsive by definition
if (!(isRelativeUrl(node.url) && fileType !== 'gif' && fileType !== 'svg')) {
_context2.next = 10;
break;
}
_context2.next = 4;
return generateImagesAndUpdateNode(node, resolve);
return regeneratorRuntime.mark(function _crudSaga() {
return regeneratorRuntime.wrap(function _crudSaga$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
_context9.next = 2;
return (0, _effects.all)([(0, _effects.fork)(watchFetch(apiClient)), (0, _effects.fork)(watchFetchOne(apiClient)), (0, _effects.fork)(watchCreate(apiClient)), (0, _effects.fork)(watchUpdate(apiClient)), (0, _effects.fork)(watchDelete(apiClient)), (0, _effects.fork)(watchApiCall(apiClient)), (0, _effects.fork)(garbageCollector)]);
case 2:
case 'end':
return _context9.stop();
}
}
}, _crudSaga, this);
});
}
function updateDocumentOnServerWorker(action) {
var className, objectId, keys, parseDataBeforeSave, objectToUpdate, imputableData, res, errType;
return regeneratorRuntime.wrap(function updateDocumentOnServerWorker$(context$1$0) {
while (1) switch (context$1$0.prev = context$1$0.next) {
case 0:
className = action.className;
objectId = action.objectId;
keys = action.keys;
parseDataBeforeSave = action.parseDataBeforeSave;
if (objectId) {
context$1$0.next = 6;
break;
}
return context$1$0.abrupt('return');
case 6:
context$1$0.next = 8;
function getDocument(action) {
var className, objectId, include, res, errType, data;
return regeneratorRuntime.wrap(function getDocument$(context$1$0) {
while (1) switch (context$1$0.prev = context$1$0.next) {
case 0:
className = action.className;
objectId = action.objectId;
include = action.include;
context$1$0.next = 5;
return (0, _reduxSagaEffects.put)((0, _actions.setDocumentStatus)(objectId, START));
case 5:
return context$1$0.delegateYield((0, _serverApiSagaWrapper.httpRequest)(_serverApi2['default'].query, className, { objectId: objectId }, null, null, null, null, include, null), 't0', 6);
case 6:
res = context$1$0.t0;
if (!res.error) {
context$1$0.next = 14;
return regeneratorRuntime.mark(function _watchUpdate() {
return regeneratorRuntime.wrap(function _watchUpdate$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return (0, _effects.takeEvery)(_actionTypes.UPDATE, apiGeneric(apiClient));
case 2:
case 'end':
return _context6.stop();
}
}
}, _watchUpdate, this);
});
};