MCPcopy Index your code
hub / github.com/anomalyco/opencode / resolvePackageEntrypoint

Function resolvePackageEntrypoint

packages/opencode/src/plugin/shared.ts:103–114  ·  view source on GitHub ↗
(spec: string, kind: PluginKind, pkg: PluginPackage)

Source from the content-addressed store, hash-verified

101}
102
103function resolvePackageEntrypoint(spec: string, kind: PluginKind, pkg: PluginPackage) {
104 const exports = pkg.json.exports
105 if (isRecord(exports)) {
106 const raw = extractExportValue(exports[`./${kind}`])
107 if (raw) return resolvePackagePath(spec, raw, kind, pkg)
108 }
109
110 if (kind !== "server") return
111 const main = packageMain(pkg)
112 if (!main) return
113 return resolvePackagePath(spec, main, kind, pkg)
114}
115
116function targetPath(target: string) {
117 if (target.startsWith("file://")) return fileURLToPath(target)

Callers 1

resolvePluginEntrypointFunction · 0.85

Calls 4

isRecordFunction · 0.90
extractExportValueFunction · 0.85
resolvePackagePathFunction · 0.85
packageMainFunction · 0.85

Tested by

no test coverage detected