Skip to content

Commit f2bcf13

Browse files
committed
add test for next server
1 parent eb88ced commit f2bcf13

File tree

2 files changed

+1215
-1
lines changed

2 files changed

+1215
-1
lines changed

packages/open-next/src/build/patch/patchNextServer.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,20 @@ fix:
4747
'{}'
4848
`;
4949

50-
const envVarRuleCreator = (envVar: string, value: string) => `
50+
// This rule is mostly for splitted edge functions so that we don't try to match them on the other non edge functions
51+
export const removeMiddlewareManifestRule = `
52+
rule:
53+
kind: statement_block
54+
inside:
55+
kind: method_definition
56+
has:
57+
kind: property_identifier
58+
regex: getMiddlewareManifest
59+
fix:
60+
'{return null;}'
61+
`;
62+
63+
export const envVarRuleCreator = (envVar: string, value: string) => `
5164
rule:
5265
kind: member_expression
5366
pattern: process.env.${envVar}
@@ -77,6 +90,14 @@ export const patchNextServer: CodePatcher = {
7790
patchCode: createPatchCode(disablePreloadingRule),
7891
},
7992
},
93+
{
94+
versions: ">=15.0.0",
95+
field: {
96+
pathFilter: /next-server\.(js)$/,
97+
contentFilter: /getMiddlewareManifest/,
98+
patchCode: createPatchCode(removeMiddlewareManifestRule),
99+
},
100+
},
80101
],
81102
};
82103

0 commit comments

Comments
 (0)