custompatch
Advanced tools
+34
-1
@@ -156,2 +156,32 @@ #!/usr/bin/env node | ||
| // build a tarball URL for the given package version | ||
| function npmTarballURL(pkgName, pkgVersion, registryURL) | ||
| { | ||
| let registry; | ||
| if (registryURL) | ||
| { | ||
| registry = registryURL.endsWith('/') ? registryURL : registryURL + '/'; | ||
| } | ||
| else | ||
| { | ||
| registry = 'https://registry.npmjs.org/'; | ||
| } | ||
| const scopelessName = getScopelessName(pkgName); | ||
| return `${registry}${pkgName}/-/${scopelessName}-${removeBuildMetadataFromVersion(pkgVersion)}.tgz`; | ||
| } | ||
| function removeBuildMetadataFromVersion (version) | ||
| { | ||
| const plusPos = version.indexOf('+'); | ||
| if (plusPos === -1) return version; | ||
| return version.substring(0, plusPos); | ||
| } | ||
| function getScopelessName (name) | ||
| { | ||
| if (name[0] !== '@') return name; | ||
| return name.split('/')[1]; | ||
| } | ||
| // build a patch for the given package | ||
@@ -162,3 +192,6 @@ function makePatch(pkgName) | ||
| const cfg = getConfig(pkgName); | ||
| if(cfg && cfg._resolved !== '') fetchPackage(pkgName, cfg._resolved, cfg.version, comparePackages); | ||
| if(cfg) | ||
| { | ||
| fetchPackage(pkgName, npmTarballURL(pkgName, cfg.version), cfg.version, comparePackages); | ||
| } | ||
| else | ||
@@ -165,0 +198,0 @@ { |
+1
-1
| { | ||
| "name": "custompatch", | ||
| "version": "1.0.21", | ||
| "version": "1.0.22", | ||
| "description": "Tool for patching buggy NPM packages instead of forking them", | ||
@@ -5,0 +5,0 @@ "author": "IVO GELOV", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
17897
4.32%335
9.48%9
12.5%