From d80f5fc703f0c113c123fd0365cefedf37588520 Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Sun, 1 Feb 2026 06:19:32 +0000 Subject: [PATCH] Address review comments: use URL API and static import - Use new URL(import.meta.url).pathname to parse the URL and check for /$bunfs/ in the pathname instead of checking the raw URL string - Remove Windows-specific B:\\~BUN\\ check as URL pathname normalization handles platform differences - Move pathToFileURL import to module-level static import instead of dynamic import inside the plugin handler Co-Authored-By: Claude Opus 4.5 --- test/bundler/bundler_compile.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/bundler/bundler_compile.test.ts b/test/bundler/bundler_compile.test.ts index 1b613eec9a..e681f2627e 100644 --- a/test/bundler/bundler_compile.test.ts +++ b/test/bundler/bundler_compile.test.ts @@ -3,6 +3,7 @@ import { describe, expect, test } from "bun:test"; import { rmSync } from "fs"; import { bunEnv, bunExe, isWindows, tempDir, tempDirWithFiles } from "harness"; import { join } from "path"; +import { pathToFileURL } from "url"; import { itBundled } from "./expectBundled"; describe("bundler", () => { @@ -967,11 +968,12 @@ const server = serve({ export function helper() { const url = import.meta.url; console.log("Utils URL:", url); - // Verify the URL is the virtual path - if (url.includes("/$bunfs/") || url.includes("B:\\\\~BUN\\\\")) { + // Verify the URL is the virtual path by parsing it with URL API + const pathname = new URL(url).pathname; + if (pathname.includes("/$bunfs/")) { return "success"; } else { - return "FAIL: import.meta.url is not virtual path: " + url; + return "FAIL: import.meta.url pathname is not virtual path: " + pathname; } } `, @@ -981,7 +983,6 @@ const server = serve({ name: "transform-model", setup(api) { api.onLoad({ filter: /model\.ts$/ }, async args => { - const { pathToFileURL } = await import("url"); const contents = await Bun.file(args.path).text(); // Replace placeholder with actual filesystem path const fileUrl = pathToFileURL(args.path).href;