From 5e872fb836995a659325179548d79ab165585177 Mon Sep 17 00:00:00 2001 From: Md Usman Ansari Date: Thu, 3 Jul 2025 17:10:17 +0530 Subject: [PATCH] docs(worker): format code snippet for Miniflare remote proxy session --- .../workers/development-testing/index.mdx | 63 +++++++++---------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index 3b10a8efe82066..37e9cdedeaa8fa 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -392,41 +392,40 @@ import { experimental_maybeStartOrUpdateRemoteProxySession } from "wrangler"; let mf: Miniflare | null; let remoteProxySessionDetails: Awaited< -ReturnType - + ReturnType > | null = null; async function startOrUpdateDevSession() { -remoteProxySessionDetails = -await experimental_maybeStartOrUpdateRemoteProxySession( -{ -bindings: { -MY_KV: { -type: 'kv_namespace', -id: 'kv-id', -experimental_remote: true, -} -} -}, -remoteProxySessionDetails -); - -const miniflareOptions: MiniflareOptions = { -scriptPath: "./worker.js", -kvNamespaces: { -MY_KV: { -id: "kv-id", -remoteProxyConnectionString: -remoteProxySessionDetails?.session.remoteProxyConnectionString, -}, -}, -}; - -if (!mf) { -mf = new Miniflare(miniflareOptions); -} else { -mf.setOptions(miniflareOptions); -} + remoteProxySessionDetails = + await experimental_maybeStartOrUpdateRemoteProxySession( + { + bindings: { + MY_KV: { + type: "kv_namespace", + id: "kv-id", + experimental_remote: true, + }, + }, + }, + remoteProxySessionDetails + ); + + const miniflareOptions: MiniflareOptions = { + scriptPath: "./worker.js", + kvNamespaces: { + MY_KV: { + id: "kv-id", + remoteProxyConnectionString: + remoteProxySessionDetails?.session.remoteProxyConnectionString, + }, + }, + }; + + if (!mf) { + mf = new Miniflare(miniflareOptions); + } else { + mf.setOptions(miniflareOptions); + } } // ... tool logic that invokes `startOrUpdateDevSession()` ...