universal-router
Advanced tools
Comparing version 7.0.0 to 8.0.0
{ | ||
"private": true, | ||
"name": "generateUrls", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"description": "Universal Router Generate URLs Add-on", | ||
@@ -24,3 +24,4 @@ "homepage": "https://www.kriasoft.com/universal-router/", | ||
"module": "module.js", | ||
"esnext": "../src/generateUrls.js" | ||
"esnext": "../src/generateUrls.js", | ||
"types": "../src/generateUrls.d.ts" | ||
} |
{ | ||
"name": "universal-router", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"description": "Isomorphic router for JavaScript web applications", | ||
@@ -24,5 +24,6 @@ "homepage": "https://www.kriasoft.com/universal-router/", | ||
"esnext": "src/UniversalRouter.js", | ||
"types": "src/UniversalRouter.d.ts", | ||
"dependencies": { | ||
"path-to-regexp": "^2.4.0" | ||
"path-to-regexp": "^3.0.0" | ||
} | ||
} |
@@ -6,4 +6,4 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
typeof define === 'function' && define.amd ? define(['./universal-router.js'], factory) : | ||
(global.generateUrls = factory(global.UniversalRouter)); | ||
}(this, (function (UniversalRouter) { 'use strict'; | ||
(global = global || self, global.generateUrls = factory(global.UniversalRouter)); | ||
}(this, function (UniversalRouter) { 'use strict'; | ||
@@ -116,3 +116,3 @@ var pathToRegexp = UniversalRouter.pathToRegexp; | ||
}))); | ||
})); | ||
//# sourceMappingURL=universal-router-generate-urls.js.map |
/*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("./universal-router.min.js")):"function"==typeof define&&define.amd?define(["./universal-router.min.js"],r):e.generateUrls=r(e.UniversalRouter)}(this,function(e){"use strict";var w=e.pathToRegexp,B=new Map;return function(d,g){if(void 0===g&&(g={}),!(d instanceof e))throw new TypeError("An instance of UniversalRouter is expected");return d.routesByName=d.routesByName||new Map,function(e,r){var t=d.routesByName.get(e);if(!(t||(d.routesByName.clear(),function e(r,t,n){if(r.has(t.name))throw new Error('Route "'+t.name+'" already exists');if(t.name&&r.set(t.name,t),n)for(var a=0;a<n.length;a++){var o=n[a];o.parent=t,e(r,o,o.children)}}(d.routesByName,d.root,d.root.children),t=d.routesByName.get(e))))throw new Error('Route "'+e+'" not found');var n=B.get(t.fullPath);if(!n){for(var a="",o=t;o;){var i=Array.isArray(o.path)?o.path[0]:o.path;i&&(a=i+a),o=o.parent}for(var s=w.parse(a),u=w.tokensToFunction(s),f=Object.create(null),l=0;l<s.length;l++)"string"!=typeof s[l]&&(f[s[l].name]=!0);n={toPath:u,keys:f},B.set(a,n),t.fullPath=a}var y=d.baseUrl+n.toPath(r,g)||"/";if(g.stringifyQueryParams&&r){for(var c={},h=Object.keys(r),m=0;m<h.length;m++){var p=h[m];n.keys[p]||(c[p]=r[p])}var v=g.stringifyQueryParams(c);v&&(y+="?"===v.charAt(0)?v:"?"+v)}return y}}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("./universal-router.min.js")):"function"==typeof define&&define.amd?define(["./universal-router.min.js"],r):(e=e||self).generateUrls=r(e.UniversalRouter)}(this,function(e){"use strict";var w=e.pathToRegexp,B=new Map;return function(d,g){if(void 0===g&&(g={}),!(d instanceof e))throw new TypeError("An instance of UniversalRouter is expected");return d.routesByName=d.routesByName||new Map,function(e,r){var t=d.routesByName.get(e);if(!(t||(d.routesByName.clear(),function e(r,t,n){if(r.has(t.name))throw new Error('Route "'+t.name+'" already exists');if(t.name&&r.set(t.name,t),n)for(var a=0;a<n.length;a++){var o=n[a];o.parent=t,e(r,o,o.children)}}(d.routesByName,d.root,d.root.children),t=d.routesByName.get(e))))throw new Error('Route "'+e+'" not found');var n=B.get(t.fullPath);if(!n){for(var a="",o=t;o;){var i=Array.isArray(o.path)?o.path[0]:o.path;i&&(a=i+a),o=o.parent}for(var s=w.parse(a),u=w.tokensToFunction(s),f=Object.create(null),l=0;l<s.length;l++)"string"!=typeof s[l]&&(f[s[l].name]=!0);n={toPath:u,keys:f},B.set(a,n),t.fullPath=a}var y=d.baseUrl+n.toPath(r,g)||"/";if(g.stringifyQueryParams&&r){for(var c={},h=Object.keys(r),m=0;m<h.length;m++){var p=h[m];n.keys[p]||(c[p]=r[p])}var v=g.stringifyQueryParams(c);v&&(y+="?"===v.charAt(0)?v:"?"+v)}return y}}}); | ||
//# sourceMappingURL=universal-router-generate-urls.min.js.map |
@@ -6,4 +6,4 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.UniversalRouter = factory()); | ||
}(this, (function () { 'use strict'; | ||
(global = global || self, global.UniversalRouter = factory()); | ||
}(this, function () { 'use strict'; | ||
@@ -16,3 +16,2 @@ var pathToRegexp_1 = pathToRegexp; | ||
var DEFAULT_DELIMITER = '/'; | ||
var DEFAULT_DELIMITERS = './'; | ||
var PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g'); | ||
@@ -26,3 +25,3 @@ | ||
var defaultDelimiter = options && options.delimiter || DEFAULT_DELIMITER; | ||
var delimiters = options && options.delimiters || DEFAULT_DELIMITERS; | ||
var whitelist = options && options.whitelist || undefined; | ||
var pathEscaped = false; | ||
@@ -45,3 +44,2 @@ var res; | ||
var prev = ''; | ||
var next = str[index]; | ||
var name = res[2]; | ||
@@ -54,5 +52,7 @@ var capture = res[3]; | ||
var k = path.length - 1; | ||
var c = path[k]; | ||
var matches = whitelist ? whitelist.indexOf(c) > -1 : true; | ||
if (delimiters.indexOf(path[k]) > -1) { | ||
prev = path[k]; | ||
if (matches) { | ||
prev = c; | ||
path = path.slice(0, k); | ||
@@ -68,7 +68,6 @@ } | ||
var partial = prev !== '' && next !== undefined && next !== prev; | ||
var repeat = modifier === '+' || modifier === '*'; | ||
var optional = modifier === '?' || modifier === '*'; | ||
var pattern = capture || group; | ||
var delimiter = prev || defaultDelimiter; | ||
var pattern = capture || group; | ||
tokens.push({ | ||
@@ -80,4 +79,3 @@ name: name || key++, | ||
repeat: repeat, | ||
partial: partial, | ||
pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?' | ||
pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter) + ']+?' | ||
}); | ||
@@ -155,7 +153,3 @@ } | ||
if (token.optional) { | ||
if (token.partial) path += token.prefix; | ||
continue; | ||
} | ||
if (token.optional) continue; | ||
throw new TypeError('Expected "' + token.name + '" to be ' + (token.repeat ? 'an array' : 'a string')); | ||
@@ -192,3 +186,2 @@ } | ||
repeat: false, | ||
partial: false, | ||
pattern: null | ||
@@ -221,7 +214,5 @@ }); | ||
var end = options.end !== false; | ||
var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER); | ||
var delimiters = options.delimiters || DEFAULT_DELIMITERS; | ||
var delimiter = options.delimiter || DEFAULT_DELIMITER; | ||
var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|'); | ||
var route = start ? '^' : ''; | ||
var isEndDelimited = tokens.length === 0; | ||
@@ -233,3 +224,2 @@ for (var i = 0; i < tokens.length; i++) { | ||
route += escapeString(token); | ||
isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1; | ||
} else { | ||
@@ -240,4 +230,4 @@ var capture = token.repeat ? '(?:' + token.pattern + ')(?:' + escapeString(token.delimiter) + '(?:' + token.pattern + '))*' : token.pattern; | ||
if (token.optional) { | ||
if (token.partial) { | ||
route += escapeString(token.prefix) + '(' + capture + ')?'; | ||
if (!token.prefix) { | ||
route += '(' + capture + ')?'; | ||
} else { | ||
@@ -253,7 +243,9 @@ route += '(?:' + escapeString(token.prefix) + '(' + capture + '))?'; | ||
if (end) { | ||
if (!strict) route += '(?:' + delimiter + ')?'; | ||
if (!strict) route += '(?:' + escapeString(delimiter) + ')?'; | ||
route += endsWith === '$' ? '$' : '(?=' + endsWith + ')'; | ||
} else { | ||
if (!strict) route += '(?:' + delimiter + '(?=' + endsWith + '))?'; | ||
if (!isEndDelimited) route += '(?=' + delimiter + '|' + endsWith + ')'; | ||
var endToken = tokens[tokens.length - 1]; | ||
var isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined; | ||
if (!strict) route += '(?:' + escapeString(delimiter) + '(?=' + endsWith + '))?'; | ||
if (!isEndDelimited) route += '(?=' + escapeString(delimiter) + '|' + endsWith + ')'; | ||
} | ||
@@ -506,3 +498,3 @@ | ||
}))); | ||
})); | ||
//# sourceMappingURL=universal-router.js.map |
/*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.UniversalRouter=t()}(this,function(){"use strict";var v=u,e=a,t=function(e,t){return o(a(e,t))},r=o,n=i,T="/",A="./",O=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function a(e,t){for(var r,n,o=[],a=0,i=0,u="",l=t&&t.delimiter||T,p=t&&t.delimiters||A,s=!1;null!==(r=O.exec(e));){var f=r[0],c=r[1],h=r.index;if(u+=e.slice(i,h),i=h+f.length,c)u+=c[1],s=!0;else{var d="",v=e[i],g=r[2],m=r[3],y=r[4],x=r[5];if(!s&&u.length){var b=u.length-1;-1<p.indexOf(u[b])&&(d=u[b],u=u.slice(0,b))}u&&(o.push(u),u="",s=!1);var w=""!==d&&void 0!==v&&v!==d,E="+"===x||"*"===x,R="?"===x||"*"===x,j=d||l,k=m||y;o.push({name:g||a++,prefix:d,delimiter:j,optional:R,repeat:E,partial:w,pattern:k?(n=k,n.replace(/([=!:$/()])/g,"\\$1")):"[^"+U(j)+"]+?"})}}return(u||i<e.length)&&o.push(u+e.substr(i)),o}function o(p){for(var s=new Array(p.length),e=0;e<p.length;e++)"object"==typeof p[e]&&(s[e]=new RegExp("^(?:"+p[e].pattern+")$"));return function(e,t){for(var r="",n=t&&t.encode||encodeURIComponent,o=0;o<p.length;o++){var a=p[o];if("string"!=typeof a){var i,u=e?e[a.name]:void 0;if(Array.isArray(u)){if(!a.repeat)throw new TypeError('Expected "'+a.name+'" to not repeat, but got array');if(0===u.length){if(a.optional)continue;throw new TypeError('Expected "'+a.name+'" to not be empty')}for(var l=0;l<u.length;l++){if(i=n(u[l],a),!s[o].test(i))throw new TypeError('Expected all "'+a.name+'" to match "'+a.pattern+'"');r+=(0===l?a.prefix:a.delimiter)+i}}else if("string"!=typeof u&&"number"!=typeof u&&"boolean"!=typeof u){if(!a.optional)throw new TypeError('Expected "'+a.name+'" to be '+(a.repeat?"an array":"a string"));a.partial&&(r+=a.prefix)}else{if(i=n(String(u),a),!s[o].test(i))throw new TypeError('Expected "'+a.name+'" to match "'+a.pattern+'", but got "'+i+'"');r+=a.prefix+i}}else r+=a}return r}}function U(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function d(e){return e&&e.sensitive?"":"i"}function i(e,t,r){for(var n=(r=r||{}).strict,o=!1!==r.start,a=!1!==r.end,i=U(r.delimiter||T),u=r.delimiters||A,l=[].concat(r.endsWith||[]).map(U).concat("$").join("|"),p=o?"^":"",s=0===e.length,f=0;f<e.length;f++){var c=e[f];if("string"==typeof c)p+=U(c),s=f===e.length-1&&-1<u.indexOf(c[c.length-1]);else{var h=c.repeat?"(?:"+c.pattern+")(?:"+U(c.delimiter)+"(?:"+c.pattern+"))*":c.pattern;t&&t.push(c),c.optional?c.partial?p+=U(c.prefix)+"("+h+")?":p+="(?:"+U(c.prefix)+"("+h+"))?":p+=U(c.prefix)+"("+h+")"}}return a?(n||(p+="(?:"+i+")?"),p+="$"===l?"$":"(?="+l+")"):(n||(p+="(?:"+i+"(?="+l+"))?"),s||(p+="(?="+i+"|"+l+")")),new RegExp(p,d(r))}function u(e,t,r){return e instanceof RegExp?function(e,t){if(!t)return e;var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,pattern:null});return e}(e,t):Array.isArray(e)?function(e,t,r){for(var n=[],o=0;o<e.length;o++)n.push(u(e[o],t,r).source);return new RegExp("(?:"+n.join("|")+")",d(r))}(e,t,r):(n=t,i(a(e,o=r),n,o));var n,o}v.parse=e,v.compile=t,v.tokensToFunction=r,v.tokensToRegExp=n;var g=Object.prototype.hasOwnProperty,m=new Map;function y(t){try{return decodeURIComponent(t)}catch(e){return t}}function c(n,o,a,i,u){var l,p,s=0;return{next:function(e){if(n===e)return{done:!0};if(!l&&(l=function(e,t,r,n){var o=!e.children,a=(e.path||"")+"|"+o,i=m.get(a);if(!i){var u=[];i={keys:u,pattern:v(e.path||"",u,{end:o})},m.set(a,i)}var l=i.pattern.exec(t);if(!l)return null;for(var p=l[0],s=Object.assign({},n),f=1;f<l.length;f++){var c=i.keys[f-1],h=c.name,d=l[f];void 0===d&&g.call(s,h)||(c.repeat?s[h]=d?d.split(c.delimiter).map(y):[]:s[h]=d?y(d):d)}return{path:o||"/"!==p.charAt(p.length-1)?p:p.substr(1),keys:r.concat(i.keys),params:s}}(n,a,i,u)))return{done:!1,value:{route:n,baseUrl:o,path:l.path,keys:l.keys,params:l.params}};if(l&&n.children)for(;s<n.children.length;){if(!p){var t=n.children[s];t.parent=n,p=c(t,o+l.path,a.substr(l.path.length),l.keys,l.params)}var r=p.next(e);if(!r.done)return{done:!1,value:r.value};p=null,s++}return{done:!0}}}}function l(e,t){if("function"==typeof e.route.action)return e.route.action(e,t)}var p=function(){function e(e,t){if(void 0===t&&(t={}),!e||"object"!=typeof e)throw new TypeError("Invalid routes");this.baseUrl=t.baseUrl||"",this.errorHandler=t.errorHandler,this.resolveRoute=t.resolveRoute||l,this.context=Object.assign({router:this},t.context),this.root=Array.isArray(e)?{path:"",children:e,parent:null}:e,this.root.parent=null}return e.prototype.resolve=function(e){var t=this,a=Object.assign({},this.context,"string"==typeof e?{pathname:e}:e),i=c(this.root,this.baseUrl,a.pathname.substr(this.baseUrl.length),[],null),u=this.resolveRoute,l=null,p=null,s=a;function f(t,r,e){void 0===r&&(r=l.value.route);var n=null===e&&l.value.route;if(l=p||i.next(n),p=null,!t&&(l.done||!function(e,t){for(var r=t;r;)if((r=r.parent)===e)return!0;return!1}(r,l.value.route)))return p=l,Promise.resolve(null);if(l.done){var o=new Error("Route not found");return o.status=404,Promise.reject(o)}return s=Object.assign({},a,l.value),Promise.resolve(u(s,l.value.params)).then(function(e){return null!=e?e:f(t,r,e)})}return a.next=f,Promise.resolve().then(function(){return f(!0,t.root)}).catch(function(e){if(t.errorHandler)return t.errorHandler(e,s);throw e})},e}();return p.pathToRegexp=v,p}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).UniversalRouter=t()}(this,function(){"use strict";var d=u,e=a,t=function(e,t){return o(a(e,t))},r=o,n=i,k="/",T=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function a(e,t){for(var r,n,o=[],a=0,i=0,u="",l=t&&t.delimiter||k,s=t&&t.whitelist||void 0,p=!1;null!==(r=T.exec(e));){var f=r[0],c=r[1],h=r.index;if(u+=e.slice(i,h),i=h+f.length,c)u+=c[1],p=!0;else{var v="",d=r[2],g=r[3],m=r[4],y=r[5];if(!p&&u.length){var x=u.length-1,b=u[x];(!s||-1<s.indexOf(b))&&(v=b,u=u.slice(0,x))}u&&(o.push(u),u="",p=!1);var w="+"===y||"*"===y,E="?"===y||"*"===y,R=g||m,j=v||l;o.push({name:d||a++,prefix:v,delimiter:j,optional:E,repeat:w,pattern:R?(n=R,n.replace(/([=!:$/()])/g,"\\$1")):"[^"+A(j===l?j:j+l)+"]+?"})}}return(u||i<e.length)&&o.push(u+e.substr(i)),o}function o(s){for(var p=new Array(s.length),e=0;e<s.length;e++)"object"==typeof s[e]&&(p[e]=new RegExp("^(?:"+s[e].pattern+")$"));return function(e,t){for(var r="",n=t&&t.encode||encodeURIComponent,o=0;o<s.length;o++){var a=s[o];if("string"!=typeof a){var i,u=e?e[a.name]:void 0;if(Array.isArray(u)){if(!a.repeat)throw new TypeError('Expected "'+a.name+'" to not repeat, but got array');if(0===u.length){if(a.optional)continue;throw new TypeError('Expected "'+a.name+'" to not be empty')}for(var l=0;l<u.length;l++){if(i=n(u[l],a),!p[o].test(i))throw new TypeError('Expected all "'+a.name+'" to match "'+a.pattern+'"');r+=(0===l?a.prefix:a.delimiter)+i}}else if("string"!=typeof u&&"number"!=typeof u&&"boolean"!=typeof u){if(!a.optional)throw new TypeError('Expected "'+a.name+'" to be '+(a.repeat?"an array":"a string"))}else{if(i=n(String(u),a),!p[o].test(i))throw new TypeError('Expected "'+a.name+'" to match "'+a.pattern+'", but got "'+i+'"');r+=a.prefix+i}}else r+=a}return r}}function A(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function v(e){return e&&e.sensitive?"":"i"}function i(e,t,r){for(var n=(r=r||{}).strict,o=!1!==r.start,a=!1!==r.end,i=r.delimiter||k,u=[].concat(r.endsWith||[]).map(A).concat("$").join("|"),l=o?"^":"",s=0;s<e.length;s++){var p=e[s];if("string"==typeof p)l+=A(p);else{var f=p.repeat?"(?:"+p.pattern+")(?:"+A(p.delimiter)+"(?:"+p.pattern+"))*":p.pattern;t&&t.push(p),p.optional?p.prefix?l+="(?:"+A(p.prefix)+"("+f+"))?":l+="("+f+")?":l+=A(p.prefix)+"("+f+")"}}if(a)n||(l+="(?:"+A(i)+")?"),l+="$"===u?"$":"(?="+u+")";else{var c=e[e.length-1],h="string"==typeof c?c[c.length-1]===i:void 0===c;n||(l+="(?:"+A(i)+"(?="+u+"))?"),h||(l+="(?="+A(i)+"|"+u+")")}return new RegExp(l,v(r))}function u(e,t,r){return e instanceof RegExp?function(e,t){if(!t)return e;var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return e}(e,t):Array.isArray(e)?function(e,t,r){for(var n=[],o=0;o<e.length;o++)n.push(u(e[o],t,r).source);return new RegExp("(?:"+n.join("|")+")",v(r))}(e,t,r):(n=t,i(a(e,o=r),n,o));var n,o}d.parse=e,d.compile=t,d.tokensToFunction=r,d.tokensToRegExp=n;var g=Object.prototype.hasOwnProperty,m=new Map;function y(t){try{return decodeURIComponent(t)}catch(e){return t}}function c(n,o,a,i,u){var l,s,p=0;return{next:function(e){if(n===e)return{done:!0};if(!l&&(l=function(e,t,r,n){var o=!e.children,a=(e.path||"")+"|"+o,i=m.get(a);if(!i){var u=[];i={keys:u,pattern:d(e.path||"",u,{end:o})},m.set(a,i)}var l=i.pattern.exec(t);if(!l)return null;for(var s=l[0],p=Object.assign({},n),f=1;f<l.length;f++){var c=i.keys[f-1],h=c.name,v=l[f];void 0===v&&g.call(p,h)||(c.repeat?p[h]=v?v.split(c.delimiter).map(y):[]:p[h]=v?y(v):v)}return{path:o||"/"!==s.charAt(s.length-1)?s:s.substr(1),keys:r.concat(i.keys),params:p}}(n,a,i,u)))return{done:!1,value:{route:n,baseUrl:o,path:l.path,keys:l.keys,params:l.params}};if(l&&n.children)for(;p<n.children.length;){if(!s){var t=n.children[p];t.parent=n,s=c(t,o+l.path,a.substr(l.path.length),l.keys,l.params)}var r=s.next(e);if(!r.done)return{done:!1,value:r.value};s=null,p++}return{done:!0}}}}function l(e,t){if("function"==typeof e.route.action)return e.route.action(e,t)}var s=function(){function e(e,t){if(void 0===t&&(t={}),!e||"object"!=typeof e)throw new TypeError("Invalid routes");this.baseUrl=t.baseUrl||"",this.errorHandler=t.errorHandler,this.resolveRoute=t.resolveRoute||l,this.context=Object.assign({router:this},t.context),this.root=Array.isArray(e)?{path:"",children:e,parent:null}:e,this.root.parent=null}return e.prototype.resolve=function(e){var t=this,a=Object.assign({},this.context,"string"==typeof e?{pathname:e}:e),i=c(this.root,this.baseUrl,a.pathname.substr(this.baseUrl.length),[],null),u=this.resolveRoute,l=null,s=null,p=a;function f(t,r,e){void 0===r&&(r=l.value.route);var n=null===e&&l.value.route;if(l=s||i.next(n),s=null,!t&&(l.done||!function(e,t){for(var r=t;r;)if((r=r.parent)===e)return!0;return!1}(r,l.value.route)))return s=l,Promise.resolve(null);if(l.done){var o=new Error("Route not found");return o.status=404,Promise.reject(o)}return p=Object.assign({},a,l.value),Promise.resolve(u(p,l.value.params)).then(function(e){return null!=e?e:f(t,r,e)})}return a.next=f,Promise.resolve().then(function(){return f(!0,t.root)}).catch(function(e){if(t.errorHandler)return t.errorHandler(e,p);throw e})},e}();return s.pathToRegexp=d,s}); | ||
//# sourceMappingURL=universal-router.min.js.map |
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
171276
26
1413
+ Addedpath-to-regexp@3.3.0(transitive)
- Removedpath-to-regexp@2.4.0(transitive)
Updatedpath-to-regexp@^3.0.0