Skip to content

v2.0.1

Choose a tag to compare

@github-actions github-actions released this 23 Oct 10:44
· 88 commits to main since this release

v2.0.1 — Fix npm plugin entrypoint

Plugin @hung319/opencode-hive 2.0.1: sửa lỗi bản 2.0.0 cài qua npm không nạp được, OpenCode báo PluginModule.LoadError: Plugin entrypoint not found. Không có thay đổi API hay breaking change.

Nguyên nhân

  • package.json khai báo "exports": { ".": "./index.js" }, nhưng files chỉ đóng gói dist/, skills/, README.md — shim index.js ở thư mục gốc không được publish.
  • Node/Bun ưu tiên exports hơn main, nên khi OpenCode import("@hung319/opencode-hive") nó tìm index.js (không tồn tại) thay vì dist/index.js (entry thật của build).

Sửa

"exports": {
  ".": {
    "types": "./dist/index.d.ts",
    "import": "./dist/index.js"
  },
  "./package.json": "./package.json"
}
  • "." trỏ đúng dist/index.js (khớp main và types), thêm "./package.json" để công cụ đọc metadata không bị exports map chặn.
  • Shim packages/opencode-hive/index.js (export { default } from './dist/index.js') vẫn giữ nguyên cho chế độ load plugin theo thư mục (.opencode/plugins/...).

Verify

  • npm pack → tarball chứa package/dist/index.js + package/package.json; cài tarball vào project sạch:
    import('@hung319/opencode-hive') → OK, id: "opencode-hive", có setup.
  • OpenCode v2.1.3: log loading plugin ... entrypoint=.../dist/index.js, plugin nạp thành công (không còn lỗi entrypoint).

Upgrade

  • Cấu hình giữ nguyên: "plugins": ["@hung319/opencode-hive"].
  • Cập nhật qua opencode plugin update (hoặc xoá cache plugin cũ) để nhận 2.0.1.