@@ -292,52 +292,9 @@ export async function readPackageName(_root) { return ${JSON.stringify(ctx.pkgJs
292292 contents : patchManifestTs ( readFileSync ( args . path , "utf-8" ) ) ,
293293 loader : "ts" ,
294294 } ) ) ;
295- // Patch config/validation.ts: filter $bunfs manifest issues inside
296- // validateConfigObjectWithPluginsBase itself. Bun inlines callers ~32
297- // times, so patching callers in io.ts only covers 2. Patch the source.
298- build . onLoad ( { filter : / c o n f i g [ / \\ ] v a l i d a t i o n \. t s $ / } , ( args ) => {
299- let src = readFileSync ( args . path , "utf-8" ) ;
300- // Target the final return in validateConfigObjectWithPluginsBase (after plugin loop)
301- // which is `if (issues.length > 0) {\n return { ok: false, issues, warnings };\n }\n\n return { ok: true, config, warnings };\n }`
302- src = src . replaceAll (
303- / i f \( i s s u e s \. l e n g t h > 0 \) \{ \s * r e t u r n \{ o k : f a l s e , i s s u e s , w a r n i n g s \} ; \s * \} \s * \n \s * r e t u r n \{ o k : t r u e , c o n f i g , w a r n i n g s \} ; \s * \} / g,
304- ( match ) => {
305- return [
306- `{` ,
307- ` const __filtered = issues.filter((iss: any) => !(typeof iss.message === "string" && iss.message.includes("manifest not found") && iss.message.includes("$bunfs")));` ,
308- ` if (__filtered.length > 0) return { ok: false as const, issues: __filtered, warnings };` ,
309- `}` ,
310- `return { ok: true as const, config, warnings };` ,
311- `}` ,
312- ] . join ( "\n" ) ;
313- } ,
314- ) ;
315- return { contents : src , loader : "ts" } ;
316- } ) ;
317- // Patch openBoundaryFileSync to handle $bunfs virtual paths.
318- // Boundary validation (symlinks, hardlinks, TOCTOU identity) doesn't
319- // apply to virtual filesystem paths and fails because VFS openSync
320- // creates temp files whose fstat doesn't match the VFS lstat.
321- build . onLoad ( { filter : / i n f r a [ / \\ ] b o u n d a r y - f i l e - r e a d \. t s $ / } , ( args ) => {
322- let src = readFileSync ( args . path , "utf-8" ) ;
323- src = src . replace (
324- / e x p o r t f u n c t i o n o p e n B o u n d a r y F i l e S y n c \( p a r a m s : O p e n B o u n d a r y F i l e S y n c P a r a m s \) : B o u n d a r y F i l e O p e n R e s u l t \{ / ,
325- [
326- `export function openBoundaryFileSync(params: OpenBoundaryFileSyncParams): BoundaryFileOpenResult {` ,
327- ` if (typeof params.absolutePath === "string" && (params.absolutePath.includes("$bunfs") || params.absolutePath.includes("B:\\\\~BUN"))) {` ,
328- ` const ioFs = params.ioFs ?? fs;` ,
329- ` try {` ,
330- ` const fd = ioFs.openSync(params.absolutePath, ioFs.constants.O_RDONLY);` ,
331- ` const stat = ioFs.fstatSync(fd);` ,
332- ` return { ok: true, path: params.absolutePath, fd, stat, rootRealPath: params.rootPath };` ,
333- ` } catch {` ,
334- ` return { ok: false, reason: "io" };` ,
335- ` }` ,
336- ` }` ,
337- ] . join ( "\n" ) ,
338- ) ;
339- return { contents : src , loader : "ts" } ;
340- } ) ;
295+ // NOTE: openBoundaryFileSync VFS fast path and config validation $bunfs
296+ // issue filtering are now handled in source code (boundary-file-read.ts
297+ // and validation.ts) instead of build-time patches.
341298 // NOTE: playwright-core is bundled (not external) so Bun handles it.
342299 // Patch workspace-templates to prefer VFS-embedded templates directory
343300 build . onLoad ( { filter : / a g e n t s [ / \\ ] w o r k s p a c e - t e m p l a t e s \. t s $ / } , ( args ) => {
0 commit comments