MCPcopy Index your code
hub / github.com/nodejs/node / readPackageJsonPathField

Function readPackageJsonPathField

test/fixtures/snapshot/typescript.js:42409–42425  ·  view source on GitHub ↗
(jsonContent, fieldName, baseDirectory, state)

Source from the content-addressed store, hash-verified

42407 return value;
42408 }
42409 function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
42410 var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
42411 if (fileName === undefined) {
42412 return;
42413 }
42414 if (!fileName) {
42415 if (state.traceEnabled) {
42416 trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
42417 }
42418 return;
42419 }
42420 var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
42421 if (state.traceEnabled) {
42422 trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
42423 }
42424 return path;
42425 }
42426 function readPackageJsonTypesFields(jsonContent, baseDirectory, state) {
42427 return readPackageJsonPathField(jsonContent, "typings", baseDirectory, state)
42428 || readPackageJsonPathField(jsonContent, "types", baseDirectory, state);

Callers 3

readPackageJsonMainFieldFunction · 0.85

Calls 2

readPackageJsonFieldFunction · 0.85
traceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…