/opt/canhelp/node_modules/next/dist/shared/lib/router/utils
NameSizeModeActions
add-locale.d.ts3650644editdlrm
add-locale.js10490644editdlrm
add-locale.js.map17150644editdlrm
add-path-prefix.d.ts2000644editdlrm
add-path-prefix.js5360644editdlrm
add-path-prefix.js.map8850644editdlrm
add-path-suffix.d.ts2580644editdlrm
add-path-suffix.js5360644editdlrm
add-path-suffix.js.map9440644editdlrm
app-paths.d.ts9000644editdlrm
app-paths.js15040644editdlrm
app-paths.js.map27120644editdlrm
as-path-to-search-params.d.ts790644editdlrm
as-path-to-search-params.js4840644editdlrm
as-path-to-search-params.js.map5650644editdlrm
cache-busting-search-param.d.ts2570644editdlrm
cache-busting-search-param.js8320644editdlrm
cache-busting-search-param.js.map13150644editdlrm
compare-states.d.ts1460644editdlrm
compare-states.js10700644editdlrm
compare-states.js.map19310644editdlrm
disable-smooth-scroll.d.ts3040644editdlrm
disable-smooth-scroll.js25150644editdlrm
disable-smooth-scroll.js.map36210644editdlrm
escape-path-delimiters.d.ts960644editdlrm
escape-path-delimiters.js5080644editdlrm
escape-path-delimiters.js.map7530644editdlrm
format-next-pathname-info.d.ts2610644editdlrm
format-next-pathname-info.js12900644editdlrm
format-next-pathname-info.js.map20900644editdlrm
format-url.d.ts2160644editdlrm
format-url.js39550644editdlrm
format-url.js.map57390644editdlrm
get-asset-path-from-route.d.ts840644editdlrm
get-asset-path-from-route.js6390644editdlrm
get-asset-path-from-route.js.map8460644editdlrm
get-dynamic-param.d.ts27750644editdlrm
get-dynamic-param.js39760644editdlrm
get-dynamic-param.js.map74420644editdlrm
get-next-pathname-info.d.ts14500644editdlrm
get-next-pathname-info.js24790644editdlrm
get-next-pathname-info.js.map51780644editdlrm
get-route-from-asset-path.d.ts880644editdlrm
get-route-from-asset-path.js9310644editdlrm
get-route-from-asset-path.js.map13240644editdlrm
html-bots.d.ts530644editdlrm
html-bots.js11350644editdlrm
html-bots.js.map11450644editdlrm
index.d.ts1210644editdlrm
index.js7660644editdlrm
index.js.map4300644editdlrm
interception-routes.d.ts3120644editdlrm
interception-routes.js43540644editdlrm
interception-routes.js.map50540644editdlrm
interpolate-as.d.ts1950644editdlrm
interpolate-as.js22420644editdlrm
interpolate-as.js.map38010644editdlrm
is-bot.d.ts2910644editdlrm
is-bot.js17640644editdlrm
is-bot.js.map19980644editdlrm
is-dynamic.d.ts3160644editdlrm
is-dynamic.js8670644editdlrm
is-dynamic.js.map14890644editdlrm
is-local-url.d.ts1470644editdlrm
is-local-url.js8540644editdlrm
is-local-url.js.map12710644editdlrm
middleware-route-matcher.d.ts4630644editdlrm
middleware-route-matcher.js9470644editdlrm
middleware-route-matcher.js.map17620644editdlrm
omit.d.ts1260644editdlrm
omit.js4400644editdlrm
omit.js.map7780644editdlrm
parse-path.d.ts3200644editdlrm
parse-path.js10410644editdlrm
parse-path.js.map15100644editdlrm
parse-relative-url.d.ts7450644editdlrm
parse-relative-url.js14760644editdlrm
parse-relative-url.js.map30150644editdlrm
parse-url.d.ts3650644editdlrm
parse-url.js9540644editdlrm
parse-url.js.map18430644editdlrm
path-has-prefix.d.ts3640644editdlrm
path-has-prefix.js5350644editdlrm
path-has-prefix.js.map9960644editdlrm
path-match.d.ts9890644editdlrm
path-match.js19610644editdlrm
path-match.js.map37730644editdlrm
prepare-destination.d.ts15270644editdlrm
prepare-destination.js106370644editdlrm
prepare-destination.js.map171870644editdlrm
querystring.d.ts3480644editdlrm
querystring.js22810644editdlrm
querystring.js.map32870644editdlrm
relativize-url.d.ts6790644editdlrm
relativize-url.js11210644editdlrm
relativize-url.js.map18720644editdlrm
remove-path-prefix.d.ts3890644editdlrm
remove-path-prefix.js12610644editdlrm
remove-path-prefix.js.map20000644editdlrm
remove-trailing-slash.d.ts2590644editdlrm
remove-trailing-slash.js5520644editdlrm
remove-trailing-slash.js.map5980644editdlrm
resolve-rewrites.d.ts6820644editdlrm
resolve-rewrites.js46700644editdlrm
resolve-rewrites.js.map77810644editdlrm
route-match-utils.d.ts15130644editdlrm
route-match-utils.js36750644editdlrm
route-match-utils.js.map57540644editdlrm
route-matcher.d.ts3840644editdlrm
route-matcher.js15090644editdlrm
route-matcher.js.map25580644editdlrm
route-regex.d.ts34920644editdlrm
route-regex.js94980644editdlrm
route-regex.js.map175770644editdlrm
sortable-routes.d.ts42490644editdlrm
sortable-routes.js63210644editdlrm
sortable-routes.js.map125300644editdlrm
sorted-routes.d.ts3440644editdlrm
sorted-routes.js116640644editdlrm
sorted-routes.js.map147880644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/shared/lib/router/utils/route-regex.js (9498B)
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 0 && (module.exports = { getNamedMiddlewareRegex: null, getNamedRouteRegex: null, getRouteRegex: null }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: all[name] }); } _export(exports, { getNamedMiddlewareRegex: function() { return getNamedMiddlewareRegex; }, getNamedRouteRegex: function() { return getNamedRouteRegex; }, getRouteRegex: function() { return getRouteRegex; } }); const _constants = require("../../../../lib/constants"); const _interceptionroutes = require("./interception-routes"); const _escaperegexp = require("../../escape-regexp"); const _removetrailingslash = require("./remove-trailing-slash"); const _getdynamicparam = require("./get-dynamic-param"); function getParametrizedRoute(route, includeSuffix, includePrefix) { const groups = {}; let groupIndex = 1; const segments = []; for (const segment of (0, _removetrailingslash.removeTrailingSlash)(route).slice(1).split('/')){ const markerMatch = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m)); const paramMatches = segment.match(_getdynamicparam.PARAMETER_PATTERN) // Check for parameters ; if (markerMatch && paramMatches && paramMatches[2]) { const { key, optional, repeat } = (0, _getdynamicparam.parseMatchedParameter)(paramMatches[2]); groups[key] = { pos: groupIndex++, repeat, optional }; segments.push("/" + (0, _escaperegexp.escapeStringRegexp)(markerMatch) + "([^/]+?)"); } else if (paramMatches && paramMatches[2]) { const { key, repeat, optional } = (0, _getdynamicparam.parseMatchedParameter)(paramMatches[2]); groups[key] = { pos: groupIndex++, repeat, optional }; if (includePrefix && paramMatches[1]) { segments.push("/" + (0, _escaperegexp.escapeStringRegexp)(paramMatches[1])); } let s = repeat ? optional ? '(?:/(.+?))?' : '/(.+?)' : '/([^/]+?)'; // Remove the leading slash if includePrefix already added it. if (includePrefix && paramMatches[1]) { s = s.substring(1); } segments.push(s); } else { segments.push("/" + (0, _escaperegexp.escapeStringRegexp)(segment)); } // If there's a suffix, add it to the segments if it's enabled. if (includeSuffix && paramMatches && paramMatches[3]) { segments.push((0, _escaperegexp.escapeStringRegexp)(paramMatches[3])); } } return { parameterizedRoute: segments.join(''), groups }; } function getRouteRegex(normalizedRoute, param) { let { includeSuffix = false, includePrefix = false, excludeOptionalTrailingSlash = false } = param === void 0 ? {} : param; const { parameterizedRoute, groups } = getParametrizedRoute(normalizedRoute, includeSuffix, includePrefix); let re = parameterizedRoute; if (!excludeOptionalTrailingSlash) { re += '(?:/)?'; } return { re: new RegExp("^" + re + "$"), groups: groups }; } /** * Builds a function to generate a minimal routeKey using only a-z and minimal * number of characters. */ function buildGetSafeRouteKey() { let i = 0; return ()=>{ let routeKey = ''; let j = ++i; while(j > 0){ routeKey += String.fromCharCode(97 + (j - 1) % 26); j = Math.floor((j - 1) / 26); } return routeKey; }; } function getSafeKeyFromSegment(param) { let { interceptionMarker, getSafeRouteKey, segment, routeKeys, keyPrefix, backreferenceDuplicateKeys } = param; const { key, optional, repeat } = (0, _getdynamicparam.parseMatchedParameter)(segment); // replace any non-word characters since they can break // the named regex let cleanedKey = key.replace(/\W/g, ''); if (keyPrefix) { cleanedKey = "" + keyPrefix + cleanedKey; } let invalidKey = false; // check if the key is still invalid and fallback to using a known // safe key if (cleanedKey.length === 0 || cleanedKey.length > 30) { invalidKey = true; } if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) { invalidKey = true; } if (invalidKey) { cleanedKey = getSafeRouteKey(); } const duplicateKey = cleanedKey in routeKeys; if (keyPrefix) { routeKeys[cleanedKey] = "" + keyPrefix + key; } else { routeKeys[cleanedKey] = key; } // if the segment has an interception marker, make sure that's part of the regex pattern // this is to ensure that the route with the interception marker doesn't incorrectly match // the non-intercepted route (ie /app/(.)[username] should not match /app/[username]) const interceptionPrefix = interceptionMarker ? (0, _escaperegexp.escapeStringRegexp)(interceptionMarker) : ''; let pattern; if (duplicateKey && backreferenceDuplicateKeys) { // Use a backreference to the key to ensure that the key is the same value // in each of the placeholders. pattern = "\\k<" + cleanedKey + ">"; } else if (repeat) { pattern = "(?<" + cleanedKey + ">.+?)"; } else { pattern = "(?<" + cleanedKey + ">[^/]+?)"; } return optional ? "(?:/" + interceptionPrefix + pattern + ")?" : "/" + interceptionPrefix + pattern; } function getNamedParametrizedRoute(route, prefixRouteKeys, includeSuffix, includePrefix, backreferenceDuplicateKeys) { const getSafeRouteKey = buildGetSafeRouteKey(); const routeKeys = {}; const segments = []; for (const segment of (0, _removetrailingslash.removeTrailingSlash)(route).slice(1).split('/')){ const hasInterceptionMarker = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.some((m)=>segment.startsWith(m)); const paramMatches = segment.match(_getdynamicparam.PARAMETER_PATTERN) // Check for parameters ; if (hasInterceptionMarker && paramMatches && paramMatches[2]) { // If there's an interception marker, add it to the segments. segments.push(getSafeKeyFromSegment({ getSafeRouteKey, interceptionMarker: paramMatches[1], segment: paramMatches[2], routeKeys, keyPrefix: prefixRouteKeys ? _constants.NEXT_INTERCEPTION_MARKER_PREFIX : undefined, backreferenceDuplicateKeys })); } else if (paramMatches && paramMatches[2]) { // If there's a prefix, add it to the segments if it's enabled. if (includePrefix && paramMatches[1]) { segments.push("/" + (0, _escaperegexp.escapeStringRegexp)(paramMatches[1])); } let s = getSafeKeyFromSegment({ getSafeRouteKey, segment: paramMatches[2], routeKeys, keyPrefix: prefixRouteKeys ? _constants.NEXT_QUERY_PARAM_PREFIX : undefined, backreferenceDuplicateKeys }); // Remove the leading slash if includePrefix already added it. if (includePrefix && paramMatches[1]) { s = s.substring(1); } segments.push(s); } else { segments.push("/" + (0, _escaperegexp.escapeStringRegexp)(segment)); } // If there's a suffix, add it to the segments if it's enabled. if (includeSuffix && paramMatches && paramMatches[3]) { segments.push((0, _escaperegexp.escapeStringRegexp)(paramMatches[3])); } } return { namedParameterizedRoute: segments.join(''), routeKeys }; } function getNamedRouteRegex(normalizedRoute, options) { var _options_includeSuffix, _options_includePrefix, _options_backreferenceDuplicateKeys; const result = getNamedParametrizedRoute(normalizedRoute, options.prefixRouteKeys, (_options_includeSuffix = options.includeSuffix) != null ? _options_includeSuffix : false, (_options_includePrefix = options.includePrefix) != null ? _options_includePrefix : false, (_options_backreferenceDuplicateKeys = options.backreferenceDuplicateKeys) != null ? _options_backreferenceDuplicateKeys : false); let namedRegex = result.namedParameterizedRoute; if (!options.excludeOptionalTrailingSlash) { namedRegex += '(?:/)?'; } return { ...getRouteRegex(normalizedRoute, options), namedRegex: "^" + namedRegex + "$", routeKeys: result.routeKeys }; } function getNamedMiddlewareRegex(normalizedRoute, options) { const { parameterizedRoute } = getParametrizedRoute(normalizedRoute, false, false); const { catchAll = true } = options; if (parameterizedRoute === '/') { let catchAllRegex = catchAll ? '.*' : ''; return { namedRegex: "^/" + catchAllRegex + "$" }; } const { namedParameterizedRoute } = getNamedParametrizedRoute(normalizedRoute, false, false, false, false); let catchAllGroupedRegex = catchAll ? '(?:(/.*)?)' : ''; return { namedRegex: "^" + namedParameterizedRoute + catchAllGroupedRegex + "$" }; } //# sourceMappingURL=route-regex.js.map