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