@nodesecure/scanner 5.2.0 → 5.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodesecure/scanner",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "A package API to run a static analysis of your module's dependencies.",
5
5
  "exports": "./index.js",
6
6
  "engines": {
package/src/depWalker.js CHANGED
@@ -268,7 +268,7 @@ export async function depWalker(manifest, options = {}, logger = new Logger()) {
268
268
 
269
269
  if (dependencies.has(name)) {
270
270
  const dep = dependencies.get(name);
271
- promisesToWait.push(manifestMetadata(name, version, dep.metadata));
271
+ promisesToWait.push(manifestMetadata(name, version, dep));
272
272
 
273
273
  const currVersion = Object.keys(current.versions)[0];
274
274
  if (currVersion in dep.versions) {
@@ -8,12 +8,23 @@ import { packument, packumentVersion } from "@nodesecure/npm-registry-sdk";
8
8
  // Import Internal Dependencies
9
9
  import { parseAuthor, getLinks } from "./utils/index.js";
10
10
 
11
- export async function manifestMetadata(name, version, metadata) {
11
+ export async function manifestMetadata(
12
+ name,
13
+ version,
14
+ dependency
15
+ ) {
12
16
  try {
13
17
  const pkgVersion = await packumentVersion(name, version);
14
18
 
15
19
  const integrity = getPackumentVersionIntegrity(pkgVersion);
16
- metadata.integrity[version] = integrity;
20
+ Object.assign(
21
+ dependency.versions[version],
22
+ {
23
+ links: getLinks(pkgVersion)
24
+ }
25
+ );
26
+
27
+ dependency.metadata.integrity[version] = integrity;
17
28
  }
18
29
  catch {
19
30
  // Ignore
@@ -19,12 +19,17 @@ function getVCSRepositoryURL(link) {
19
19
  }
20
20
  }
21
21
 
22
- export function getLinks(pkg) {
23
- const homepage = pkg.homepage || null;
24
- const repositoryUrl = pkg.repository?.url || null;
22
+ /**
23
+ * @param {import("@nodesecure/npm-registry-sdk").PackumentVersion} packumentVersion
24
+ */
25
+ export function getLinks(
26
+ packumentVersion
27
+ ) {
28
+ const homepage = packumentVersion.homepage || null;
29
+ const repositoryUrl = packumentVersion.repository?.url || null;
25
30
 
26
31
  return {
27
- npm: `https://www.npmjs.com/package/${pkg.name}/v/${pkg.version}`,
32
+ npm: `https://www.npmjs.com/package/${packumentVersion.name}/v/${packumentVersion.version}`,
28
33
  homepage,
29
34
  repository: getVCSRepositoryURL(homepage) ?? getVCSRepositoryURL(repositoryUrl)
30
35
  };