Skip to content

Commit 3a04d32

Browse files
committed
refactor: move cache patches to the Next Server astgrep based patches
1 parent 71d2939 commit 3a04d32

File tree

5 files changed

+382
-118
lines changed

5 files changed

+382
-118
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
154154

155155
fs.writeFileSync(openNextServerBundle + ".meta.json", JSON.stringify(result.metafile, null, 2));
156156

157-
await updateWorkerBundledCode(openNextServerBundle, buildOpts);
157+
await updateWorkerBundledCode(openNextServerBundle);
158158

159159
const isMonorepo = monorepoRoot !== appPath;
160160
if (isMonorepo) {
@@ -172,16 +172,11 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
172172
/**
173173
* This function applies patches required for the code to run on workers.
174174
*/
175-
export async function updateWorkerBundledCode(
176-
workerOutputFile: string,
177-
buildOpts: BuildOptions
178-
): Promise<void> {
175+
export async function updateWorkerBundledCode(workerOutputFile: string): Promise<void> {
179176
const code = await readFile(workerOutputFile, "utf8");
180177

181178
const patchedCode = await patchCodeWithValidations(code, [
182179
["require", patches.patchRequire],
183-
["cacheHandler", (code) => patches.patchCache(code, buildOpts)],
184-
["composableCache", (code) => patches.patchComposableCache(code, buildOpts), { isOptional: true }],
185180
[
186181
"`require.resolve` call",
187182
// workers do not support dynamic require nor require.resolve
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export * from "./copy-package-cli-files.js";
2-
export * from "./patch-cache.js";
32
export * from "./patch-require.js";

packages/cloudflare/src/cli/build/patches/investigated/patch-cache.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)