Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/git-fetcher

Package Overview
Dependencies
Maintainers
2
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/git-fetcher - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

4

lib/index.d.ts
import { Cafs, DeferredManifestPromise } from '@pnpm/fetcher-base';
declare const _default: () => {
declare const _default: (createOpts?: {
gitShallowHosts?: string[] | undefined;
} | undefined) => {
git: (cafs: Cafs, resolution: {

@@ -4,0 +6,0 @@ commit: string;

@@ -10,7 +10,16 @@ "use strict";

const execa_1 = __importDefault(require("execa"));
exports.default = () => {
const url_1 = require("url");
exports.default = (createOpts) => {
const allowedHosts = new Set(createOpts?.gitShallowHosts ?? []);
return {
git: async function fetchFromGit(cafs, resolution, opts) {
const tempLocation = await cafs.tempDir();
await execGit(['clone', resolution.repo, tempLocation]);
if (allowedHosts.size > 0 && shouldUseShallow(resolution.repo, allowedHosts)) {
await execGit(['init'], { cwd: tempLocation });
await execGit(['remote', 'add', 'origin', resolution.repo], { cwd: tempLocation });
await execGit(['fetch', '--depth', '1', 'origin', resolution.commit], { cwd: tempLocation });
}
else {
await execGit(['clone', resolution.repo, tempLocation]);
}
await execGit(['checkout', resolution.commit], { cwd: tempLocation });

@@ -28,2 +37,14 @@ await (0, prepare_package_1.default)(tempLocation);

};
function shouldUseShallow(repoUrl, allowedHosts) {
try {
const { host } = new url_1.URL(repoUrl);
if (allowedHosts.has(host)) {
return true;
}
}
catch (e) {
// URL might be malformed
}
return false;
}
function prefixGitArgs() {

@@ -30,0 +51,0 @@ return process.platform === 'win32' ? ['-c', 'core.longpaths=true'] : [];

{
"name": "@pnpm/git-fetcher",
"version": "5.0.0",
"version": "5.1.0",
"description": "A fetcher for git-hosted packages",

@@ -27,3 +27,3 @@ "main": "lib/index.js",

"@pnpm/fetcher-base": "12.0.0",
"@pnpm/prepare-package": "2.0.0",
"@pnpm/prepare-package": "2.0.1",
"@zkochan/rimraf": "^2.1.2",

@@ -34,4 +34,4 @@ "execa": "npm:safe-execa@^0.1.1"

"@pnpm/cafs": "4.0.0",
"@pnpm/git-fetcher": "5.0.0",
"@pnpm/package-store": "13.0.0",
"@pnpm/git-fetcher": "5.1.0",
"@pnpm/package-store": "13.0.1",
"@pnpm/types": "8.0.0",

@@ -38,0 +38,0 @@ "p-defer": "^3.0.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc