mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 21:07:46 +00:00
[node] Added middlewareRawSrc to BOA route config (#9435)
Blocked by https://github.com/vercel/vercel/pull/9564 The build output's route configuration contains a compiled `src` from the list of `matchers` in middleware config, however we need to also save the original inputs so that we can render something meaningful in the web UI. The new prop added to the route is called `middlewareRawSrc` of type `string[]`. This PR depends on https://github.com/vercel/api/pull/17231. Linear: https://linear.app/vercel/issue/VCCLI-411/display-uncompressed-edge-middleware-matcher-show-the-list-of-matches
This commit is contained in:
@@ -484,6 +484,7 @@ describe('build', () => {
|
|||||||
{
|
{
|
||||||
src: '^/.*$',
|
src: '^/.*$',
|
||||||
middlewarePath: 'middleware',
|
middlewarePath: 'middleware',
|
||||||
|
middlewareRawSrc: [],
|
||||||
override: true,
|
override: true,
|
||||||
continue: true,
|
continue: true,
|
||||||
},
|
},
|
||||||
@@ -548,6 +549,7 @@ describe('build', () => {
|
|||||||
{
|
{
|
||||||
src: '^/.*$',
|
src: '^/.*$',
|
||||||
middlewarePath: 'middleware',
|
middlewarePath: 'middleware',
|
||||||
|
middlewareRawSrc: [],
|
||||||
override: true,
|
override: true,
|
||||||
continue: true,
|
continue: true,
|
||||||
},
|
},
|
||||||
@@ -612,6 +614,7 @@ describe('build', () => {
|
|||||||
{
|
{
|
||||||
src: '^\\/about(?:\\/((?:[^\\/#\\?]+?)(?:\\/(?:[^\\/#\\?]+?))*))?[\\/#\\?]?$|^\\/dashboard(?:\\/((?:[^\\/#\\?]+?)(?:\\/(?:[^\\/#\\?]+?))*))?[\\/#\\?]?$',
|
src: '^\\/about(?:\\/((?:[^\\/#\\?]+?)(?:\\/(?:[^\\/#\\?]+?))*))?[\\/#\\?]?$|^\\/dashboard(?:\\/((?:[^\\/#\\?]+?)(?:\\/(?:[^\\/#\\?]+?))*))?[\\/#\\?]?$',
|
||||||
middlewarePath: 'middleware',
|
middlewarePath: 'middleware',
|
||||||
|
middlewareRawSrc: ['/about/:path*', '/dashboard/:path*'],
|
||||||
override: true,
|
override: true,
|
||||||
continue: true,
|
continue: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -449,9 +449,19 @@ export const build: BuildV3 = async ({
|
|||||||
// Middleware is a catch-all for all paths unless a `matcher` property is defined
|
// Middleware is a catch-all for all paths unless a `matcher` property is defined
|
||||||
const src = getRegExpFromMatchers(staticConfig?.matcher);
|
const src = getRegExpFromMatchers(staticConfig?.matcher);
|
||||||
|
|
||||||
|
const middlewareRawSrc: string[] = [];
|
||||||
|
if (staticConfig?.matcher) {
|
||||||
|
if (Array.isArray(staticConfig.matcher)) {
|
||||||
|
middlewareRawSrc.push(...staticConfig.matcher);
|
||||||
|
} else {
|
||||||
|
middlewareRawSrc.push(staticConfig.matcher as string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
routes = [
|
routes = [
|
||||||
{
|
{
|
||||||
src,
|
src,
|
||||||
|
middlewareRawSrc,
|
||||||
middlewarePath: outputPath,
|
middlewarePath: outputPath,
|
||||||
continue: true,
|
continue: true,
|
||||||
override: true,
|
override: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user