Skip to content

fix: use new URL() instead of import with { type: file } for cross-runtime compat#918

Merged
simonklee merged 2 commits intoanomalyco:mainfrom
lu-zero:fix/cross-runtime-default-parsers
Apr 10, 2026
Merged

fix: use new URL() instead of import with { type: file } for cross-runtime compat#918
simonklee merged 2 commits intoanomalyco:mainfrom
lu-zero:fix/cross-runtime-default-parsers

Conversation

@lu-zero
Copy link
Copy Markdown
Contributor

@lu-zero lu-zero commented Apr 5, 2026

The Bun-specific import ... with { type: "file" } syntax is not supported by Deno or Node. Replace with new URL(path, import.meta.url) + fileURLToPath() which works identically across all runtimes.

Update the generator (assets/update.ts) to produce cross-runtime compatible code so future regeneration preserves this change.

…ntime compat

The Bun-specific `import ... with { type: "file" }` syntax is not
supported by Deno or Node. Replace with `new URL(path, import.meta.url)`
+ `fileURLToPath()` which works identically across all runtimes.

Update the generator (assets/update.ts) to produce cross-runtime
compatible code so future regeneration preserves this change.
@kommander
Copy link
Copy Markdown
Collaborator

I see the issue. This weird generation was to support Bun standalone executables bundling the existing default parsers and queries I think. Need to check if that still works this way for opencode.

Copy link
Copy Markdown
Member

@simonklee simonklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with opencode and for me the highlights still work.

@simonklee simonklee merged commit 867bf7e into anomalyco:main Apr 10, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants