Commit Graph

3 Commits

Author SHA1 Message Date
Claude Bot
56b1ea2474 Refactor: Replace ResolvedSource with ModuleResult tagged union
This refactor replaces the complex 12-field ResolvedSource struct with a simpler,
focused ModuleResult tagged union as outlined in the refactoring plan.

**Changes:**

Deleted files:
- src/bun.js/bindings/ZigSourceProvider.cpp/h (replaced with BunSourceProvider)
- src/bun.js/bindings/ResolvedSource.zig (replaced with ModuleResult)

New files:
- src/bun.js/bindings/TranspiledSource.zig - Thread-safe POD struct for transpiled code
- src/bun.js/bindings/SpecialModule.zig - JSValue-based exports handling
- src/bun.js/bindings/ModuleResult.zig - Tagged union return type
- src/bun.js/bindings/BunSourceProvider.h/cpp - Simplified SourceProvider

Updated files:
- src/bun.js/jsc.zig - Export new types (ModuleResult, TranspiledSource, etc.)
- src/bun.js/ModuleLoader.zig - Use ModuleResult throughout, update AsyncModule
- src/bun.js/VirtualMachine.zig - Add ModuleResult import, update fetchWithoutOnLoadPlugins
- src/bun.js/bindings/ModuleLoader.cpp - Handle ModuleResult tags in C++
- src/bun.js/bindings/JSCommonJSModule.cpp/h - Use TranspiledSource
- src/bun.js/bindings/ZigGlobalObject.cpp - Update includes
- src/bun.js/bindings/headers-handwritten.h - Add C++ struct definitions for ModuleResult
- build.zig - Remove ResolvedSourceTag from generated modules

**Benefits:**
- Reduces code complexity by >50%
- Eliminates triple string storage
- Makes transpilation thread-safe (no JSValue in TranspiledSource)
- Clear type safety with tagged unions
- Simpler SourceProvider without m_resolvedSource member

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 07:20:49 +00:00
Jarred Sumner
775c3b1987 Update WebKit (#20413)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <Jarred-Sumner@users.noreply.github.com>
2025-06-16 14:01:58 -07:00
Jarred Sumner
1462445419 Code coverage for bun test (#3975)
* WIP code coverage initial commit

* almost works

* one approach

* Code Coverage

* Update WebKit

* it works but is not yet accurate

* skip double ascii check

* wrapper

* it works but i'm not sure what to do about blocks

* hide blocks for now

* Update ZigSourceProvider.cpp

* Create coverage.md

* Update nav.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-06 06:30:23 -07:00