Skip to content

fix(loader): keep plugin entrypoint function-only#13

Open
vjda wants to merge 2 commits into
0xCaso:mainfrom
vjda:fix/legacy-plugin-export-compat
Open

fix(loader): keep plugin entrypoint function-only#13
vjda wants to merge 2 commits into
0xCaso:mainfrom
vjda:fix/legacy-plugin-export-compat

Conversation

@vjda
Copy link
Copy Markdown

@vjda vjda commented May 12, 2026

Closes #12

This PR focuses on the compatibility fix. The original bug report and reproduction details are captured in #12.

Summary

  • remove the named runtime export from the public plugin entrypoint
  • move LSOF_LISTEN_RE into an internal helper module used by runtime code and tests
  • add regression coverage to ensure both source and built entrypoints only expose a default function export

Changes

File Change
src/index.ts stop exposing the regex from the public plugin entrypoint
src/lsof.ts add the internal regex helper module
test/lsof-parse.test.ts import the regex from the internal helper
test/plugin-export.test.ts add regression coverage for source and built export shape

Test Plan

  • bun run typecheck
  • bun test
  • bun run build

Notes for Review

Keep the public plugin entrypoint limited to a default function\nexport so legacy OpenCode loader compatibility does not break.\n\n- move the lsof regex to an internal module\n- update tests to import the helper directly\n- add regression coverage for source and built exports\n\nRefs 0xCaso#12
Copilot AI review requested due to automatic review settings May 12, 2026 14:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR narrows the public plugin entrypoint surface to a single default function export to preserve compatibility with OpenCode’s legacy plugin loader, while keeping the lsof parsing behavior intact.

Changes:

  • Removed the named LSOF_LISTEN_RE export from src/index.ts and moved it into a new internal helper module.
  • Updated the lsof parsing test to import the regex from the new internal module.
  • Added regression tests to assert both source and built entrypoints expose only a default function export.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/index.ts Stops exporting the regex from the public entrypoint; imports it internally instead.
src/lsof.ts Introduces an internal module to hold LSOF_LISTEN_RE.
test/lsof-parse.test.ts Updates test import to use the internal regex module.
test/plugin-export.test.ts Adds regression tests for export shape (source + built).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/plugin-export.test.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

bug(loader): OpenCode rejects legacy plugins with "Plugin export is not a function"

2 participants