Skip to content

Commit 49e39ee

Browse files
authored
refactor: move cache patches to the Next Server astgrep based patches (#706)
1 parent 76299bd commit 49e39ee

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
@@ -152,7 +152,7 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
152152

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

155-
await updateWorkerBundledCode(openNextServerBundle, buildOpts);
155+
await updateWorkerBundledCode(openNextServerBundle);
156156

157157
const isMonorepo = monorepoRoot !== appPath;
158158
if (isMonorepo) {
@@ -170,16 +170,11 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
170170
/**
171171
* This function applies patches required for the code to run on workers.
172172
*/
173-
export async function updateWorkerBundledCode(
174-
workerOutputFile: string,
175-
buildOpts: BuildOptions
176-
): Promise<void> {
173+
export async function updateWorkerBundledCode(workerOutputFile: string): Promise<void> {
177174
const code = await readFile(workerOutputFile, "utf8");
178175

179176
const patchedCode = await patchCodeWithValidations(code, [
180177
["require", patches.patchRequire],
181-
["cacheHandler", (code) => patches.patchCache(code, buildOpts)],
182-
["composableCache", (code) => patches.patchComposableCache(code, buildOpts), { isOptional: true }],
183178
[
184179
"`require.resolve` call",
185180
// 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)