JS/TS: package.json — name + entry point resolution */
| 282 | |
| 283 | /* JS/TS: package.json — name + entry point resolution */ |
| 284 | static void parse_package_json(const char *source, int source_len, const char *rel_path, |
| 285 | cbm_pkg_entries_t *entries) { |
| 286 | yyjson_doc *doc = yyjson_read(source, (size_t)source_len, 0); |
| 287 | if (!doc) { |
| 288 | return; |
| 289 | } |
| 290 | yyjson_val *root = yyjson_doc_get_root(doc); |
| 291 | if (!yyjson_is_obj(root)) { |
| 292 | yyjson_doc_free(doc); |
| 293 | return; |
| 294 | } |
| 295 | |
| 296 | yyjson_val *name_val = yyjson_obj_get(root, "name"); |
| 297 | if (!yyjson_is_str(name_val)) { |
| 298 | yyjson_doc_free(doc); |
| 299 | return; |
| 300 | } |
| 301 | const char *name = yyjson_get_str(name_val); |
| 302 | if (!name || name[0] == '\0') { |
| 303 | yyjson_doc_free(doc); |
| 304 | return; |
| 305 | } |
| 306 | |
| 307 | const char *entry = resolve_pkg_entry(root); |
| 308 | if (entry) { |
| 309 | char *dir = path_dirname(rel_path); |
| 310 | char *resolved = join_and_strip(dir, entry); |
| 311 | if (resolved) { |
| 312 | pkg_entries_push(entries, strdup(name), resolved); |
| 313 | } |
| 314 | free(dir); |
| 315 | } |
| 316 | |
| 317 | yyjson_doc_free(doc); |
| 318 | } |
| 319 | |
| 320 | /* Go: go.mod — module directive */ |
| 321 | static void parse_go_mod(const char *source, int source_len, const char *rel_path, |
no test coverage detected