File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
integrations/vercel-middleware/utils Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,10 @@ export function buildMiddlewareMatcherRegexp(routes: IntegrationResolvedRoute[])
44 const groupedRoutes = Object . groupBy ( routes , ( r ) => r . origin ) ;
55 const dontMatchPatterns =
66 groupedRoutes . internal ?. map ( ( r ) => stripPatternRegexp ( r . patternRegex ) ) ?? [ ] ;
7- const matchPatterns = groupedRoutes . project ?. map ( ( r ) => stripPatternRegexp ( r . patternRegex ) ) ?? [ ] ;
87
9- // The regex is constructed to first negate any paths that match the internal patterns
10- // and then allow paths that match the project patterns.
11- // For example it can output such regexp: /^(?!.*\/(_server-islands\/[^\/]+\/?|_image\/?)$)(?:\/(.*?))?\/?)$/;
12- return `^(?!.*(${ dontMatchPatterns . join ( "|" ) } )$)(?:${ matchPatterns . join ( "|" ) } )$` ;
8+ // The regex is constructed to negate any internal Astro paths
9+ // For example it can output such regexp: /^(?!.*\/(_server-islands\/[^\/]+\/?|_image\/?)$).*$/;
10+ return `^(?!.*(${ dontMatchPatterns . join ( "|" ) } )$).*$` ;
1311}
1412
1513const PATTERN_STRIP_LINE_START = / ^ \^ / ;
You can’t perform that action at this time.
0 commit comments