您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

1 行
1.7 KiB

  1. {"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n}); // this isn't importing the escape-string-regex module\n// to reduce bytes\n\nfunction escapeRegex(str) {\n return str.replace(/[|\\\\{}()[\\]^$+*?.-]/g, '\\\\$&');\n}\n\nfunction getRouteRegex(normalizedRoute) {\n // Escape all characters that could be considered RegEx\n const escapedRoute = escapeRegex(normalizedRoute.replace(/\\/$/, '') || '/');\n const groups = {};\n let groupIndex = 1;\n const parameterizedRoute = escapedRoute.replace(/\\/\\\\\\[([^/]+?)\\\\\\](?=\\/|$)/g, (_, $1) => {\n const isCatchAll = /^(\\\\\\.){3}/.test($1);\n groups[$1 // Un-escape key\n .replace(/\\\\([|\\\\{}()[\\]^$+*?.-])/g, '$1').replace(/^\\.{3}/, '') // eslint-disable-next-line no-sequences\n ] = {\n pos: groupIndex++,\n repeat: isCatchAll\n };\n return isCatchAll ? '/(.+?)' : '/([^/]+?)';\n });\n let namedParameterizedRoute; // dead code eliminate for browser since it's only needed\n // while generating routes-manifest\n\n if (true) {\n namedParameterizedRoute = escapedRoute.replace(/\\/\\\\\\[([^/]+?)\\\\\\](?=\\/|$)/g, (_, $1) => {\n const isCatchAll = /^(\\\\\\.){3}/.test($1);\n const key = $1 // Un-escape key\n .replace(/\\\\([|\\\\{}()[\\]^$+*?.-])/g, '$1').replace(/^\\.{3}/, '');\n return isCatchAll ? `/(?<${escapeRegex(key)}>.+?)` : `/(?<${escapeRegex(key)}>[^/]+?)`;\n });\n }\n\n return Object.assign({\n re: new RegExp('^' + parameterizedRoute + '(?:/)?$', 'i'),\n groups\n }, namedParameterizedRoute ? {\n namedRegex: `^${namedParameterizedRoute}(?:/)?$`\n } : {});\n}\n\nexports.getRouteRegex = getRouteRegex;","map":null,"metadata":{},"sourceType":"script"}