Add WASM fetch resolver support#26
Conversation
Co-authored-by: Siraj Chokshi <SirajChokshi@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Proxy URL duplicated across two source files
- Extracted the proxy base URL into a shared
PROXY_BASE_URLconstant infetch.tsand imported it inhtml.ts, eliminating the duplication.
- Extracted the proxy base URL into a shared
Or push these changes by commenting:
@cursor push 24fe783b8b
Preview (24fe783b8b)
diff --git a/src/utils/fetch.ts b/src/utils/fetch.ts
--- a/src/utils/fetch.ts
+++ b/src/utils/fetch.ts
@@ -1,8 +1,10 @@
import { PreviewError, errorType } from './errors'
+export const PROXY_BASE_URL = 'https://api.codetabs.com/v1/proxy/?quest='
+
export async function proxyFetch(url: string) {
const res = await fetch(
- `https://api.codetabs.com/v1/proxy/?quest=${encodeURIComponent(url)}`,
+ `${PROXY_BASE_URL}${encodeURIComponent(url)}`,
undefined,
)
diff --git a/src/utils/lang/html.ts b/src/utils/lang/html.ts
--- a/src/utils/lang/html.ts
+++ b/src/utils/lang/html.ts
@@ -1,3 +1,5 @@
+import { PROXY_BASE_URL } from '../fetch'
+
export function isHTML(maybeHTML: string): boolean {
const $div = document.createElement('div')
$div.innerHTML = maybeHTML
@@ -7,7 +9,7 @@
function getFetchResolverScript() {
return `<script data-static-preview-fetch-resolver>
;(() => {
- const proxyPrefix = 'https://api.codetabs.com/v1/proxy/?quest='
+ const proxyPrefix = '${PROXY_BASE_URL}'
const nativeFetch = window.fetch.bind(window)
const shouldProxy = (url) => {You can send follow-ups to the cloud agent here.
| function getFetchResolverScript() { | ||
| return `<script data-static-preview-fetch-resolver> | ||
| ;(() => { | ||
| const proxyPrefix = 'https://api.codetabs.com/v1/proxy/?quest=' |
There was a problem hiding this comment.
Proxy URL duplicated across two source files
Low Severity
The proxy base URL https://api.codetabs.com/v1/proxy/?quest= is hardcoded independently in both fetch.ts and in the injected script string inside html.ts. If the proxy endpoint ever changes, one location could easily be updated while the other is missed, causing silent breakage in either server-side fetching or client-side WASM fetch proxying. A shared constant interpolated into both call sites would eliminate this risk.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3286ee7. Configure here.
Co-authored-by: Siraj Chokshi <SirajChokshi@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Logger refactor creates unused dead variable
- Resolved the factory function once before calling createLogger, eliminating the dead allocation of a second unused logger instance.
Or push these changes by commenting:
@cursor push 8c51329317
Preview (8c51329317)
diff --git a/src/utils/logger.ts b/src/utils/logger.ts
--- a/src/utils/logger.ts
+++ b/src/utils/logger.ts
@@ -47,14 +47,9 @@
}
}
-const logger = createLogger(logbench)
-
-// Keep existing styling behavior for compatible environments.
-const styledLogger = createLogger((logbench as { default?: unknown }).default)
-
-const resolvedLogger =
+const factory =
typeof (logbench as { default?: unknown }).default === 'function'
- ? styledLogger
- : logger
+ ? (logbench as { default: unknown }).default
+ : logbench
-export default resolvedLogger
+export default createLogger(factory)You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit c6ab352. Configure here.
Co-authored-by: Siraj Chokshi <SirajChokshi@users.noreply.github.com>



Summary
Testing