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

Function resolve_pkg_entry

src/pipeline/pass_pkgmap.c:269–285  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

267
268/* Resolve JS/TS entry point from package.json root. */
269static const char *resolve_pkg_entry(yyjson_val *root) {
270 yyjson_val *exports = yyjson_obj_get(root, "exports");
271 if (yyjson_is_obj(exports)) {
272 const char *e = resolve_exports_dot(yyjson_obj_get(exports, "."));
273 if (e) {
274 return e;
275 }
276 }
277 static const char *fallback_keys[] = {"main", "module"};
278 for (int i = 0; i < (int)(sizeof(fallback_keys) / sizeof(fallback_keys[0])); i++) {
279 yyjson_val *v = yyjson_obj_get(root, fallback_keys[i]);
280 if (yyjson_is_str(v)) {
281 return yyjson_get_str(v);
282 }
283 }
284 return "src/index.ts"; /* last resort default */
285}
286
287/* JS/TS: package.json — name + entry point resolution */
288static 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