File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
packages/cloudflare/src/cli/build/patches/to-investigate Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,24 @@ import { Config } from "../../../config";
1111 */
1212export function patchFindDir ( code : string , config : Config ) : string {
1313 console . log ( "# patchFindDir" ) ;
14- return code . replace (
15- " function findDir( dir, name) {" ,
16- `function findDir(dir, name) {
17- if (dir.endsWith(".next/server")) {
18- if (name === "app") {
14+ const patchedCode = code . replace (
15+ / f u n c t i o n f i n d D i r \( (?< dir > d i r \d * ) , (?< name > n a m e \d * ) \) { / ,
16+ `function findDir($ dir, $ name) {
17+ if ($ dir.endsWith(".next/server")) {
18+ if ($ name === "app") {
1919 return ${ existsSync ( `${ join ( config . paths . output . standaloneAppServer , "app" ) } ` ) } ;
2020 }
21- if (name === "pages") {
21+ if ($ name === "pages") {
2222 return ${ existsSync ( `${ join ( config . paths . output . standaloneAppServer , "pages" ) } ` ) } ;
2323 }
2424 }
25- throw new Error("Unknown findDir call: " + dir + " " + name);
25+ throw new Error("Unknown findDir call: " + $ dir + " " + $ name);
2626 `
2727 ) ;
28+
29+ if ( patchedCode === code ) {
30+ throw new Error ( "Patch `patchFindDir` not applied" ) ;
31+ }
32+
33+ return patchedCode ;
2834}
You can’t perform that action at this time.
0 commit comments