Skip to content

Commit f2ed91a

Browse files
committed
fix: convert async functions back to sync
1 parent e7e9357 commit f2ed91a

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function bundleServer(buildOpts: BuildOptions, projectOpts: Project
6363
console.log(`\x1b[35m⚙️ Bundling the OpenNext server...\n\x1b[0m`);
6464

6565
await patchWebpackRuntime(buildOpts);
66-
const useOg = await patchVercelOgLibrary(buildOpts);
66+
const useOg = patchVercelOgLibrary(buildOpts);
6767

6868
const outputPath = path.join(outputDir, "server-functions", "default");
6969
const packagePath = getPackagePath(buildOpts);

packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ describe("patchVercelOgLibrary", () => {
4343

4444
afterAll(() => mockFs.restore());
4545

46-
it("should patch the open-next files correctly", async () => {
47-
await patchVercelOgLibrary(buildOpts);
46+
it("should patch the open-next files correctly", () => {
47+
patchVercelOgLibrary(buildOpts);
4848

4949
expect(readdirSync(openNextVercelOgDir)).toMatchInlineSnapshot(`
5050
[

packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { copyFileSync, existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
2-
import { glob } from "node:fs/promises";
1+
import { copyFileSync, existsSync, globSync, readFileSync, renameSync, writeFileSync } from "node:fs";
32
import path from "node:path";
43

54
import type { BuildOptions } from "@opennextjs/aws/build/helper.js";
@@ -16,15 +15,15 @@ type TraceInfo = { version: number; files: string[] };
1615
* @param buildOpts Build options.
1716
* @returns Whether the @vercel/og library is used.
1817
*/
19-
export async function patchVercelOgLibrary(buildOpts: BuildOptions): Promise<boolean> {
18+
export function patchVercelOgLibrary(buildOpts: BuildOptions): boolean {
2019
const { appBuildOutputPath, outputDir } = buildOpts;
2120

2221
const functionsPath = path.join(outputDir, "server-functions/default");
2322
const packagePath = path.join(functionsPath, getPackagePath(buildOpts));
2423

2524
let useOg = false;
2625

27-
for await (const traceInfoPath of glob(".next/server/**/*.nft.json", { cwd: appBuildOutputPath })) {
26+
for (const traceInfoPath of globSync(".next/server/**/*.nft.json", { cwd: appBuildOutputPath })) {
2827
const fullTraceInfoPath = path.join(appBuildOutputPath, traceInfoPath);
2928

3029
// Look for the Node version of the traced @vercel/og files

0 commit comments

Comments
 (0)