@lateos/npm-scan 0.12.2 → 0.12.3
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/backend/fetch.js +14 -2
- package/package.json +1 -1
package/backend/fetch.js
CHANGED
|
@@ -8,8 +8,20 @@ import { pipeline } from 'stream/promises';
|
|
|
8
8
|
|
|
9
9
|
export async function fetchPackage(target, options = {}) {
|
|
10
10
|
const { cacheDir, cacheTTL = 604800, cacheMaxSize = 1000000000 } = options;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
let name, version;
|
|
12
|
+
|
|
13
|
+
if (target.startsWith('@')) {
|
|
14
|
+
const lastAt = target.lastIndexOf('@');
|
|
15
|
+
name = target.slice(0, lastAt);
|
|
16
|
+
version = target.slice(lastAt + 1);
|
|
17
|
+
if (!version) version = undefined;
|
|
18
|
+
} else {
|
|
19
|
+
const idx = target.indexOf('@');
|
|
20
|
+
name = idx > -1 ? target.slice(0, idx) : target;
|
|
21
|
+
version = idx > -1 ? target.slice(idx + 1) : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const endpoint = version ? `/${encodeURIComponent(name)}/${version}` : `/${encodeURIComponent(name)}/latest`;
|
|
13
25
|
|
|
14
26
|
if (cacheDir) {
|
|
15
27
|
const cached = getFromCache(cacheDir, target, cacheTTL);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lateos/npm-scan",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "Modern npm supply chain security scanner — detects obfuscated payloads, credential stealers, conditional triggers, sandbox evasion, and worm-like propagation. 11 attack types, SBOM, NIST/EU CRA compliance reporting.",
|
|
5
5
|
"main": "backend/index.js",
|
|
6
6
|
"bin": {
|