Skip to content

Commit

Permalink
apply PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Dec 8, 2024
1 parent 30fc8de commit a2d4de8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,8 @@ function fixFunctionContents(contents: string): string {
// We need to update it so that uses a `waitUntil` bound to our `ctx` object
// (source https://github.com/vercel/next.js/blob/b7c271d7/packages/next/src/server/web/spec-extension/fetch-event.ts#L21)
contents = contents.replace(
/this\[(.)\]=(\w)\?{kind:"external",function:\2}:{kind:"internal",promises:\[(.*?)\]}/gm,
`this[$1]=e?{kind:"external",function:globalThis[Symbol.for('__cloudflare-request-context__')].ctx.waitUntil.bind(globalThis[Symbol.for('__cloudflare-request-context__')].ctx)}:{kind:"internal",promises:[$3]}`,
/this\[(.)\]=(\w)\?{kind:"external",function:\2}:{kind:"internal",promises:/gm,
`this[$1]=$2?{kind:"external",function:globalThis[Symbol.for('__cloudflare-request-context__')].ctx.waitUntil.bind(globalThis[Symbol.for('__cloudflare-request-context__')].ctx)}:{kind:"internal",promises:`,
);

return contents;
Expand Down

0 comments on commit a2d4de8

Please sign in to comment.