Resolve JS/TS entry point from package.json root. */
| 267 | |
| 268 | /* Resolve JS/TS entry point from package.json root. */ |
| 269 | static 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 */ |
| 288 | static void parse_package_json(const char *source, int source_len, const char *rel_path, |
no test coverage detected