mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
fix(javascript): retain unavailable source processing scopes
This commit is contained in:
@@ -356,20 +356,23 @@ export const addJavaScriptArtifactFiles = (
|
||||
},
|
||||
});
|
||||
}
|
||||
addUnavailableAsarEntries(context);
|
||||
addUnavailableArtifactEntries(context);
|
||||
};
|
||||
|
||||
const addUnavailableAsarEntries = (
|
||||
const addUnavailableArtifactEntries = (
|
||||
context: JavaScriptArtifactGraphContext,
|
||||
): void => {
|
||||
for (const file of context.fileSet.unavailable_relevant_files) {
|
||||
if (!isAsarContainer(context, file.container_sha256)) continue;
|
||||
const asar = isAsarContainer(context, file.container_sha256);
|
||||
const operation = asar
|
||||
? "inventory-asar-unavailable-entry"
|
||||
: "inventory-unavailable-entry";
|
||||
const limitations = [
|
||||
...(file.limitations ?? []),
|
||||
`The inventoried ${file.kind ?? "relevant"} entry has unavailable bytes; no content artifact identity can be established.`,
|
||||
];
|
||||
const entry = context.accumulator.addNode({
|
||||
kind: "asar-entry",
|
||||
kind: asar ? "asar-entry" : "artifact",
|
||||
identity: {
|
||||
strategy: "canonical-path",
|
||||
stability: "artifact-version",
|
||||
@@ -380,6 +383,7 @@ const addUnavailableAsarEntries = (
|
||||
{
|
||||
label: file.path,
|
||||
properties: {
|
||||
path: file.path,
|
||||
entry_sha256: file.sha256,
|
||||
bytes: file.bytes,
|
||||
inventory_artifact_id: file.inventory_artifact_id,
|
||||
@@ -394,7 +398,7 @@ const addUnavailableAsarEntries = (
|
||||
evidence: artifactObservationEvidence({
|
||||
sha256: file.container_sha256,
|
||||
path: file.path,
|
||||
operation: "inventory-asar-unavailable-entry",
|
||||
operation,
|
||||
coverage: partialApplicationCoverage([], null),
|
||||
limitations,
|
||||
}),
|
||||
@@ -415,11 +419,29 @@ const addUnavailableAsarEntries = (
|
||||
evidence: artifactObservationEvidence({
|
||||
sha256: file.container_sha256,
|
||||
path: file.path,
|
||||
operation: "inventory-asar-unavailable-entry",
|
||||
operation,
|
||||
coverage: partialApplicationCoverage([], null),
|
||||
limitations,
|
||||
}),
|
||||
});
|
||||
const scope =
|
||||
file.kind === undefined
|
||||
? null
|
||||
: javascriptArtifactAnalysisScopes[file.kind];
|
||||
if (scope !== null)
|
||||
addUnavailableStaticParseScope(context, {
|
||||
file,
|
||||
asset: entry,
|
||||
...scope,
|
||||
limitation: limitations.join(" "),
|
||||
...(file.inventory_occurrence_id === undefined
|
||||
? {}
|
||||
: {
|
||||
details: {
|
||||
inventory_occurrence_id: file.inventory_occurrence_id,
|
||||
},
|
||||
}),
|
||||
});
|
||||
if (file.kind === "native-addon" || file.artifact_kind === "native-addon") {
|
||||
const addon = context.accumulator.addNode({
|
||||
kind: "native-addon",
|
||||
|
||||
Reference in New Issue
Block a user