From 5d89e665e399742322e0e7e595c7d6d656c83e1a Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Wed, 29 Jan 2025 11:05:46 +0100 Subject: [PATCH] refactor: move ast-grep based patches to `patches/ast` --- packages/cloudflare/src/cli/build/bundle-server.ts | 3 ++- .../{investigated => ast}/patch-vercel-og-library.spec.ts | 0 .../patches/{investigated => ast}/patch-vercel-og-library.ts | 4 ++-- .../cloudflare/src/cli/build/patches/investigated/index.ts | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/cloudflare/src/cli/build/patches/{investigated => ast}/patch-vercel-og-library.spec.ts (100%) rename packages/cloudflare/src/cli/build/patches/{investigated => ast}/patch-vercel-og-library.ts (97%) diff --git a/packages/cloudflare/src/cli/build/bundle-server.ts b/packages/cloudflare/src/cli/build/bundle-server.ts index db993820..0644938b 100644 --- a/packages/cloudflare/src/cli/build/bundle-server.ts +++ b/packages/cloudflare/src/cli/build/bundle-server.ts @@ -9,6 +9,7 @@ import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js"; import { build, Plugin } from "esbuild"; import { patchOptionalDependencies } from "./patches/ast/optional-deps.js"; +import { patchVercelOgLibrary } from "./patches/ast/patch-vercel-og-library.js"; import * as patches from "./patches/index.js"; import inlineRequirePagePlugin from "./patches/plugins/require-page.js"; import setWranglerExternal from "./patches/plugins/wrangler-external.js"; @@ -36,7 +37,7 @@ export async function bundleServer(buildOpts: BuildOptions): Promise { patches.patchWranglerDeps(buildOpts); await patches.updateWebpackChunksFile(buildOpts); - patches.patchVercelOgLibrary(buildOpts); + patchVercelOgLibrary(buildOpts); const outputPath = path.join(outputDir, "server-functions", "default"); const packagePath = getPackagePath(buildOpts); diff --git a/packages/cloudflare/src/cli/build/patches/investigated/patch-vercel-og-library.spec.ts b/packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.spec.ts similarity index 100% rename from packages/cloudflare/src/cli/build/patches/investigated/patch-vercel-og-library.spec.ts rename to packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.spec.ts diff --git a/packages/cloudflare/src/cli/build/patches/investigated/patch-vercel-og-library.ts b/packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.ts similarity index 97% rename from packages/cloudflare/src/cli/build/patches/investigated/patch-vercel-og-library.ts rename to packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.ts index 63fdbfc0..316bf6a8 100644 --- a/packages/cloudflare/src/cli/build/patches/investigated/patch-vercel-og-library.ts +++ b/packages/cloudflare/src/cli/build/patches/ast/patch-vercel-og-library.ts @@ -5,8 +5,8 @@ import type { BuildOptions } from "@opennextjs/aws/build/helper.js"; import { getPackagePath } from "@opennextjs/aws/build/helper.js"; import { globSync } from "glob"; -import { parseFile } from "../ast/util.js"; -import { patchVercelOgFallbackFont, patchVercelOgImport } from "../ast/vercel-og.js"; +import { parseFile } from "./util.js"; +import { patchVercelOgFallbackFont, patchVercelOgImport } from "./vercel-og.js"; type TraceInfo = { version: number; files: string[] }; diff --git a/packages/cloudflare/src/cli/build/patches/investigated/index.ts b/packages/cloudflare/src/cli/build/patches/investigated/index.ts index 55f1684f..9d46a4d8 100644 --- a/packages/cloudflare/src/cli/build/patches/investigated/index.ts +++ b/packages/cloudflare/src/cli/build/patches/investigated/index.ts @@ -1,5 +1,4 @@ export * from "./copy-package-cli-files.js"; export * from "./patch-cache.js"; export * from "./patch-require.js"; -export * from "./patch-vercel-og-library.js"; export * from "./update-webpack-chunks-file/index.js";