feat: parse .kicad_mod imports to circuit JSON#1836
feat: parse .kicad_mod imports to circuit JSON#1836bimakw wants to merge 1 commit intotscircuit:mainfrom
Conversation
- Modify register-static-asset-loaders.ts to parse .kicad_mod files
using kicad-component-converter instead of just exporting file paths
- Update TypeScript declaration to return AnyCircuitElement[]
- Add tests for kicad_mod import parsing
This enables direct import of .kicad_mod files as circuit JSON:
```tsx
import footprint from "./my-footprint.kicad_mod"
<chip footprint={footprint} name="U1" />
```
Closes tscircuit/tscircuit#768
|
Hey @seveibar, this PR adds kicad_mod import support directly in the CLI's asset loader. Instead of creating a separate Bun plugin, I modified This approach keeps the parsing logic in CLI where the dev server handles it, rather than in core or the main tscircuit package. Let me know if you'd prefer a different approach! |
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
|
Hey @seveibar, just checking in on this one. All CI checks are passing and the implementation is complete. Quick recap of what this PR does:
Happy to make any changes if you have feedback on the approach! |
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
|
Still active on this. All CI green, no conflicts. This adds .kicad_mod import parsing in the CLI asset loader — converts to circuit JSON at import time so no changes needed in core. @seveibar would love your take on the approach when you get a chance. Happy to adjust if needed. |
|
@bimakw Send your pr to Discord to get approval from maintainers |
|
This is implemented already via platformConfig no? |
Summary
Parse
.kicad_modfiles at import time and export circuit JSON directly, enabling:Changes
lib/shared/register-static-asset-loaders.tsto parse.kicad_modfiles usingkicad-component-converter(already a dependency)AnyCircuitElement[]instead ofstringHow It Works
The existing Bun plugin for static assets now has special handling for
.kicad_mod:parseKicadModToCircuitJson()Other static assets (
.gltf,.step, etc.) continue to export file paths as before.Test Plan
Closes tscircuit/tscircuit#768
/claim tscircuit/tscircuit#768