react-router-breadcrumbs-hoc
Advanced tools
Comparing version 3.2.4 to 3.2.5
@@ -10,2 +10,3 @@ /* eslint-disable */ | ||
'@babel/preset-react', | ||
'@babel/preset-typescript' | ||
], | ||
@@ -12,0 +13,0 @@ plugins: [], |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),reactRouter=require("react-router");function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(r,!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}function _objectWithoutProperties(e,t){if(null==e)return{};var r,o,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var DEFAULT_MATCH_OPTIONS={exact:!0},NO_BREADCRUMB="NO_BREADCRUMB",humanize=function(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})},render=function(e){e.component;var t=e.breadcrumb,r=e.match,o=e.location,n=_objectWithoutProperties(e,["component","breadcrumb","match","location"]),a=_objectSpread2({match:r,location:o,key:r.url},n);return _objectSpread2({},a,{breadcrumb:"string"==typeof t?React.createElement("span",{key:a.key},t):React__default.createElement(t,a)})},getDefaultBreadcrumb=function(e){var t=e.pathSection,r=e.currentSection,o=e.location,n=reactRouter.matchPath(t,_objectSpread2({},DEFAULT_MATCH_OPTIONS,{path:t}));return render({breadcrumb:humanize(r),match:n,location:o})},getBreadcrumbMatch=function(e){var c,u=e.currentSection,i=e.disableDefaults,t=e.excludePaths,l=e.location,p=e.pathSection,r=e.routes;return t&&t.some(function(e){return reactRouter.matchPath(p,{path:e,exact:!0,strict:!1})})?NO_BREADCRUMB:(r.some(function(e){var t=e.breadcrumb,r=e.matchOptions,o=e.path,n=_objectWithoutProperties(e,["breadcrumb","matchOptions","path"]);if(!o)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var a=reactRouter.matchPath(p,_objectSpread2({},r||DEFAULT_MATCH_OPTIONS,{path:o}));return a&&null===t||!a&&r?(c=NO_BREADCRUMB,!0):!!a&&(c=!t&&i?NO_BREADCRUMB:render(_objectSpread2({breadcrumb:t||humanize(u),match:a,location:l},n)),!0)}),c||(i?NO_BREADCRUMB:getDefaultBreadcrumb({pathSection:p,currentSection:"/"===p?"Home":u,location:l})))},getBreadcrumbs=function(e){var n=e.routes,a=e.location,t=e.options,c=void 0===t?{}:t,u=[];return a.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(e,t){var r=t?"".concat(e,"/").concat(t):"/",o=getBreadcrumbMatch(_objectSpread2({currentSection:t,location:a,pathSection:r,routes:n},c));return o!==NO_BREADCRUMB&&u.push(o),"/"===r?"":r},null),u},flattenRoutes=function r(e){return(e||[]).reduce(function(e,t){return t.routes?e.concat([t].concat(_toConsumableArray(r(t.routes)))):e.concat(t)},[])},index=function(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],o=1<arguments.length?arguments[1]:void 0;return function(t){return reactRouter.withRouter(function(e){return React.createElement(t,_objectSpread2({},e,{breadcrumbs:getBreadcrumbs({routes:flattenRoutes(r),location:e.location,options:o})}))})}};exports.default=index,exports.getBreadcrumbs=getBreadcrumbs; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),reactRouter=require("react-router");function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}function _objectWithoutProperties(e,t){if(null==e)return{};var r,o,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var DEFAULT_MATCH_OPTIONS={exact:!0},NO_BREADCRUMB="NO_BREADCRUMB",humanize=function(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})},render=function(e){var t=e.breadcrumb,r=e.match,o=e.location,n=_objectWithoutProperties(e,["breadcrumb","match","location"]),a=_objectSpread2({match:r,location:o,key:r.url},n);return _objectSpread2({},a,{breadcrumb:"string"==typeof t?React.createElement("span",{key:a.key},t):React__default.createElement(t,a)})},getDefaultBreadcrumb=function(e){var t=e.currentSection,r=e.location,o=e.pathSection,n=reactRouter.matchPath(o,_objectSpread2({},DEFAULT_MATCH_OPTIONS,{path:o}))||{url:"not-found"};return render({breadcrumb:humanize(t),match:n,location:r})},getBreadcrumbMatch=function(e){var c,u=e.currentSection,i=e.disableDefaults,t=e.excludePaths,b=e.location,l=e.pathSection,r=e.routes;return t&&t.some(function(e){return reactRouter.matchPath(l,{path:e,exact:!0,strict:!1})})?NO_BREADCRUMB:(r.some(function(e){var t=e.breadcrumb,r=e.matchOptions,o=e.path,n=_objectWithoutProperties(e,["breadcrumb","matchOptions","path"]);if(!o)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var a=reactRouter.matchPath(l,_objectSpread2({},r||DEFAULT_MATCH_OPTIONS,{path:o}));return a&&null===t||!a&&r?(c=NO_BREADCRUMB,!0):!!a&&(c=!t&&i?NO_BREADCRUMB:render(_objectSpread2({breadcrumb:t||humanize(u),match:a,location:b},n)),!0)}),c||(i?NO_BREADCRUMB:getDefaultBreadcrumb({pathSection:l,currentSection:"/"===l?"Home":u,location:b})))},getBreadcrumbs=function(e){var n=e.routes,a=e.location,t=e.options,c=void 0===t?{}:t,u=[];return a.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(e,t){var r=t?"".concat(e,"/").concat(t):"/",o=getBreadcrumbMatch(_objectSpread2({currentSection:t,location:a,pathSection:r,routes:n},c));return o!==NO_BREADCRUMB&&u.push(o),"/"===r?"":r},""),u},flattenRoutes=function r(e){return e.reduce(function(e,t){return t.routes?e.concat([t].concat(_toConsumableArray(r(t.routes)))):e.concat(t)},[])},index=function(r,o){return function(t){return reactRouter.withRouter(function(e){return React.createElement(t,_objectSpread2({},e,{breadcrumbs:getBreadcrumbs({routes:flattenRoutes(r||[]),location:e.location,options:o})}))})}};exports.default=index,exports.getBreadcrumbs=getBreadcrumbs; | ||
//# sourceMappingURL=index.js.map |
@@ -38,3 +38,3 @@ import React, { createElement } from 'react'; | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -45,3 +45,3 @@ }); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -111,2 +111,4 @@ }); | ||
/* eslint-disable-next-line */ | ||
var DEFAULT_MATCH_OPTIONS = { | ||
@@ -134,7 +136,6 @@ exact: true | ||
var render = function render(_ref) { | ||
var reactRouterConfigComponent = _ref.component, | ||
Breadcrumb = _ref.breadcrumb, | ||
var Breadcrumb = _ref.breadcrumb, | ||
match = _ref.match, | ||
location = _ref.location, | ||
rest = _objectWithoutProperties(_ref, ["component", "breadcrumb", "match", "location"]); | ||
rest = _objectWithoutProperties(_ref, ["breadcrumb", "match", "location"]); | ||
@@ -159,8 +160,12 @@ var componentProps = _objectSpread2({ | ||
var getDefaultBreadcrumb = function getDefaultBreadcrumb(_ref2) { | ||
var pathSection = _ref2.pathSection, | ||
currentSection = _ref2.currentSection, | ||
location = _ref2.location; | ||
var currentSection = _ref2.currentSection, | ||
location = _ref2.location, | ||
pathSection = _ref2.pathSection; | ||
var match = matchPath(pathSection, _objectSpread2({}, DEFAULT_MATCH_OPTIONS, { | ||
path: pathSection | ||
})); | ||
})) | ||
/* istanbul ignore next: this is hard to mock in jest :( */ | ||
|| { | ||
url: 'not-found' | ||
}; | ||
return render({ | ||
@@ -185,3 +190,3 @@ breadcrumb: humanize(currentSection), | ||
routes = _ref3.routes; | ||
var breadcrumb; // Check the optional `exludePaths` option in `options` to see if the | ||
var breadcrumb; // Check the optional `excludePaths` option in `options` to see if the | ||
// current path should not include a breadcrumb. | ||
@@ -298,3 +303,3 @@ | ||
return pathSection === '/' ? '' : pathSection; | ||
}, null); | ||
}, ''); | ||
return matches; | ||
@@ -308,3 +313,3 @@ }; | ||
var flattenRoutes = function flattenRoutes(routes) { | ||
return (routes || []).reduce(function (arr, route) { | ||
return routes.reduce(function (arr, route) { | ||
if (route.routes) { | ||
@@ -318,10 +323,9 @@ return arr.concat([route].concat(_toConsumableArray(flattenRoutes(route.routes)))); | ||
var index = (function () { | ||
var routes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
var options = arguments.length > 1 ? arguments[1] : undefined; | ||
var index = (function (routes, options) { | ||
return function (Component) { | ||
return withRouter(function (props) { | ||
return createElement(Component, _objectSpread2({}, props, { | ||
// @ts-ignore-next-line | ||
breadcrumbs: getBreadcrumbs({ | ||
routes: flattenRoutes(routes), | ||
routes: flattenRoutes(routes || []), | ||
location: props.location, | ||
@@ -328,0 +332,0 @@ options: options |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","react-router"],e):e((t=t||self)["react-router-breadcrumbs-hoc"]={},t.React,t.ReactRouter)}(this,function(t,a,p){"use strict";var u="default"in a?a.default:a;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function s(o){for(var t=1;t<arguments.length;t++){var c=null!=arguments[t]?arguments[t]:{};t%2?e(c,!0).forEach(function(t){var e,r,n;e=o,n=c[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(c)):e(c).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(c,t))})}return o}function b(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},c=Object.keys(t);for(n=0;n<c.length;n++)r=c[n],0<=e.indexOf(r)||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(n=0;n<c.length;n++)r=c[n],0<=e.indexOf(r)||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function m(t){return t.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(t){return t.toUpperCase()})}function h(t){t.component;var e=t.breadcrumb,r=t.match,n=t.location,o=b(t,["component","breadcrumb","match","location"]),c=s({match:r,location:n,key:r.url},o);return s({},c,{breadcrumb:"string"==typeof e?a.createElement("span",{key:c.key},e):u.createElement(e,c)})}function i(t){var a,u=t.currentSection,i=t.disableDefaults,e=t.excludePaths,l=t.location,f=t.pathSection,r=t.routes;return e&&e.some(function(t){return p.matchPath(f,{path:t,exact:!0,strict:!1})})?y:(r.some(function(t){var e=t.breadcrumb,r=t.matchOptions,n=t.path,o=b(t,["breadcrumb","matchOptions","path"]);if(!n)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var c=p.matchPath(f,s({},r||d,{path:n}));return c&&null===e||!c&&r?(a=y,!0):!!c&&(a=!e&&i?y:h(s({breadcrumb:e||m(u),match:c,location:l},o)),!0)}),a||(i?y:function(t){var e=t.pathSection,r=t.currentSection,n=t.location,o=p.matchPath(e,s({},d,{path:e}));return h({breadcrumb:m(r),match:o,location:n})}({pathSection:f,currentSection:"/"===f?"Home":u,location:l})))}function c(t){var o=t.routes,c=t.location,e=t.options,a=void 0===e?{}:e,u=[];return c.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(t,e){var r=e?"".concat(t,"/").concat(e):"/",n=i(s({currentSection:e,location:c,pathSection:r,routes:o},a));return n!==y&&u.push(n),"/"===r?"":r},null),u}var d={exact:!0},y="NO_BREADCRUMB";t.default=function(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],n=1<arguments.length?arguments[1]:void 0;return function(e){return p.withRouter(function(t){return a.createElement(e,s({},t,{breadcrumbs:c({routes:function r(t){return(t||[]).reduce(function(t,e){return e.routes?t.concat([e].concat(o(r(e.routes)))):t.concat(e)},[])}(r),location:t.location,options:n})}))})}},t.getBreadcrumbs=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","react-router"],e):e((t=t||self)["react-router-breadcrumbs-hoc"]={},t.React,t.ReactRouter)}(this,function(t,a,b){"use strict";var u="default"in a?a.default:a;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m(o){for(var t=1;t<arguments.length;t++){var c=null!=arguments[t]?arguments[t]:{};t%2?e(Object(c),!0).forEach(function(t){var e,r,n;e=o,n=c[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(c)):e(Object(c)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(c,t))})}return o}function h(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},c=Object.keys(t);for(n=0;n<c.length;n++)r=c[n],0<=e.indexOf(r)||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(n=0;n<c.length;n++)r=c[n],0<=e.indexOf(r)||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function d(t){return t.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(t){return t.toUpperCase()})}function y(t){var e=t.breadcrumb,r=t.match,n=t.location,o=h(t,["breadcrumb","match","location"]),c=m({match:r,location:n,key:r.url},o);return m({},c,{breadcrumb:"string"==typeof e?a.createElement("span",{key:c.key},e):u.createElement(e,c)})}function i(t){var a,e,r,n,o,c,u=t.currentSection,i=t.disableDefaults,l=t.excludePaths,f=t.location,p=t.pathSection,s=t.routes;return l&&l.some(function(t){return b.matchPath(p,{path:t,exact:!0,strict:!1})})?v:(s.some(function(t){var e=t.breadcrumb,r=t.matchOptions,n=t.path,o=h(t,["breadcrumb","matchOptions","path"]);if(!n)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var c=b.matchPath(p,m({},r||O,{path:n}));return c&&null===e||!c&&r?(a=v,!0):!!c&&(a=!e&&i?v:y(m({breadcrumb:e||d(u),match:c,location:f},o)),!0)}),a||(i?v:(r=(e={pathSection:p,currentSection:"/"===p?"Home":u,location:f}).currentSection,n=e.location,o=e.pathSection,c=b.matchPath(o,m({},O,{path:o}))||{url:"not-found"},y({breadcrumb:d(r),match:c,location:n}))))}function c(t){var o=t.routes,c=t.location,e=t.options,a=void 0===e?{}:e,u=[];return c.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(t,e){var r=e?"".concat(t,"/").concat(e):"/",n=i(m({currentSection:e,location:c,pathSection:r,routes:o},a));return n!==v&&u.push(n),"/"===r?"":r},""),u}var O={exact:!0},v="NO_BREADCRUMB";t.default=function(r,n){return function(e){return b.withRouter(function(t){return a.createElement(e,m({},t,{breadcrumbs:c({routes:function r(t){return t.reduce(function(t,e){return e.routes?t.concat([e].concat(o(r(e.routes)))):t.concat(e)},[])}(r||[]),location:t.location,options:n})}))})}},t.getBreadcrumbs=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-router-breadcrumbs-hoc", | ||
"version": "3.2.4", | ||
"version": "3.2.5", | ||
"description": "small, flexible, higher order component for rendering breadcrumbs with react-router 4.x", | ||
@@ -15,3 +15,5 @@ "repository": "icd2k3/react-router-breadcrumbs-hoc", | ||
"test-build": "sh ./scripts/test-build.sh", | ||
"types": "tsc -p types/react-router-breadcrumbs-hoc", | ||
"types": "yarn type-src && yarn type-descriptions", | ||
"type-src": "tsc -p tsconfig.json", | ||
"type-descriptions": "tsc -p types/react-router-breadcrumbs-hoc", | ||
"travis": "sh ./scripts/travis.sh", | ||
@@ -23,4 +25,4 @@ "lint": "eslint ./src/**" | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS", | ||
"pre-commit": "yarn lint && yarn test", | ||
"pre-push": "yarn types && yarn lint && yarn test-build" | ||
"pre-commit": "yarn build && yarn lint && yarn test", | ||
"pre-push": "yarn build && yarn types && yarn lint && yarn test-build" | ||
} | ||
@@ -37,36 +39,38 @@ }, | ||
"devDependencies": { | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@babel/plugin-transform-modules-commonjs": "^7.5.0", | ||
"@babel/preset-env": "^7.5.5", | ||
"@babel/preset-react": "^7.0.0", | ||
"@commitlint/cli": "^8.1.0", | ||
"@commitlint/config-conventional": "^8.1.0", | ||
"@types/react": "^16.8.19", | ||
"@types/react-router-dom": "^4.3.3", | ||
"babel-core": "^7.0.0-0", | ||
"@babel/cli": "^7.8.3", | ||
"@babel/core": "^7.8.3", | ||
"@babel/preset-env": "^7.8.3", | ||
"@babel/preset-react": "^7.8.3", | ||
"@babel/preset-typescript": "^7.8.3", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@rollup/plugin-commonjs": "^11.0.1", | ||
"@rollup/plugin-node-resolve": "^7.0.0", | ||
"@types/react": "^16.9.19", | ||
"@types/react-router-dom": "^5.1.3", | ||
"@typescript-eslint/eslint-plugin": "^2.17.0", | ||
"@typescript-eslint/parser": "^2.17.0", | ||
"babel-eslint": "^10.0.2", | ||
"babel-jest": "^24.8.0", | ||
"coveralls": "^3.0.5", | ||
"enzyme": "^3.10.0", | ||
"enzyme-adapter-react-16": "^1.14.0", | ||
"eslint": "^6.0.1", | ||
"babel-jest": "^25.1.0", | ||
"coveralls": "^3.0.9", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb": "^18.0.1", | ||
"eslint-plugin-import": "^2.18.1", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.14.2", | ||
"husky": "^3.0.1", | ||
"jest": "^24.8.0", | ||
"eslint-plugin-react": "^7.18.0", | ||
"eslint-plugin-react-hooks": "^1.7.0", | ||
"husky": "^4.2.1", | ||
"jest": "^25.1.0", | ||
"js-yaml": "^3.13.1", | ||
"prop-types": "^15.7.2", | ||
"react": "16.9.0", | ||
"react-dom": "16.9.0", | ||
"react-router": "^5.0.1", | ||
"react-router-dom": "^5.0.1", | ||
"rollup": "^1.17.0", | ||
"react": "16.12.0", | ||
"react-dom": "16.12.0", | ||
"react-router": "^5.1.2", | ||
"react-router-dom": "^5.1.2", | ||
"rollup": "^1.29.1", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"typescript": "^3.5.1" | ||
"typescript": "^3.7.5" | ||
}, | ||
@@ -73,0 +77,0 @@ "keywords": [ |
@@ -6,3 +6,3 @@ <h3 align="center"> | ||
<p align="center"> | ||
A small (~1.5kb gzip), flexible, <a href="https://reactjs.org/docs/higher-order-components.html">higher order component</a> for rendering breadcrumbs with <a href="https://github.com/ReactTraining/react-router">react-router</a> 4 & 5 | ||
A small (~1.6kb gzip), flexible, <a href="https://reactjs.org/docs/higher-order-components.html">higher order component</a> for rendering breadcrumbs with <a href="https://github.com/ReactTraining/react-router">react-router</a> 4 & 5 | ||
</p> | ||
@@ -9,0 +9,0 @@ |
import babel from 'rollup-plugin-babel'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import { uglify } from 'rollup-plugin-uglify'; | ||
@@ -10,8 +10,12 @@ | ||
const extensions = ['.js', '.tsx']; | ||
const plugins = [ | ||
babel({ | ||
exclude: 'node_modules/**', | ||
extensions, | ||
}), | ||
resolve({ | ||
mainFields: ['module', 'main', 'umd'], | ||
extensions, | ||
}), | ||
@@ -32,3 +36,3 @@ ]; | ||
export default exports.map((item) => ({ | ||
input: 'src/index.js', | ||
input: 'src/index.tsx', | ||
plugins: item.plugins, | ||
@@ -35,0 +39,0 @@ external, |
@@ -16,2 +16,6 @@ // Type definitions for react-router-breadcrumbs-hoc 2.1 | ||
export interface Location { | ||
pathname: string | ||
} | ||
export interface MatchOptions { | ||
@@ -25,8 +29,9 @@ exact?: boolean; | ||
path: string; | ||
breadcrumb: React.ReactNode | string; | ||
breadcrumb?: React.ComponentType | React.ElementType | string; | ||
matchOptions?: MatchOptions; | ||
routes?: BreadcrumbsRoute[]; | ||
} | ||
export interface BreadcrumbsProps<T = {}> extends RouteComponentProps<T> { | ||
breadcrumb: React.ReactNode | string; | ||
breadcrumb: React.ComponentType | string; | ||
} | ||
@@ -33,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
70364
24
517
36