@c4a/extract-go 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.
Files changed (2) hide show
  1. package/index.js +9 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12981,6 +12981,10 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
12981
12981
  }
12982
12982
  const facts = [];
12983
12983
  if (coverageFile.disposition === "analyzed" && fileInfo) {
12984
+ const source = invocation.source_files?.[normalizedPath];
12985
+ if (invocation.source_files !== undefined && source === undefined) {
12986
+ throw new TypeError(`Analyzed file ${normalizedPath} has no scoped source text`);
12987
+ }
12984
12988
  facts.push(fact2({
12985
12989
  sourceRef: invocation.authorized_scope.source_ref,
12986
12990
  moduleRef: invocation.module_ref,
@@ -12988,7 +12992,11 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
12988
12992
  qualifiedItemPath: "file",
12989
12993
  kind: "source-file",
12990
12994
  signature: { path: normalizedPath, language: fileInfo.language },
12991
- payload: fileInfo,
12995
+ payload: source === undefined ? fileInfo : {
12996
+ ...fileInfo,
12997
+ line: 1,
12998
+ endLine: source.split(/\r\n|\r|\n/u).length
12999
+ },
12992
13000
  denominator: ownsDenominators ? "eligible-file" : "none"
12993
13001
  }));
12994
13002
  facts.push(fact2({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/extract-go",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "type": "module",
5
5
  "description": "Go extraction plugin and structural index for Context",
6
6
  "license": "MIT",