MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / resolve_pkg_entry

Function resolve_pkg_entry

src/pipeline/pass_pkgmap.c:265–281  ·  view source on GitHub ↗

Resolve JS/TS entry point from package.json root. */

Source from the content-addressed store, hash-verified

263
264/* Resolve JS/TS entry point from package.json root. */
265static const char *resolve_pkg_entry(yyjson_val *root) {
266 yyjson_val *exports = yyjson_obj_get(root, "exports");
267 if (yyjson_is_obj(exports)) {
268 const char *e = resolve_exports_dot(yyjson_obj_get(exports, "."));
269 if (e) {
270 return e;
271 }
272 }
273 static const char *fallback_keys[] = {"main", "module"};
274 for (int i = 0; i < (int)(sizeof(fallback_keys) / sizeof(fallback_keys[0])); i++) {
275 yyjson_val *v = yyjson_obj_get(root, fallback_keys[i]);
276 if (yyjson_is_str(v)) {
277 return yyjson_get_str(v);
278 }
279 }
280 return "src/index.ts"; /* last resort default */
281}
282
283/* JS/TS: package.json — name + entry point resolution */
284static void parse_package_json(const char *source, int source_len, const char *rel_path,

Callers 1

parse_package_jsonFunction · 0.85

Calls 1

resolve_exports_dotFunction · 0.85

Tested by

no test coverage detected