react-router-config
Advanced tools
Comparing version 4.4.0-beta.0 to 4.4.0-beta.1
{ | ||
"name": "react-router-config", | ||
"version": "4.4.0-beta.0", | ||
"version": "4.4.0-beta.1", | ||
"description": "Static route config matching for React Router", | ||
@@ -30,3 +30,3 @@ "repository": "ReactTraining/react-router", | ||
"react": ">=15", | ||
"react-router": "^4.3.1" | ||
"react-router": "4.4.0-beta.1" | ||
}, | ||
@@ -53,5 +53,3 @@ "devDependencies": { | ||
"react": "^16.4.0", | ||
"react-addons-test-utils": "^15.6.2", | ||
"react-dom": "^16.4.0", | ||
"react-router": "^4.3.1", | ||
"rollup": "^0.60.0", | ||
@@ -58,0 +56,0 @@ "rollup-plugin-babel": "^3.0.4", |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.ReactRouterConfig={},t.React)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},r=m,o=p,i=function(t,e){return l(p(t,e))},a=l,u=v,c=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function p(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=c.exec(t));){var p=n[0],s=n[1],l=n.index;if(a+=t.slice(i,l),i=l+p.length,s)a+=s[1];else{var d=t[i],y=n[2],v=n[3],m=n[4],b=n[5],g=n[6],w=n[7];a&&(r.push(a),a="");var x=null!=y&&null!=d&&d!==y,O="+"===g||"*"===g,E="?"===g||"*"===g,j=n[2]||u,_=m||b;r.push({name:v||o++,prefix:y||"",delimiter:j,optional:E,repeat:O,partial:x,asterisk:!!w,pattern:_?h(_):w?".*":"[^"+f(j)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function s(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function l(t){for(var e=new Array(t.length),r=0;r<t.length;r++)"object"==typeof t[r]&&(e[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r,o){for(var i="",a=r||{},u=(o||{}).pretty?s:encodeURIComponent,c=0;c<t.length;c++){var p=t[c];if("string"!=typeof p){var l,f=a[p.name];if(null==f){if(p.optional){p.partial&&(i+=p.prefix);continue}throw new TypeError('Expected "'+p.name+'" to be defined')}if(n(f)){if(!p.repeat)throw new TypeError('Expected "'+p.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(p.optional)continue;throw new TypeError('Expected "'+p.name+'" to not be empty')}for(var h=0;h<f.length;h++){if(l=u(f[h]),!e[c].test(l))throw new TypeError('Expected all "'+p.name+'" to match "'+p.pattern+'", but received `'+JSON.stringify(l)+"`");i+=(0===h?p.prefix:p.delimiter)+l}}else{if(l=p.asterisk?encodeURI(f).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):u(f),!e[c].test(l))throw new TypeError('Expected "'+p.name+'" to match "'+p.pattern+'", but received "'+l+'"');i+=p.prefix+l}}else i+=p}return i}}function f(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function h(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function d(t,e){return t.keys=e,t}function y(t){return t.sensitive?"":"i"}function v(t,e,r){n(e)||(r=e||r,e=[]);for(var o=(r=r||{}).strict,i=!1!==r.end,a="",u=0;u<t.length;u++){var c=t[u];if("string"==typeof c)a+=f(c);else{var p=f(c.prefix),s="(?:"+c.pattern+")";e.push(c),c.repeat&&(s+="(?:"+p+s+")*"),a+=s=c.optional?c.partial?p+"("+s+")?":"(?:"+p+"("+s+"))?":p+"("+s+")"}}var l=f(r.delimiter||"/"),h=a.slice(-l.length)===l;return o||(a=(h?a.slice(0,-l.length):a)+"(?:"+l+"(?=$))?"),a+=i?"$":o&&h?"":"(?="+l+"|$)",d(new RegExp("^"+a,y(r)),e)}function m(t,e,r){return n(e)||(r=e||r,e=[]),r=r||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return d(t,e)}(t,e):n(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(m(t[o],e,n).source);return d(new RegExp("(?:"+r.join("|")+")",y(n)),e)}(t,e,r):function(t,e,n){return v(p(t,n),e,n)}(t,e,r)}r.parse=o,r.compile=i,r.tokensToFunction=a,r.tokensToRegExp=u;var b={},g=1e4,w=0;function x(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e={path:e});var n=e,o=n.path,i=n.exact,a=void 0!==i&&i,u=n.strict,c=void 0!==u&&u,p=n.sensitive,s=function(t,e){var n=""+e.end+e.strict+e.sensitive,o=b[n]||(b[n]={});if(o[t])return o[t];var i=[],a={regexp:r(t,i,e),keys:i};return w<g&&(o[t]=a,w++),a}(o,{end:a,strict:c,sensitive:void 0!==p&&p}),l=s.regexp,f=s.keys,h=l.exec(t);if(!h)return null;var d=h[0],y=h.slice(1),v=t===d;return a&&!v?null:{path:o,url:"/"===o&&""===d?"/":d,isExact:v,params:f.reduce(function(t,e,n){return t[e.name]=y[n],t},{})}}var O="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function j(t,e){return t(e={exports:{}},e.exports),e.exports}var _=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}})()&&Object.assign;var T="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function P(){}var S=j(function(t){t.exports=function(){function t(t,e,n,r,o,i){if(i!==T){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=P,n.PropTypes=n,n}()}),k="__global_unique_id__",A=function(){return O[k]=(O[k]||0)+1};function M(t){return function(){return t}}var U=function(){};U.thatReturns=M,U.thatReturnsFalse=M(!1),U.thatReturnsTrue=M(!0),U.thatReturnsNull=M(null),U.thatReturnsThis=function(){return this},U.thatReturnsArgument=function(t){return t};var q=U,I=j(function(t,n){n.__esModule=!0;i(e);var r=i(S),o=i(A);i(q);function i(t){return t&&t.__esModule?t:{default:t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var p=1073741823;n.default=function(t,n){var i,s,l="__create-react-context-"+(0,o.default)()+"__",f=function(t){function e(){var n,r,o,i;a(this,e);for(var c=arguments.length,p=Array(c),s=0;s<c;s++)p[s]=arguments[s];return n=r=u(this,t.call.apply(t,[this].concat(p))),r.emitter=(o=r.props.value,i=[],{on:function(t){i.push(t)},off:function(t){i=i.filter(function(e){return e!==t})},get:function(){return o},set:function(t,e){o=t,i.forEach(function(t){return t(o,e)})}}),u(r,n)}return c(e,t),e.prototype.getChildContext=function(){var t;return(t={})[l]=this.emitter,t},e.prototype.componentWillReceiveProps=function(t){if(this.props.value!==t.value){var e=this.props.value,r=t.value,o=void 0;((i=e)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)?o=0:(o="function"==typeof n?n(e,r):p,0!=(o|=0)&&this.emitter.set(t.value,o))}var i,a},e.prototype.render=function(){return this.props.children},e}(e.Component);f.childContextTypes=((i={})[l]=r.default.object.isRequired,i);var h=function(e){function n(){var t,r;a(this,n);for(var o=arguments.length,i=Array(o),c=0;c<o;c++)i[c]=arguments[c];return t=r=u(this,e.call.apply(e,[this].concat(i))),r.state={value:r.getValue()},r.onUpdate=function(t,e){0!=((0|r.observedBits)&e)&&r.setState({value:r.getValue()})},u(r,t)}return c(n,e),n.prototype.componentWillReceiveProps=function(t){var e=t.observedBits;this.observedBits=void 0===e||null===e?p:e},n.prototype.componentDidMount=function(){this.context[l]&&this.context[l].on(this.onUpdate);var t=this.props.observedBits;this.observedBits=void 0===t||null===t?p:t},n.prototype.componentWillUnmount=function(){this.context[l]&&this.context[l].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[l]?this.context[l].get():t},n.prototype.render=function(){return(t=this.props.children,Array.isArray(t)?t[0]:t)(this.state.value);var t},n}(e.Component);return h.contextTypes=((s={})[l]=r.default.object,s),{Provider:f,Consumer:h}},t.exports=n.default});E(I);var N=E(j(function(t,n){n.__esModule=!0;var r=i(e),o=i(I);function i(t){return t&&t.__esModule?t:{default:t}}n.default=r.default.createContext||o.default,t.exports=n.default}))();function $(t,e){return{history:t.history,location:e.location,match:B.computeRootMatch(e.location.pathname),staticContext:t.staticContext}}N.Provider.displayName="Router.Provider",N.Consumer.displayName="Router.Consumer";var B=function(t){function n(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,e));return r.state={location:e.history.location},r.unlisten=e.history.listen(function(t){r.setState({location:t})}),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,t),n.computeRootMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}},n.prototype.getChildContext=function(){return{router:$(this.props,this.state)}},n.prototype.componentWillUnmount=function(){this.unlisten()},n.prototype.render=function(){var t=$(this.props,this.state);return e.createElement(N.Provider,{children:this.props.children||null,value:t})},n}(e.Component);B.childContextTypes={router:S.object.isRequired};var V=function(t,e,n,r,o,i,a,u){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,o,i,a,u],s=0;(c=new Error(e.replace(/%s/g,function(){return p[s++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}};var W=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,t),n.prototype.render=function(){var t=this;return e.createElement(N.Consumer,null,function(n){n||V(!1);var r=t.props.location||n.location,o=void 0,i=void 0;return e.Children.forEach(t.props.children,function(t){if(null==i&&e.isValidElement(t)){o=t;var a=t.props.path||t.props.from;i=a?x(r.pathname,Object.assign({},t.props,{path:a})):n.match}}),i?e.cloneElement(o,{location:r,computedMatch:i}):null})},n}(e.Component);function D(t,e){var n=t.location||e.location,r=t.computedMatch?t.computedMatch:t.path?x(n.pathname,t):e.match;return Object.assign({},e,{location:n,match:r})}var F=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,t),n.prototype.getChildContext=function(){this.context.router||V(!1);var t=this.context.router;return{router:D(this.props,t)}},n.prototype.render=function(){var t=this;return e.createElement(N.Consumer,null,function(n){n||V(!1);var r=D(t.props,n),o=t.props,i=o.children,a=o.component,u=o.render;return Array.isArray(i)&&0===i.length&&(i=null),"function"==typeof i&&void 0===(i=i(r))&&(i=null),e.createElement(N.Provider,{value:r},i&&!function(t){return 0===e.Children.count(t)}(i)?i:r.match?a?e.createElement(a,r):u?u(r):null:null)})},n}(e.Component);F.contextTypes={router:S.object.isRequired},F.childContextTypes={router:S.object.isRequired};var J=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};t.matchRoutes=function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.some(function(e){var o=e.path?x(n,e):r.length?r[r.length-1].match:B.computeRootMatch(n);return o&&(r.push({route:e,match:o}),e.routes&&t(e.routes,n,r)),o}),r},t.renderRoutes=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t?e.createElement(W,r,t.map(function(t,r){return e.createElement(F,{key:t.key||r,path:t.path,exact:t.exact,strict:t.strict,render:function(r){return t.render?t.render(Object.assign({},r,n,{route:t})):e.createElement(t.component,J({},r,n,{route:t}))}})})):null},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react-router/es/matchPath"),require("react-router/es/Router"),require("react"),require("react-router/es/Switch"),require("react-router/es/Route")):"function"==typeof define&&define.amd?define(["exports","react-router/es/matchPath","react-router/es/Router","react","react-router/es/Switch","react-router/es/Route"],t):t(e.ReactRouterConfig={},e.ReactRouter.matchPath,e.ReactRouter.Router,e.React,e.ReactRouter.Switch,e.ReactRouter.Route)}(this,function(e,t,r,o,u,a){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r,o=o&&o.hasOwnProperty("default")?o.default:o,u=u&&u.hasOwnProperty("default")?u.default:u,a=a&&a.hasOwnProperty("default")?a.default:a;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e};e.matchRoutes=function e(o,u){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return o.some(function(o){var n=o.path?t(u,o):a.length?a[a.length-1].match:r.computeRootMatch(u);return n&&(a.push({route:o,match:n}),o.routes&&e(o.routes,u,a)),n}),a},e.renderRoutes=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e?o.createElement(u,r,e.map(function(e,r){return o.createElement(a,{key:e.key||r,path:e.path,exact:e.exact,strict:e.strict,render:function(r){return e.render?e.render(Object.assign({},r,t,{route:e})):o.createElement(e.component,n({},r,t,{route:e}))}})})):null},Object.defineProperty(e,"__esModule",{value:!0})}); |
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26
18725
169