netlify-cms-lib-util
Advanced tools
Comparing version
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.3.3](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util/compare/netlify-cms-lib-util@2.3.2...netlify-cms-lib-util@2.3.3) (2019-07-24) | ||
**Note:** Version bump only for package netlify-cms-lib-util | ||
## [2.3.2](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util/compare/netlify-cms-lib-util@2.3.2-beta.0...netlify-cms-lib-util@2.3.2) (2019-04-10) | ||
@@ -8,0 +16,0 @@ |
@@ -16,10 +16,2 @@ "use strict"; | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
const filterByPropExtension = (extension, propName) => arr => arr.filter(el => (0, _path.fileExtension)((0, _get2.default)(el, propName)) === extension); | ||
@@ -33,3 +25,3 @@ | ||
} catch (err) { | ||
throw new Error(`Response cannot be parsed into the expected format (${format}): ${err.message}`); | ||
throw new Error("Response cannot be parsed into the expected format (".concat(format, "): ").concat(err.message)); | ||
} | ||
@@ -43,3 +35,3 @@ }; | ||
if (!contentType.startsWith('application/json') && !contentType.startsWith('text/json')) { | ||
throw new Error(`${contentType} is not a valid JSON Content-Type`); | ||
throw new Error("".concat(contentType, " is not a valid JSON Content-Type")); | ||
} | ||
@@ -52,6 +44,3 @@ | ||
}).mapEntries((_ref) => { | ||
let _ref2 = _slicedToArray(_ref, 2), | ||
format = _ref2[0], | ||
formatter = _ref2[1]; | ||
let [format, formatter] = _ref; | ||
return [format, catchFormatErrors(format, formatter)]; | ||
@@ -61,10 +50,9 @@ }); | ||
const parseResponse = async function parseResponse(res) { | ||
let _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
_ref3$expectingOk = _ref3.expectingOk, | ||
expectingOk = _ref3$expectingOk === void 0 ? true : _ref3$expectingOk, | ||
_ref3$format = _ref3.format, | ||
format = _ref3$format === void 0 ? 'text' : _ref3$format; | ||
let { | ||
expectingOk = true, | ||
format = 'text' | ||
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (expectingOk && !res.ok) { | ||
throw new Error(`Expected an ok response, but received an error status: ${res.status}.`); | ||
throw new Error("Expected an ok response, but received an error status: ".concat(res.status, ".")); | ||
} | ||
@@ -75,3 +63,3 @@ | ||
if (!formatter) { | ||
throw new Error(`${format} is not a supported response format.`); | ||
throw new Error("".concat(format, " is not a supported response format.")); | ||
} | ||
@@ -78,0 +66,0 @@ |
@@ -36,11 +36,11 @@ "use strict"; | ||
const createCursorMap = function createCursorMap() { | ||
const _ref = arguments.length === 1 ? jsToMap(arguments.length <= 0 ? undefined : arguments[0]).toObject() : { | ||
const { | ||
actions, | ||
data, | ||
meta | ||
} = arguments.length === 1 ? jsToMap(arguments.length <= 0 ? undefined : arguments[0]).toObject() : { | ||
actions: arguments.length <= 0 ? undefined : arguments[0], | ||
data: arguments.length <= 1 ? undefined : arguments[1], | ||
meta: arguments.length <= 2 ? undefined : arguments[2] | ||
}, | ||
actions = _ref.actions, | ||
data = _ref.data, | ||
meta = _ref.meta; | ||
}; | ||
return (0, _immutable.Map)({ | ||
@@ -47,0 +47,0 @@ // actions are a Set, rather than a List, to ensure an efficient .has |
@@ -16,3 +16,7 @@ "use strict"; | ||
fr.onload = (_ref) => { | ||
let result = _ref.target.result; | ||
let { | ||
target: { | ||
result | ||
} | ||
} = _ref; | ||
return resolve((0, _jsSha.default)(result)); | ||
@@ -19,0 +23,0 @@ }; |
@@ -22,7 +22,7 @@ "use strict"; | ||
// It's a single file name, no directories. Prepend public folder | ||
return normalizePath(`/${basePath}/${path}`); | ||
return normalizePath("/".concat(basePath, "/").concat(path)); | ||
} // It's a relative path. Prepend a forward slash. | ||
return normalizePath(`/${path}`); | ||
return normalizePath("/".concat(path)); | ||
} | ||
@@ -29,0 +29,0 @@ /** |
@@ -22,18 +22,6 @@ "use strict"; | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
const decodeParams = paramsString => (0, _immutable.List)(paramsString.split('&')).map(s => (0, _immutable.List)(s.split('=')).map(decodeURIComponent)).update(_immutable.Map); | ||
const fromURL = wholeURL => { | ||
const _wholeURL$split = wholeURL.split('?'), | ||
_wholeURL$split2 = _slicedToArray(_wholeURL$split, 2), | ||
url = _wholeURL$split2[0], | ||
allParamsString = _wholeURL$split2[1]; | ||
const [url, allParamsString] = wholeURL.split('?'); | ||
return (0, _immutable.Map)(_objectSpread({ | ||
@@ -47,10 +35,7 @@ url | ||
const encodeParams = params => params.entrySeq().map((_ref) => { | ||
let _ref2 = _slicedToArray(_ref, 2), | ||
k = _ref2[0], | ||
v = _ref2[1]; | ||
return `${encodeURIComponent(k)}=${encodeURIComponent(v)}`; | ||
let [k, v] = _ref; | ||
return "".concat(encodeURIComponent(k), "=").concat(encodeURIComponent(v)); | ||
}).join('&'); | ||
const toURL = req => `${req.get('url')}${req.get('params') ? `?${encodeParams(req.get('params'))}` : ''}`; | ||
const toURL = req => "".concat(req.get('url')).concat(req.get('params') ? "?".concat(encodeParams(req.get('params'))) : ''); | ||
@@ -93,23 +78,7 @@ const toFetchArguments = req => [toURL(req), req.delete('url').delete('params').toJS()]; | ||
const _getPropSetFunctions = getPropSetFunctions(['method']), | ||
_getPropSetFunctions2 = _slicedToArray(_getPropSetFunctions, 2), | ||
withMethod = _getPropSetFunctions2[0], | ||
withDefaultMethod = _getPropSetFunctions2[1]; | ||
const [withMethod, withDefaultMethod] = getPropSetFunctions(['method']); | ||
const [withBody, withDefaultBody] = getPropSetFunctions(['body']); | ||
const [withParams, withDefaultParams] = getPropMergeFunctions(['params']); | ||
const [withHeaders, withDefaultHeaders] = getPropMergeFunctions(['headers']); // withRoot sets a root URL, unless the URL is already absolute | ||
const _getPropSetFunctions3 = getPropSetFunctions(['body']), | ||
_getPropSetFunctions4 = _slicedToArray(_getPropSetFunctions3, 2), | ||
withBody = _getPropSetFunctions4[0], | ||
withDefaultBody = _getPropSetFunctions4[1]; | ||
const _getPropMergeFunction = getPropMergeFunctions(['params']), | ||
_getPropMergeFunction2 = _slicedToArray(_getPropMergeFunction, 2), | ||
withParams = _getPropMergeFunction2[0], | ||
withDefaultParams = _getPropMergeFunction2[1]; | ||
const _getPropMergeFunction3 = getPropMergeFunctions(['headers']), | ||
_getPropMergeFunction4 = _slicedToArray(_getPropMergeFunction3, 2), | ||
withHeaders = _getPropMergeFunction4[0], | ||
withDefaultHeaders = _getPropMergeFunction4[1]; // withRoot sets a root URL, unless the URL is already absolute | ||
const absolutePath = new RegExp('^(?:[a-z]+:)?//', 'i'); | ||
@@ -121,3 +90,3 @@ const withRoot = getCurriedRequestProcessor((root, req) => req.update('url', p => { | ||
return root && p && p[0] !== '/' && root[root.length - 1] !== '/' ? `${root}/${p}` : `${root}${p}`; | ||
return root && p && p[0] !== '/' && root[root.length - 1] !== '/' ? "".concat(root, "/").concat(p) : "".concat(root).concat(p); | ||
})); // withTimestamp needs no argument and has to run as late as possible, | ||
@@ -124,0 +93,0 @@ // so it calls `withParams` only when it's actually called with a |
{ | ||
"name": "netlify-cms-lib-util", | ||
"description": "Shared utilities for Netlify CMS.", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"repository": "https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-lib-util", | ||
@@ -17,3 +17,3 @@ "bugs": "https://github.com/netlify/netlify-cms/issues", | ||
"build": "cross-env NODE_ENV=production webpack", | ||
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore **/__tests__ --root-mode upward" | ||
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward" | ||
}, | ||
@@ -28,3 +28,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "8867c5acb681908c4752d4d3c370640e566cd94a" | ||
"gitHead": "41559256d0f5612bc38dea4ebcd518d97ce25e05" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
809940
-0.38%1443
-1.9%