@pnpm/resolving.git-resolver 1100.1.3 → 1100.1.4

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.
@@ -1,5 +1,6 @@
1
1
  export function createGitHostedPkgId({ repo, commit, path }) {
2
- let id = `${repo.includes('://') ? '' : 'https://'}${repo}#${commit}`;
2
+ const normalizedRepo = normalizeGitRepoForPkgResolutionId(repo);
3
+ let id = `${normalizedRepo.includes('://') ? '' : 'https://'}${normalizedRepo}#${commit}`;
3
4
  if (!id.startsWith('git+'))
4
5
  id = `git+${id}`;
5
6
  if (path) {
@@ -7,4 +8,14 @@ export function createGitHostedPkgId({ repo, commit, path }) {
7
8
  }
8
9
  return id;
9
10
  }
11
+ function normalizeGitRepoForPkgResolutionId(repo) {
12
+ // Only scp-style shorthand (`user@host:path`) needs rewriting. A repo that
13
+ // already carries a URL scheme (e.g. `ssh://user@host:2222/path`) is left
14
+ // alone — its `@host:port` would otherwise match the scp pattern and get
15
+ // mangled into `ssh://ssh://…`.
16
+ if (repo.includes('://'))
17
+ return repo;
18
+ const scp = /^([^@\s]+@[^:\s]+):(.+)$/.exec(repo);
19
+ return scp == null ? repo : `ssh://${scp[1]}/${scp[2]}`;
20
+ }
10
21
  //# sourceMappingURL=createGitHostedPkgId.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/resolving.git-resolver",
3
- "version": "1100.1.3",
3
+ "version": "1100.1.4",
4
4
  "description": "Resolver for git-hosted packages",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -32,9 +32,9 @@
32
32
  "graceful-git": "^5.0.0",
33
33
  "hosted-git-info": "npm:@pnpm/hosted-git-info@1.0.0",
34
34
  "semver": "^7.8.1",
35
- "@pnpm/network.fetch": "1100.1.0",
36
- "@pnpm/resolving.resolver-base": "1100.4.0",
37
- "@pnpm/error": "1100.0.0"
35
+ "@pnpm/error": "1100.0.0",
36
+ "@pnpm/network.fetch": "1100.1.1",
37
+ "@pnpm/resolving.resolver-base": "1100.4.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@jest/globals": "30.3.0",
@@ -42,7 +42,7 @@
42
42
  "@types/is-windows": "^1.0.2",
43
43
  "@types/semver": "7.7.1",
44
44
  "is-windows": "^1.0.2",
45
- "@pnpm/resolving.git-resolver": "1100.1.3"
45
+ "@pnpm/resolving.git-resolver": "1100.1.4"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=22.13"