@c4a/extract-ts 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +18 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12941,6 +12941,10 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
12941
12941
|
}
|
|
12942
12942
|
const facts = [];
|
|
12943
12943
|
if (coverageFile.disposition === "analyzed" && fileInfo) {
|
|
12944
|
+
const source = invocation.source_files?.[normalizedPath2];
|
|
12945
|
+
if (invocation.source_files !== undefined && source === undefined) {
|
|
12946
|
+
throw new TypeError(`Analyzed file ${normalizedPath2} has no scoped source text`);
|
|
12947
|
+
}
|
|
12944
12948
|
facts.push(fact2({
|
|
12945
12949
|
sourceRef: invocation.authorized_scope.source_ref,
|
|
12946
12950
|
moduleRef: invocation.module_ref,
|
|
@@ -12948,7 +12952,11 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
12948
12952
|
qualifiedItemPath: "file",
|
|
12949
12953
|
kind: "source-file",
|
|
12950
12954
|
signature: { path: normalizedPath2, language: fileInfo.language },
|
|
12951
|
-
payload: fileInfo
|
|
12955
|
+
payload: source === undefined ? fileInfo : {
|
|
12956
|
+
...fileInfo,
|
|
12957
|
+
line: 1,
|
|
12958
|
+
endLine: source.split(/\r\n|\r|\n/u).length
|
|
12959
|
+
},
|
|
12952
12960
|
denominator: ownsDenominators ? "eligible-file" : "none"
|
|
12953
12961
|
}));
|
|
12954
12962
|
facts.push(fact2({
|
|
@@ -15195,10 +15203,15 @@ class TypeScriptPlugin {
|
|
|
15195
15203
|
}
|
|
15196
15204
|
}
|
|
15197
15205
|
async extractSymbolsInScope(entries, analysisPaths, fs) {
|
|
15198
|
-
const
|
|
15199
|
-
if (!
|
|
15200
|
-
throw new Error("TypeScriptPlugin.extractSymbolsInScope requires detectEntries
|
|
15201
|
-
}
|
|
15206
|
+
const detectedPackage = this.#lastDetection?.package;
|
|
15207
|
+
if (!detectedPackage && entries.length > 0) {
|
|
15208
|
+
throw new Error("TypeScriptPlugin.extractSymbolsInScope requires detectEntries before using package entries");
|
|
15209
|
+
}
|
|
15210
|
+
const packageInfo = detectedPackage ?? {
|
|
15211
|
+
name: "unknown-package",
|
|
15212
|
+
kind: "lib" /* Lib */,
|
|
15213
|
+
language: packageLanguage(analysisPaths)
|
|
15214
|
+
};
|
|
15202
15215
|
try {
|
|
15203
15216
|
return await extractSymbols(entries, fs, {
|
|
15204
15217
|
packageInfo,
|