From e8374632f12e0dadb6e2956aec9dc2137a95af39 Mon Sep 17 00:00:00 2001 From: Vladimir Kutepov Date: Mon, 25 Nov 2024 10:00:28 +0700 Subject: [PATCH] format --- dist/universal-router-sync.js.map | 2 +- dist/universal-router-sync.min.js.map | 2 +- dist/universal-router.js.map | 2 +- dist/universal-router.min.js.map | 2 +- src/UniversalRouter.ts | 3 ++- src/UniversalRouterSync.ts | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dist/universal-router-sync.js.map b/dist/universal-router-sync.js.map index 2212ebd..407a4bb 100644 --- a/dist/universal-router-sync.js.map +++ b/dist/universal-router-sync.js.map @@ -1 +1 @@ -{"version":3,"file":"universal-router-sync.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouterSync.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResultSync = T | null | undefined\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouterSync\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => RouteResultSync\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (\n context: RouteContext,\n params: RouteParams,\n ) => RouteResultSync\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResultSync\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResultSync\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path = !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResultSync {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouterSync {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): RouteResultSync {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResultSync,\n ): RouteResultSync {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return null\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n throw error\n }\n\n currentContext = { ...context, ...matches.value }\n\n const result = resolve(\n currentContext as RouteContext,\n matches.value.params,\n )\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n }\n\n context['next'] = next\n\n try {\n return next(true, this.root)\n } catch (error) {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error as RouteError, currentContext)\n }\n throw error\n }\n }\n}\n\nexport default UniversalRouterSync\n"],"names":["lexer","str","tokens","i","length","char","push","type","index","value","name","j","code","charCodeAt","TypeError","concat","count","pattern","parse","options","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","isSafe","_i","delimiter_1","indexOf","safePattern","prefix","prev","prevText","escapeString","suffix","modifier","open","name_1","pattern_1","match","keys","re","pathToRegexp","regexpToFunction","decode","x","pathname","m","exec","params","Object","create","split","map","replace","flags","sensitive","regexpToRegexp","groupsRegex","execResult","source","arrayToRegexp","paths","parts","RegExp","join","stringToRegexp","tokensToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","Array","isArray","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","_matchResult","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","isChildRoute","parentRoute","UniversalRouterSync","routes","root","_proto","prototype","resolve","pathnameOrContext","router","matches","nextMatches","currentContext","resume","prevResult","error","Error","status","errorHandler"],"mappings":";;;;;;;;IAoBA,SAASA,KAAKA,CAACC,GAAW,EAAA;MACxB,IAAMC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sync.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouterSync.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResultSync = T | null | undefined\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouterSync\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => RouteResultSync\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (\n context: RouteContext,\n params: RouteParams,\n ) => RouteResultSync\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResultSync\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResultSync\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path =\n !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResultSync {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouterSync {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): RouteResultSync {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResultSync,\n ): RouteResultSync {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return null\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n throw error\n }\n\n currentContext = { ...context, ...matches.value }\n\n const result = resolve(\n currentContext as RouteContext,\n matches.value.params,\n )\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n }\n\n context['next'] = next\n\n try {\n return next(true, this.root)\n } catch (error) {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error as RouteError, currentContext)\n }\n throw error\n }\n }\n}\n\nexport default UniversalRouterSync\n"],"names":["lexer","str","tokens","i","length","char","push","type","index","value","name","j","code","charCodeAt","TypeError","concat","count","pattern","parse","options","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","isSafe","_i","delimiter_1","indexOf","safePattern","prefix","prev","prevText","escapeString","suffix","modifier","open","name_1","pattern_1","match","keys","re","pathToRegexp","regexpToFunction","decode","x","pathname","m","exec","params","Object","create","split","map","replace","flags","sensitive","regexpToRegexp","groupsRegex","execResult","source","arrayToRegexp","paths","parts","RegExp","join","stringToRegexp","tokensToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","Array","isArray","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","_matchResult","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","isChildRoute","parentRoute","UniversalRouterSync","routes","root","_proto","prototype","resolve","pathnameOrContext","router","matches","nextMatches","currentContext","resume","prevResult","error","Error","status","errorHandler"],"mappings":";;;;;;;;IAoBA,SAASA,KAAKA,CAACC,GAAW,EAAA;MACxB,IAAMC,MAAM,GAAe,EAAE;MAC7B,IAAIC,CAAC,GAAG,CAAC;IAET,EAAA,OAAOA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAE;IACrB,IAAA,IAAMC,KAAI,GAAGJ,GAAG,CAACE,CAAC,CAAC;QAEnB,IAAIE,KAAI,KAAK,GAAG,IAAIA,KAAI,KAAK,GAAG,IAAIA,KAAI,KAAK,GAAG,EAAE;UAChDH,MAAM,CAACI,IAAI,CAAC;IAAEC,QAAAA,IAAI,EAAE,UAAU;IAAEC,QAAAA,KAAK,EAAEL,CAAC;IAAEM,QAAAA,KAAK,EAAER,GAAG,CAACE,CAAC,EAAE;IAAC,OAAE,CAAC;IAC5D,MA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AAc,GAAAzE,MAAA,CAAAmD,MAAA,CAAA,EAAA,EAAQQ,OAAO,EAAKY,OAAO,CAACvH,KAAK,CAAE;UAEjD,IAAMe,MAAM,GAAGqG,OAAO,CACpBK,cAAc,EACdF,OAAO,CAACvH,KAAK,CAAC+C,MAChB,CAAC;IACD,MAAA,IAAIhC,MAAM,KAAK,IAAI,IAAIA,MAAM,KAAKK,SAAS,EAAE;IAC3C,QAAA,OAAOL,MAAM;IACf;IACA,MAAA,OAAO+E,IAAI,CAAC4B,MAAM,EAAElB,MAAM,EAAEzF,MAAM,CAAC;IACrC;IAEA4F,IAAAA,OAAO,CAAC,MAAM,CAAC,GAAGb,IAAI;QAEtB,IAAI;IACF,MAAA,OAAOA,IAAI,CAAC,IAAI,EAAE,IAAI,CAACmB,IAAI,CAAC;SAC7B,CAAC,OAAOW,KAAK,EAAE;IACd,MAAA,IAAI,IAAI,CAAClH,OAAO,CAACqH,YAAY,EAAE;YAC7B,OAAO,IAAI,CAACrH,OAAO,CAACqH,YAAY,CAACH,KAAK,EAAgBH,cAAc,CAAC;IACvE;IACA,MAAA,MAAMG,KAAK;IACb;OACD;IAAA,EAAA,OAAAb,mBAAA;IAAA,CAAA;;;;;;;;","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/universal-router-sync.min.js.map b/dist/universal-router-sync.min.js.map index f6db99b..51363a6 100644 --- a/dist/universal-router-sync.min.js.map +++ b/dist/universal-router-sync.min.js.map @@ -1 +1 @@ -{"version":3,"file":"universal-router-sync.min.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouterSync.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResultSync = T | null | undefined\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouterSync\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => RouteResultSync\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (\n context: RouteContext,\n params: RouteParams,\n ) => RouteResultSync\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResultSync\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResultSync\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path = !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResultSync {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouterSync {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): RouteResultSync {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResultSync,\n ): RouteResultSync {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return null\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n throw error\n }\n\n currentContext = { ...context, ...matches.value }\n\n const result = resolve(\n currentContext as RouteContext,\n matches.value.params,\n )\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n }\n\n context['next'] = next\n\n try {\n return next(true, this.root)\n } catch (error) {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error as RouteError, currentContext)\n }\n throw error\n }\n }\n}\n\nexport default UniversalRouterSync\n"],"names":["parse","str","options","tokens","i","length","char","push","type","index","value","count","pattern","j","TypeError","concat","name","code","charCodeAt","lexer","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","safePattern","prefix","prev","prevText","_i","delimiter_1","indexOf","isSafe","escapeString","suffix","modifier","name_1","pattern_1","match","keys","re","decode","x","pathname","m","exec","params","Object","create","split","map","regexpToFunction","pathToRegexp","replace","flags","sensitive","stringToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","RegExp","tokensToRegexp","groupsRegex","execResult","source","regexpToRegexp","Array","isArray","paths","parts","join","arrayToRegexp","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","UniversalRouterSync","routes","this","root","prototype","resolve","pathnameOrContext","matches","nextMatches","router","currentContext","resume","prevResult","parentRoute","isChildRoute","error","Error","status","errorHandler"],"mappings":";oPA2IM,SAAUA,EAAMC,EAAaC,QAAA,IAAAA,IAAAA,EAA0B,CAAA,GA+C3D,IA9CA,IAAMC,EAxHR,SAAeF,GAIb,IAHA,IAAME,EAAqB,GACvBC,EAAI,EAEDA,EAAIH,EAAII,QAAQ,CACrB,IAAMC,EAAOL,EAAIG,GAEjB,GAAa,MAATE,GAAyB,MAATA,GAAyB,MAATA,EAKpC,GAAa,OAATA,EAKJ,GAAa,MAATA,EAKJ,GAAa,MAATA,EAKJ,GAAa,MAATA,EA+BJ,GAAa,MAATA,EAuCJH,EAAOI,KAAK,CAAEC,KAAM,OAAQC,MAAOL,EAAGM,MAAOT,EAAIG,WAvCjD,CACE,IAAIO,EAAQ,EACRC,EAAU,GAGd,GAAe,MAAXX,EAFAY,EAAIT,EAAI,GAGV,MAAM,IAAIU,UAAU,oCAAAC,OAAoCF,IAG1D,KAAOA,EAAIZ,EAAII,QACb,GAAe,OAAXJ,EAAIY,GAAR,CAKA,GAAe,MAAXZ,EAAIY,IAEN,GAAc,KADdF,EACiB,CACfE,IACA,YAEG,GAAe,MAAXZ,EAAIY,KACbF,IACmB,MAAfV,EAAIY,EAAI,IACV,MAAM,IAAIC,UAAU,uCAAAC,OAAuCF,IAI/DD,GAAWX,EAAIY,UAjBbD,GAAWX,EAAIY,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B,OAAQP,MACLA,KAAKpH,QAAQgH,QACiB,iBAAtBQ,EACP,CAAExE,SAAUwE,GACZA,GAEAvB,EAAcH,EAClBsB,KAAKC,KACLD,KAAKrB,QACLqB,KAAKpH,QACLgH,EAAQhE,SAAS2D,OAAOS,KAAKrB,QAAQ5F,SAEjCoH,EAAUH,KAAKpH,QAAQ+G,cAAgBA,EAGzCa,EAAiBZ,EAErB,SAASZ,EACPyB,EACAhB,EACAiB,QAD2B,IAA3BjB,IAAAA,GAA+BY,EAAQnB,MAAQmB,EAAQjH,MAAMiE,OAG7D,IAAM4B,EACW,OAAfyB,IAAwBL,EAAQnB,MAAQmB,EAAQjH,MAAMiE,MAIxD,GAHAgD,EAAUC,GAAezB,EAAYG,KAAKC,GAC1CqB,EAAc,MAETG,IACCJ,EAAQnB,OAxEpB,SACEyB,EACAnB,GAGA,IADA,IAAInC,EAAwCmC,EACrCnC,GAEL,IADAA,EAAQA,EAAMoC,UACAkB,EACZ,OAAO,EAGX,OAAO,CACT,CA4D6BC,CAAanB,EAAQY,EAAQjH,MAAMiE,QAEtD,OADAiD,EAAcD,EACP,KAIX,GAAIA,EAAQnB,KAAM,CAChB,IAAM2B,EAAoB,IAAIC,MAAM,mBAEpC,MADAD,EAAME,OAAS,IACTF,CACR,CAEAL,EAAcxE,OAAAqD,OAAA,CAAA,EAAQO,EAAYS,EAAQjH,OAE1C,IAAMc,EAASiG,EACbK,EACAH,EAAQjH,MAAM2C,QAEhB,OAAI7B,QACKA,EAEF8E,EAAKyB,EAAQhB,EAAQvF,EAC9B,CAEA0F,EAAc,KAAIZ,EAElB,IACE,OAAOA,GAAK,EAAMgB,KAAKC,KACxB,CAAC,MAAOY,GACP,GAAIb,KAAKpH,QAAQoI,aACf,OAAOhB,KAAKpH,QAAQoI,aAAaH,EAAqBL,GAExD,MAAMK,CACR,CACD,EAAAf,CAAA,CA5FsB","x_google_ignoreList":[0]} \ No newline at end of file +{"version":3,"file":"universal-router-sync.min.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouterSync.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResultSync = T | null | undefined\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouterSync\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => RouteResultSync\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (\n context: RouteContext,\n params: RouteParams,\n ) => RouteResultSync\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResultSync\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResultSync\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path =\n !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResultSync {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouterSync {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): RouteResultSync {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResultSync,\n ): RouteResultSync {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return null\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n throw error\n }\n\n currentContext = { ...context, ...matches.value }\n\n const result = resolve(\n currentContext as RouteContext,\n matches.value.params,\n )\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n }\n\n context['next'] = next\n\n try {\n return next(true, this.root)\n } catch (error) {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error as RouteError, currentContext)\n }\n throw error\n }\n }\n}\n\nexport default UniversalRouterSync\n"],"names":["parse","str","options","tokens","i","length","char","push","type","index","value","count","pattern","j","TypeError","concat","name","code","charCodeAt","lexer","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","safePattern","prefix","prev","prevText","_i","delimiter_1","indexOf","isSafe","escapeString","suffix","modifier","name_1","pattern_1","match","keys","re","decode","x","pathname","m","exec","params","Object","create","split","map","regexpToFunction","pathToRegexp","replace","flags","sensitive","stringToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","RegExp","tokensToRegexp","groupsRegex","execResult","source","regexpToRegexp","Array","isArray","paths","parts","join","arrayToRegexp","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","UniversalRouterSync","routes","this","root","prototype","resolve","pathnameOrContext","matches","nextMatches","router","currentContext","resume","prevResult","parentRoute","isChildRoute","error","Error","status","errorHandler"],"mappings":";oPA2IM,SAAUA,EAAMC,EAAaC,QAAA,IAAAA,IAAAA,EAA0B,CAAA,GA+C3D,IA9CA,IAAMC,EAxHR,SAAeF,GAIb,IAHA,IAAME,EAAqB,GACvBC,EAAI,EAEDA,EAAIH,EAAII,QAAQ,CACrB,IAAMC,EAAOL,EAAIG,GAEjB,GAAa,MAATE,GAAyB,MAATA,GAAyB,MAATA,EAKpC,GAAa,OAATA,EAKJ,GAAa,MAATA,EAKJ,GAAa,MAATA,EAKJ,GAAa,MAATA,EA+BJ,GAAa,MAATA,EAuCJH,EAAOI,KAAK,CAAEC,KAAM,OAAQC,MAAOL,EAAGM,MAAOT,EAAIG,WAvCjD,CACE,IAAIO,EAAQ,EACRC,EAAU,GAGd,GAAe,MAAXX,EAFAY,EAAIT,EAAI,GAGV,MAAM,IAAIU,UAAU,oCAA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AQvF,EAC9B,CAEA0F,EAAc,KAAIZ,EAElB,IACE,OAAOA,GAAK,EAAMgB,KAAKC,KACxB,CAAC,MAAOY,GACP,GAAIb,KAAKpH,QAAQoI,aACf,OAAOhB,KAAKpH,QAAQoI,aAAaH,EAAqBL,GAExD,MAAMK,CACR,CACD,EAAAf,CAAA,CA5FsB","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/universal-router.js.map b/dist/universal-router.js.map index b2b1131..d6d2a23 100644 --- a/dist/universal-router.js.map +++ b/dist/universal-router.js.map @@ -1 +1 @@ -{"version":3,"file":"universal-router.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouter.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResult =\n | T\n | null\n | undefined\n | Promise\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouter\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => Promise\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (context: RouteContext, params: RouteParams) => RouteResult\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResult\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResult\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path = !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResult {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouter {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): Promise> {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResult,\n ): Promise> {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return Promise.resolve(null)\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n return Promise.reject(error)\n }\n\n currentContext = { ...context, ...matches.value }\n\n return Promise.resolve(\n resolve(currentContext as RouteContext, matches.value.params),\n ).then((result) => {\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n })\n }\n\n context['next'] = next\n\n return Promise.resolve()\n .then(() => next(true, this.root))\n .catch((error: RouteError) => {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error, currentContext)\n }\n throw error\n })\n }\n}\n\nexport default UniversalRouter\n"],"names":["lexer","str","tokens","i","length","char","push","type","index","value","name","j","code","charCodeAt","TypeError","concat","count","pattern","parse","options","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","isSafe","_i","delimiter_1","indexOf","safePattern","prefix","prev","prevText","escapeString","suffix","modifier","open","name_1","pattern_1","match","keys","re","pathToRegexp","regexpToFunction","decode","x","pathname","m","exec","params","Object","create","split","map","replace","flags","sensitive","regexpToRegexp","groupsRegex","execResult","source","arrayToRegexp","paths","parts","RegExp","join","stringToRegexp","tokensToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","Array","isArray","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","_matchResult","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","isChildRoute","parentRoute","UniversalRouter","routes","root","_proto","prototype","resolve","pathnameOrContext","_this","router","matches","nextMatches","currentContext","resume","prevResult","Promise","error","Error","status","reject","then","errorHandler"],"mappings":";;;;;;;;IAoBA,SAASA,KAAKA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AA,CAAA,CAAC,UAACa,KAAiB,EAAK;IAC5B,MAAA,IAAIR,KAAI,CAAC5G,OAAO,CAACyH,YAAY,EAAE;YAC7B,OAAOb,KAAI,CAAC5G,OAAO,CAACyH,YAAY,CAACL,KAAK,EAAEJ,cAAc,CAAC;IACzD;IACA,MAAA,MAAMI,KAAK;IACb,KAAC,CAAC;OACL;IAAA,EAAA,OAAAf,eAAA;IAAA,CAAA;;;;;;;;","x_google_ignoreList":[0]} \ No newline at end of file +{"version":3,"file":"universal-router.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouter.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResult =\n | T\n | null\n | undefined\n | Promise\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouter\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => Promise\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (context: RouteContext, params: RouteParams) => RouteResult\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResult\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResult\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path =\n !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResult {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouter {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): Promise> {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResult,\n ): Promise> {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return Promise.resolve(null)\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n return Promise.reject(error)\n }\n\n currentContext = { ...context, ...matches.value }\n\n return Promise.resolve(\n resolve(currentContext as RouteContext, matches.value.params),\n ).then((result) => {\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n })\n }\n\n context['next'] = next\n\n return Promise.resolve()\n .then(() => next(true, this.root))\n .catch((error: RouteError) => {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error, currentContext)\n }\n throw error\n })\n }\n}\n\nexport default UniversalRouter\n"],"names":["lexer","str","tokens","i","length","char","push","type","index","value","name","j","code","charCodeAt","TypeError","concat","count","pattern","parse","options","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","isSafe","_i","delimiter_1","indexOf","safePattern","prefix","prev","prevText","escapeString","suffix","modifier","open","name_1","pattern_1","match","keys","re","pathToRegexp","regexpToFunction","decode","x","pathname","m","exec","params","Object","create","split","map","replace","flags","sensitive","regexpToRegexp","groupsRegex","execResult","source","arrayToRegexp","paths","parts","RegExp","join","stringToRegexp","tokensToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","Array","isArray","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","_matchResult","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","isChildRoute","parentRoute","UniversalRouter","routes","root","_proto","prototype","resolve","pathnameOrContext","_this","router","matches","nextMatches","currentContext","resume","prevResult","Promise","error","Error","status","reject","then","errorHandler"],"mappings":";;;;;;;;IAoBA,SAASA,KAAKA,CAACC,GAAW,EAAA;MACxB,IAAMC,MAAM,GAAe,E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,IAAIR,KAAI,CAAC5G,OAAO,CAACyH,YAAY,EAAE;YAC7B,OAAOb,KAAI,CAAC5G,OAAO,CAACyH,YAAY,CAACL,KAAK,EAAEJ,cAAc,CAAC;IACzD;IACA,MAAA,MAAMI,KAAK;IACb,KAAC,CAAC;OACL;IAAA,EAAA,OAAAf,eAAA;IAAA,CAAA;;;;;;;;","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/universal-router.min.js.map b/dist/universal-router.min.js.map index e5dda7a..016e085 100644 --- a/dist/universal-router.min.js.map +++ b/dist/universal-router.min.js.map @@ -1 +1 @@ -{"version":3,"file":"universal-router.min.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouter.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResult =\n | T\n | null\n | undefined\n | Promise\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouter\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => Promise\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (context: RouteContext, params: RouteParams) => RouteResult\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResult\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResult\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path = !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResult {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouter {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): Promise> {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResult,\n ): Promise> {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return Promise.resolve(null)\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n return Promise.reject(error)\n }\n\n currentContext = { ...context, ...matches.value }\n\n return Promise.resolve(\n resolve(currentContext as RouteContext, matches.value.params),\n ).then((result) => {\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n })\n }\n\n context['next'] = next\n\n return Promise.resolve()\n .then(() => next(true, this.root))\n .catch((error: RouteError) => {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error, currentContext)\n }\n throw error\n })\n }\n}\n\nexport default UniversalRouter\n"],"names":["parse","str","options","tokens","i","length","char","push","type","index","value","count","pattern","j","TypeError","concat","name","code","charCodeAt","lexer","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","safePattern","prefix","prev","prevText","_i","delimiter_1","indexOf","isSafe","escapeString","suffix","modifier","name_1","pattern_1","match","keys","re","decode","x","pathname","m","exec","params","Object","create","split","map","regexpToFunction","pathToRegexp","replace","flags","sensitive","stringToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","RegExp","tokensToRegexp","groupsRegex","execResult","source","regexpToRegexp","Array","isArray","paths","parts","join","arrayToRegexp","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","UniversalRouter","routes","this","root","prototype","resolve","pathnameOrContext","matches","nextMatches","_this","router","currentContext","resume","prevResult","parentRoute","isChildRoute","Promise","error","Error","status","reject","then","errorHandler"],"mappings":";gPA2IM,SAAUA,E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GAHAgD,EAAUC,GAAezB,EAAYG,KAAKC,GAC1CqB,EAAc,MAETI,IACCL,EAAQnB,OAxEpB,SACE0B,EACApB,GAGA,IADA,IAAInC,EAAwCmC,EACrCnC,GAEL,IADAA,EAAQA,EAAMoC,UACAmB,EACZ,OAAO,EAGX,OAAO,CACT,CA4D6BC,CAAapB,EAAQY,EAAQjH,MAAMiE,QAEtD,OADAiD,EAAcD,EACPS,QAAQX,QAAQ,MAI3B,GAAIE,EAAQnB,KAAM,CAChB,IAAM6B,EAAoB,IAAIC,MAAM,mBAEpC,OADAD,EAAME,OAAS,IACRH,QAAQI,OAAOH,EACxB,CAIA,OAFAN,EAAczE,OAAAqD,OAAA,CAAA,EAAQO,EAAYS,EAAQjH,OAEnC0H,QAAQX,QACbA,EAAQM,EAAsCJ,EAAQjH,MAAM2C,SAC5DoF,MAAK,SAACjH,GACN,OAAIA,QACKA,EAEF8E,EAAK0B,EAAQjB,EAAQvF,EAC9B,GACF,CAIA,OAFA0F,EAAc,KAAIZ,EAEX8B,QAAQX,UACZgB,MAAK,WAAA,OAAMnC,GAAK,EAAMuB,EAAKN,KAAK,IAC3B,OAAC,SAACc,GACN,GAAIR,EAAK3H,QAAQwI,aACf,OAAOb,EAAK3H,QAAQwI,aAAaL,EAAON,GAE1C,MAAMM,CACR,GACH,EAAAjB,CAAA,CA5FkB","x_google_ignoreList":[0]} \ No newline at end of file +{"version":3,"file":"universal-router.min.js","sources":["../node_modules/path-to-regexp/dist.es2015/index.js","src/UniversalRouter.ts"],"sourcesContent":["/**\n * Tokenize input string.\n */\nfunction lexer(str) {\n var tokens = [];\n var i = 0;\n while (i < str.length) {\n var char = str[i];\n if (char === \"*\" || char === \"+\" || char === \"?\") {\n tokens.push({ type: \"MODIFIER\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"\\\\\") {\n tokens.push({ type: \"ESCAPED_CHAR\", index: i++, value: str[i++] });\n continue;\n }\n if (char === \"{\") {\n tokens.push({ type: \"OPEN\", index: i, value: str[i++] });\n continue;\n }\n if (char === \"}\") {\n tokens.push({ type: \"CLOSE\", index: i, value: str[i++] });\n continue;\n }\n if (char === \":\") {\n var name = \"\";\n var j = i + 1;\n while (j < str.length) {\n var code = str.charCodeAt(j);\n if (\n // `0-9`\n (code >= 48 && code <= 57) ||\n // `A-Z`\n (code >= 65 && code <= 90) ||\n // `a-z`\n (code >= 97 && code <= 122) ||\n // `_`\n code === 95) {\n name += str[j++];\n continue;\n }\n break;\n }\n if (!name)\n throw new TypeError(\"Missing parameter name at \".concat(i));\n tokens.push({ type: \"NAME\", index: i, value: name });\n i = j;\n continue;\n }\n if (char === \"(\") {\n var count = 1;\n var pattern = \"\";\n var j = i + 1;\n if (str[j] === \"?\") {\n throw new TypeError(\"Pattern cannot start with \\\"?\\\" at \".concat(j));\n }\n while (j < str.length) {\n if (str[j] === \"\\\\\") {\n pattern += str[j++] + str[j++];\n continue;\n }\n if (str[j] === \")\") {\n count--;\n if (count === 0) {\n j++;\n break;\n }\n }\n else if (str[j] === \"(\") {\n count++;\n if (str[j + 1] !== \"?\") {\n throw new TypeError(\"Capturing groups are not allowed at \".concat(j));\n }\n }\n pattern += str[j++];\n }\n if (count)\n throw new TypeError(\"Unbalanced pattern at \".concat(i));\n if (!pattern)\n throw new TypeError(\"Missing pattern at \".concat(i));\n tokens.push({ type: \"PATTERN\", index: i, value: pattern });\n i = j;\n continue;\n }\n tokens.push({ type: \"CHAR\", index: i, value: str[i++] });\n }\n tokens.push({ type: \"END\", index: i, value: \"\" });\n return tokens;\n}\n/**\n * Parse a string for the raw tokens.\n */\nexport function parse(str, options) {\n if (options === void 0) { options = {}; }\n var tokens = lexer(str);\n var _a = options.prefixes, prefixes = _a === void 0 ? \"./\" : _a, _b = options.delimiter, delimiter = _b === void 0 ? \"/#?\" : _b;\n var result = [];\n var key = 0;\n var i = 0;\n var path = \"\";\n var tryConsume = function (type) {\n if (i < tokens.length && tokens[i].type === type)\n return tokens[i++].value;\n };\n var mustConsume = function (type) {\n var value = tryConsume(type);\n if (value !== undefined)\n return value;\n var _a = tokens[i], nextType = _a.type, index = _a.index;\n throw new TypeError(\"Unexpected \".concat(nextType, \" at \").concat(index, \", expected \").concat(type));\n };\n var consumeText = function () {\n var result = \"\";\n var value;\n while ((value = tryConsume(\"CHAR\") || tryConsume(\"ESCAPED_CHAR\"))) {\n result += value;\n }\n return result;\n };\n var isSafe = function (value) {\n for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {\n var char = delimiter_1[_i];\n if (value.indexOf(char) > -1)\n return true;\n }\n return false;\n };\n var safePattern = function (prefix) {\n var prev = result[result.length - 1];\n var prevText = prefix || (prev && typeof prev === \"string\" ? prev : \"\");\n if (prev && !prevText) {\n throw new TypeError(\"Must have text between two parameters, missing text after \\\"\".concat(prev.name, \"\\\"\"));\n }\n if (!prevText || isSafe(prevText))\n return \"[^\".concat(escapeString(delimiter), \"]+?\");\n return \"(?:(?!\".concat(escapeString(prevText), \")[^\").concat(escapeString(delimiter), \"])+?\");\n };\n while (i < tokens.length) {\n var char = tryConsume(\"CHAR\");\n var name = tryConsume(\"NAME\");\n var pattern = tryConsume(\"PATTERN\");\n if (name || pattern) {\n var prefix = char || \"\";\n if (prefixes.indexOf(prefix) === -1) {\n path += prefix;\n prefix = \"\";\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n result.push({\n name: name || key++,\n prefix: prefix,\n suffix: \"\",\n pattern: pattern || safePattern(prefix),\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n var value = char || tryConsume(\"ESCAPED_CHAR\");\n if (value) {\n path += value;\n continue;\n }\n if (path) {\n result.push(path);\n path = \"\";\n }\n var open = tryConsume(\"OPEN\");\n if (open) {\n var prefix = consumeText();\n var name_1 = tryConsume(\"NAME\") || \"\";\n var pattern_1 = tryConsume(\"PATTERN\") || \"\";\n var suffix = consumeText();\n mustConsume(\"CLOSE\");\n result.push({\n name: name_1 || (pattern_1 ? key++ : \"\"),\n pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,\n prefix: prefix,\n suffix: suffix,\n modifier: tryConsume(\"MODIFIER\") || \"\",\n });\n continue;\n }\n mustConsume(\"END\");\n }\n return result;\n}\n/**\n * Compile a string to a template function for the path.\n */\nexport function compile(str, options) {\n return tokensToFunction(parse(str, options), options);\n}\n/**\n * Expose a method for transforming tokens into the path function.\n */\nexport function tokensToFunction(tokens, options) {\n if (options === void 0) { options = {}; }\n var reFlags = flags(options);\n var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;\n // Compile all the tokens into regexps.\n var matches = tokens.map(function (token) {\n if (typeof token === \"object\") {\n return new RegExp(\"^(?:\".concat(token.pattern, \")$\"), reFlags);\n }\n });\n return function (data) {\n var path = \"\";\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === \"string\") {\n path += token;\n continue;\n }\n var value = data ? data[token.name] : undefined;\n var optional = token.modifier === \"?\" || token.modifier === \"*\";\n var repeat = token.modifier === \"*\" || token.modifier === \"+\";\n if (Array.isArray(value)) {\n if (!repeat) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not repeat, but got an array\"));\n }\n if (value.length === 0) {\n if (optional)\n continue;\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to not be empty\"));\n }\n for (var j = 0; j < value.length; j++) {\n var segment = encode(value[j], token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected all \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n }\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n var segment = encode(String(value), token);\n if (validate && !matches[i].test(segment)) {\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to match \\\"\").concat(token.pattern, \"\\\", but got \\\"\").concat(segment, \"\\\"\"));\n }\n path += token.prefix + segment + token.suffix;\n continue;\n }\n if (optional)\n continue;\n var typeOfMessage = repeat ? \"an array\" : \"a string\";\n throw new TypeError(\"Expected \\\"\".concat(token.name, \"\\\" to be \").concat(typeOfMessage));\n }\n return path;\n };\n}\n/**\n * Create path match function from `path-to-regexp` spec.\n */\nexport function match(str, options) {\n var keys = [];\n var re = pathToRegexp(str, keys, options);\n return regexpToFunction(re, keys, options);\n}\n/**\n * Create a path match function from `path-to-regexp` output.\n */\nexport function regexpToFunction(re, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;\n return function (pathname) {\n var m = re.exec(pathname);\n if (!m)\n return false;\n var path = m[0], index = m.index;\n var params = Object.create(null);\n var _loop_1 = function (i) {\n if (m[i] === undefined)\n return \"continue\";\n var key = keys[i - 1];\n if (key.modifier === \"*\" || key.modifier === \"+\") {\n params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {\n return decode(value, key);\n });\n }\n else {\n params[key.name] = decode(m[i], key);\n }\n };\n for (var i = 1; i < m.length; i++) {\n _loop_1(i);\n }\n return { path: path, index: index, params: params };\n };\n}\n/**\n * Escape a regular expression string.\n */\nfunction escapeString(str) {\n return str.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n}\n/**\n * Get the flags for a regexp from the options.\n */\nfunction flags(options) {\n return options && options.sensitive ? \"\" : \"i\";\n}\n/**\n * Pull out keys from a regexp.\n */\nfunction regexpToRegexp(path, keys) {\n if (!keys)\n return path;\n var groupsRegex = /\\((?:\\?<(.*?)>)?(?!\\?)/g;\n var index = 0;\n var execResult = groupsRegex.exec(path.source);\n while (execResult) {\n keys.push({\n // Use parenthesized substring match if available, index otherwise\n name: execResult[1] || index++,\n prefix: \"\",\n suffix: \"\",\n modifier: \"\",\n pattern: \"\",\n });\n execResult = groupsRegex.exec(path.source);\n }\n return path;\n}\n/**\n * Transform an array into a regexp.\n */\nfunction arrayToRegexp(paths, keys, options) {\n var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });\n return new RegExp(\"(?:\".concat(parts.join(\"|\"), \")\"), flags(options));\n}\n/**\n * Create a path regexp from string input.\n */\nfunction stringToRegexp(path, keys, options) {\n return tokensToRegexp(parse(path, options), keys, options);\n}\n/**\n * Expose a function for taking tokens and returning a RegExp.\n */\nexport function tokensToRegexp(tokens, keys, options) {\n if (options === void 0) { options = {}; }\n var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? \"/#?\" : _e, _f = options.endsWith, endsWith = _f === void 0 ? \"\" : _f;\n var endsWithRe = \"[\".concat(escapeString(endsWith), \"]|$\");\n var delimiterRe = \"[\".concat(escapeString(delimiter), \"]\");\n var route = start ? \"^\" : \"\";\n // Iterate over the tokens and create our regexp string.\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n if (typeof token === \"string\") {\n route += escapeString(encode(token));\n }\n else {\n var prefix = escapeString(encode(token.prefix));\n var suffix = escapeString(encode(token.suffix));\n if (token.pattern) {\n if (keys)\n keys.push(token);\n if (prefix || suffix) {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n var mod = token.modifier === \"*\" ? \"?\" : \"\";\n route += \"(?:\".concat(prefix, \"((?:\").concat(token.pattern, \")(?:\").concat(suffix).concat(prefix, \"(?:\").concat(token.pattern, \"))*)\").concat(suffix, \")\").concat(mod);\n }\n else {\n route += \"(?:\".concat(prefix, \"(\").concat(token.pattern, \")\").concat(suffix, \")\").concat(token.modifier);\n }\n }\n else {\n if (token.modifier === \"+\" || token.modifier === \"*\") {\n throw new TypeError(\"Can not repeat \\\"\".concat(token.name, \"\\\" without a prefix and suffix\"));\n }\n route += \"(\".concat(token.pattern, \")\").concat(token.modifier);\n }\n }\n else {\n route += \"(?:\".concat(prefix).concat(suffix, \")\").concat(token.modifier);\n }\n }\n }\n if (end) {\n if (!strict)\n route += \"\".concat(delimiterRe, \"?\");\n route += !options.endsWith ? \"$\" : \"(?=\".concat(endsWithRe, \")\");\n }\n else {\n var endToken = tokens[tokens.length - 1];\n var isEndDelimited = typeof endToken === \"string\"\n ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1\n : endToken === undefined;\n if (!strict) {\n route += \"(?:\".concat(delimiterRe, \"(?=\").concat(endsWithRe, \"))?\");\n }\n if (!isEndDelimited) {\n route += \"(?=\".concat(delimiterRe, \"|\").concat(endsWithRe, \")\");\n }\n }\n return new RegExp(route, flags(options));\n}\n/**\n * Normalize the given path string, returning a regular expression.\n *\n * An empty array can be passed in for the keys, which will hold the\n * placeholder key descriptions. For example, using `/user/:id`, `keys` will\n * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.\n */\nexport function pathToRegexp(path, keys, options) {\n if (path instanceof RegExp)\n return regexpToRegexp(path, keys);\n if (Array.isArray(path))\n return arrayToRegexp(path, keys, options);\n return stringToRegexp(path, keys, options);\n}\n//# sourceMappingURL=index.js.map","/**\n * Universal Router (https://www.kriasoft.com/universal-router/)\n *\n * Copyright (c) 2015-present Kriasoft.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport {\n match,\n Path,\n Match,\n MatchFunction,\n ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions,\n} from 'path-to-regexp'\n\n/**\n * In addition to a URL path string, any arbitrary data can be passed to\n * the `router.resolve()` method, that becomes available inside action functions.\n */\nexport interface RouterContext {\n [propName: string]: any\n}\n\nexport interface ResolveContext extends RouterContext {\n /**\n * URL which was transmitted to `router.resolve()`.\n */\n pathname: string\n}\n\n/**\n * Params is a key/value object that represents extracted URL parameters.\n */\nexport interface RouteParams {\n [paramName: string]: string | string[]\n}\n\nexport type RouteResult =\n | T\n | null\n | undefined\n | Promise\n\nexport interface RouteContext\n extends ResolveContext {\n /**\n * Current router instance.\n */\n router: UniversalRouter\n /**\n * Matched route object.\n */\n route: Route\n /**\n * Base URL path relative to the path of the current route.\n */\n baseUrl: string\n /**\n * Matched path.\n */\n path: string\n /**\n * Matched path params.\n */\n params: RouteParams\n /**\n * Middleware style function which can continue resolving.\n */\n next: (resume?: boolean) => Promise\n}\n\n/**\n * A Route is a singular route in your application. It contains a path, an\n * action function, and optional children which are an array of Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport interface Route {\n /**\n * A string, array of strings, or a regular expression. Defaults to an empty string.\n */\n path?: Path\n /**\n * A unique string that can be used to generate the route URL.\n */\n name?: string\n /**\n * The link to the parent route is automatically populated by the router. Useful for breadcrumbs.\n */\n parent?: Route | null\n /**\n * An array of Route objects. Nested routes are perfect to be used in middleware routes.\n */\n children?: Routes | null\n /**\n * Action method should return anything except `null` or `undefined` to be resolved by router\n * otherwise router will throw `Page not found` error if all matched routes returned nothing.\n */\n action?: (context: RouteContext, params: RouteParams) => RouteResult\n /**\n * The route path match function. Used for internal caching.\n */\n match?: MatchFunction\n}\n\n/**\n * Routes is an array of type Route.\n * @template C User context that is made union with RouterContext.\n * @template R Result that every action function resolves to.\n * If the action returns a Promise, R can be the type the Promise resolves to.\n */\nexport type Routes = Route<\n R,\n C\n>[]\n\nexport type ResolveRoute = (\n context: RouteContext,\n params: RouteParams,\n) => RouteResult\n\nexport type RouteError = Error & { status?: number }\n\nexport type ErrorHandler = (\n error: RouteError,\n context: ResolveContext,\n) => RouteResult\n\nexport interface RouterOptions\n extends ParseOptions,\n TokensToRegexpOptions,\n RegexpToFunctionOptions {\n context?: C\n baseUrl?: string\n resolveRoute?: ResolveRoute\n errorHandler?: ErrorHandler\n}\n\nexport interface RouteMatch {\n route: Route\n baseUrl: string\n path: string\n params: RouteParams\n}\n\nfunction decode(val: string): string {\n try {\n return decodeURIComponent(val)\n } catch {\n return val\n }\n}\n\nfunction matchRoute(\n route: Route,\n baseUrl: string,\n options: RouterOptions,\n pathname: string,\n parentParams?: RouteParams,\n): Iterator, false, Route | false> {\n let matchResult: Match\n let childMatches: Iterator<\n RouteMatch,\n false,\n Route | false\n > | null\n let childIndex = 0\n\n return {\n next(\n routeToSkip: Route | false,\n ): IteratorResult, false> {\n if (route === routeToSkip) {\n return { done: true, value: false }\n }\n\n if (!matchResult) {\n const rt = route\n const end = !rt.children\n if (!rt.match) {\n rt.match = match(rt.path || '', { end, ...options })\n }\n matchResult = rt.match(pathname)\n\n if (matchResult) {\n const { path } = matchResult\n matchResult.path =\n !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path\n matchResult.params = { ...parentParams, ...matchResult.params }\n return {\n done: false,\n value: {\n route,\n baseUrl,\n path: matchResult.path,\n params: matchResult.params,\n },\n }\n }\n }\n\n if (matchResult && route.children) {\n while (childIndex < route.children.length) {\n if (!childMatches) {\n const childRoute = route.children[childIndex]!\n childRoute.parent = route\n\n childMatches = matchRoute(\n childRoute,\n baseUrl + matchResult.path,\n options,\n pathname.substr(matchResult.path.length),\n matchResult.params,\n )\n }\n\n const childMatch = childMatches.next(routeToSkip)\n if (!childMatch.done) {\n return {\n done: false,\n value: childMatch.value,\n }\n }\n\n childMatches = null\n childIndex++\n }\n }\n\n return { done: true, value: false }\n },\n }\n}\n\nfunction resolveRoute(\n context: RouteContext,\n params: RouteParams,\n): RouteResult {\n if (typeof context.route.action === 'function') {\n return context.route.action(context, params)\n }\n return undefined\n}\n\nfunction isChildRoute(\n parentRoute: Route | false,\n childRoute: Route,\n): boolean {\n let route: Route | null | undefined = childRoute\n while (route) {\n route = route.parent\n if (route === parentRoute) {\n return true\n }\n }\n return false\n}\n\nclass UniversalRouter {\n root: Route\n\n baseUrl: string\n\n options: RouterOptions\n\n constructor(\n routes: Routes | Route,\n options?: RouterOptions,\n ) {\n if (!routes || typeof routes !== 'object') {\n throw new TypeError('Invalid routes')\n }\n\n this.options = { decode, ...options }\n this.baseUrl = this.options.baseUrl || ''\n this.root = Array.isArray(routes)\n ? { path: '', children: routes, parent: null }\n : routes\n this.root.parent = null\n }\n\n /**\n * Traverses the list of routes in the order they are defined until it finds\n * the first route that matches provided URL path string and whose action function\n * returns anything other than `null` or `undefined`.\n */\n resolve(pathnameOrContext: string | ResolveContext): Promise> {\n const context: ResolveContext = {\n router: this,\n ...this.options.context,\n ...(typeof pathnameOrContext === 'string'\n ? { pathname: pathnameOrContext }\n : pathnameOrContext),\n }\n const matchResult = matchRoute(\n this.root,\n this.baseUrl,\n this.options,\n context.pathname.substr(this.baseUrl.length),\n )\n const resolve = this.options.resolveRoute || resolveRoute\n let matches: IteratorResult, false>\n let nextMatches: IteratorResult, false> | null\n let currentContext = context\n\n function next(\n resume: boolean,\n parent: Route | false = !matches.done && matches.value.route,\n prevResult?: RouteResult,\n ): Promise> {\n const routeToSkip =\n prevResult === null && !matches.done && matches.value.route\n matches = nextMatches || matchResult.next(routeToSkip)\n nextMatches = null\n\n if (!resume) {\n if (matches.done || !isChildRoute(parent, matches.value.route)) {\n nextMatches = matches\n return Promise.resolve(null)\n }\n }\n\n if (matches.done) {\n const error: RouteError = new Error('Route not found')\n error.status = 404\n return Promise.reject(error)\n }\n\n currentContext = { ...context, ...matches.value }\n\n return Promise.resolve(\n resolve(currentContext as RouteContext, matches.value.params),\n ).then((result) => {\n if (result !== null && result !== undefined) {\n return result\n }\n return next(resume, parent, result)\n })\n }\n\n context['next'] = next\n\n return Promise.resolve()\n .then(() => next(true, this.root))\n .catch((error: RouteError) => {\n if (this.options.errorHandler) {\n return this.options.errorHandler(error, currentContext)\n }\n throw error\n })\n }\n}\n\nexport default UniversalRouter\n"],"names":["parse","str","options","tokens","i","length","char","push","type","index","value","count","pattern","j","TypeError","concat","name","code","charCodeAt","lexer","_a","prefixes","_b","delimiter","result","key","path","tryConsume","mustConsume","undefined","nextType","consumeText","safePattern","prefix","prev","prevText","_i","delimiter_1","indexOf","isSafe","escapeString","suffix","modifier","name_1","pattern_1","match","keys","re","decode","x","pathname","m","exec","params","Object","create","split","map","regexpToFunction","pathToRegexp","replace","flags","sensitive","stringToRegexp","strict","start","_c","end","_d","encode","_e","_f","endsWith","endsWithRe","delimiterRe","route","tokens_1","token","mod","endToken","isEndDelimited","RegExp","tokensToRegexp","groupsRegex","execResult","source","regexpToRegexp","Array","isArray","paths","parts","join","arrayToRegexp","val","decodeURIComponent","_unused","matchRoute","baseUrl","parentParams","matchResult","childMatches","childIndex","next","routeToSkip","done","rt","children","assign","charAt","substr","childRoute","parent","childMatch","resolveRoute","context","action","UniversalRouter","routes","this","root","prototype","resolve","pathnameOrContext","matches","nextMatches","_this","router","currentContext","resume","prevResult","parentRoute","isChildRoute","Promise","error","Error","status","reject","then","errorHandler"],"mappings":";gPA2IM,SAAUA,EAAMC,EAAaC,QAAA,IAAAA,IAAAA,EAA0B,CAAA,GA+C3D,IA9CA,IAAMC,EAxHR,SAAeF,GAIb,IAHA,IAAME,EAAqB,GACvBC,EAAI,EAEDA,EAAIH,EAAII,QAAQ,CACrB,IAAMC,EAAOL,EAAIG,GAEjB,GAAa,MAATE,GAAyB,MAATA,GAAyB,MAATA,EAKpC,GAAa,OAATA,EAKJ,GAAa,MAATA,EAKJ,GAAa,MAATA,EAKJ,GAAa,MAATA,EA+BJ,GAAa,MAATA,EAuCJH,EAAOI,KAAK,CAAEC,KAAM,OAAQC,MAAOL,EAAGM,MAAOT,EAAIG,WAvCjD,CACE,IAAIO,EAAQ,EACRC,EAAU,GAGd,GAAe,MAAXX,EAFAY,EAAIT,EAAI,GAGV,MAAM,IAAIU,UAAU,oCAAAC,OAAoCF,IAG1D,KAAOA,EAAIZ,EAAII,QACb,GAAe,OAAXJ,EAAIY,GAAR,CAKA,GAAe,MAAXZ,EAAIY,IAEN,GAAc,KADdF,EACiB,CACfE,IACA,YAEG,GAAe,MAAXZ,EAAIY,KACbF,IACmB,MAAfV,EAAIY,EAAI,IACV,MAAM,IAAIC,UAAU,uCAAAC,OAA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AK3H,QAAQwI,aACf,OAAOb,EAAK3H,QAAQwI,aAAaL,EAAON,GAE1C,MAAMM,CACR,GACH,EAAAjB,CAAA,CA5FkB","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/src/UniversalRouter.ts b/src/UniversalRouter.ts index ae4894d..e391d46 100644 --- a/src/UniversalRouter.ts +++ b/src/UniversalRouter.ts @@ -189,7 +189,8 @@ function matchRoute( if (matchResult) { const { path } = matchResult - matchResult.path = !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path + matchResult.path = + !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path matchResult.params = { ...parentParams, ...matchResult.params } return { done: false, diff --git a/src/UniversalRouterSync.ts b/src/UniversalRouterSync.ts index c478de9..832feb5 100644 --- a/src/UniversalRouterSync.ts +++ b/src/UniversalRouterSync.ts @@ -186,7 +186,8 @@ function matchRoute( if (matchResult) { const { path } = matchResult - matchResult.path = !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path + matchResult.path = + !end && path.charAt(path.length - 1) === '/' ? path.substr(1) : path matchResult.params = { ...parentParams, ...matchResult.params } return { done: false,