Skip to content

Commit

Permalink
Track relative virtual path for workspaces
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 20, 2025
1 parent 7576c90 commit c91d431
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import path, {
extname,
join,
resolve,
relative,
sep as _sep,
} from "node:path";
import process from "node:process";
Expand Down Expand Up @@ -2213,6 +2214,10 @@ export async function parsePnpmLock(
}
if (matchSrcFile) {
psObj.properties.push({ name: "SrcFile", value: matchSrcFile });
psObj.properties.push({
name: "internal:virtual_path",
value: relative(dirname(pnpmLock), dirname(matchSrcFile)),
});
}
parentSubComponents.push(psObj);
fallbackMode = false;
Expand Down Expand Up @@ -2573,6 +2578,15 @@ export async function parsePnpmLock(
name: "internal:is_workspace",
value: "true",
});
const wsSrcFile =
workspaceSrcFiles[decodeURIComponent(purlNoVersion)] ||
workspaceSrcFiles[theBomRef];
if (wsSrcFile) {
properties.push({
name: "internal:virtual_path",
value: relative(dirname(pnpmLock), dirname(wsSrcFile)),
});
}
}
// Capture all the workspaces that directly depend on this package and their source file
for (const wref of Array.from(
Expand Down
2 changes: 1 addition & 1 deletion types/lib/helpers/utils.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c91d431

Please sign in to comment.