@pnpm/resolving.git-resolver 1001.1.5 → 1100.0.0
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/lib/index.d.ts +2 -2
- package/lib/parseBareSpecifier.d.ts +2 -2
- package/lib/parseBareSpecifier.js +7 -7
- package/package.json +9 -10
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DispatcherOptions } from '@pnpm/network.fetch';
|
|
2
2
|
import type { GitResolution, ResolveOptions, ResolveResult, TarballResolution } from '@pnpm/resolving.resolver-base';
|
|
3
3
|
import { createGitHostedPkgId } from './createGitHostedPkgId.js';
|
|
4
4
|
import { type HostedPackageSpec } from './parseBareSpecifier.js';
|
|
@@ -12,4 +12,4 @@ export interface GitResolveResult extends ResolveResult {
|
|
|
12
12
|
export type GitResolver = (wantedDependency: {
|
|
13
13
|
bareSpecifier: string;
|
|
14
14
|
}, opts?: Pick<ResolveOptions, 'currentPkg' | 'update'>) => Promise<GitResolveResult | null>;
|
|
15
|
-
export declare function createGitResolver(opts:
|
|
15
|
+
export declare function createGitResolver(opts: DispatcherOptions): GitResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DispatcherOptions } from '@pnpm/network.fetch';
|
|
2
2
|
export interface HostedPackageSpec {
|
|
3
3
|
fetchSpec: string;
|
|
4
4
|
hosted?: {
|
|
@@ -13,4 +13,4 @@ export interface HostedPackageSpec {
|
|
|
13
13
|
gitRange?: string;
|
|
14
14
|
path?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function parseBareSpecifier(bareSpecifier: string, opts:
|
|
16
|
+
export declare function parseBareSpecifier(bareSpecifier: string, opts: DispatcherOptions): null | (() => Promise<HostedPackageSpec>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// cspell:ignore sshurl
|
|
2
2
|
import urlLib, { URL } from 'node:url';
|
|
3
|
-
import {
|
|
3
|
+
import { fetchWithDispatcher } from '@pnpm/network.fetch';
|
|
4
4
|
import { gracefulGit as git } from 'graceful-git';
|
|
5
5
|
import HostedGit from 'hosted-git-info';
|
|
6
6
|
const gitProtocols = new Set([
|
|
@@ -47,11 +47,11 @@ function urlToFetchSpec(url) {
|
|
|
47
47
|
}
|
|
48
48
|
return fetchSpec;
|
|
49
49
|
}
|
|
50
|
-
async function fromHostedGit(hosted,
|
|
50
|
+
async function fromHostedGit(hosted, dispatcherOptions) {
|
|
51
51
|
let fetchSpec = null;
|
|
52
52
|
// try git/https url before fallback to ssh url
|
|
53
53
|
const gitHttpsUrl = hosted.https({ noCommittish: true, noGitPlus: true });
|
|
54
|
-
if (gitHttpsUrl && await isRepoPublic(gitHttpsUrl,
|
|
54
|
+
if (gitHttpsUrl && await isRepoPublic(gitHttpsUrl, dispatcherOptions) && await accessRepository(gitHttpsUrl)) {
|
|
55
55
|
fetchSpec = gitHttpsUrl;
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
@@ -63,7 +63,7 @@ async function fromHostedGit(hosted, agentOptions) {
|
|
|
63
63
|
if (!fetchSpec) {
|
|
64
64
|
const httpsUrl = hosted.https({ noGitPlus: true, noCommittish: true });
|
|
65
65
|
if (httpsUrl) {
|
|
66
|
-
if ((hosted.auth || !await isRepoPublic(httpsUrl,
|
|
66
|
+
if ((hosted.auth || !await isRepoPublic(httpsUrl, dispatcherOptions)) && await accessRepository(httpsUrl)) {
|
|
67
67
|
return {
|
|
68
68
|
fetchSpec: httpsUrl,
|
|
69
69
|
hosted: {
|
|
@@ -82,7 +82,7 @@ async function fromHostedGit(hosted, agentOptions) {
|
|
|
82
82
|
// this is very similar to yarn classic's behavior.
|
|
83
83
|
// npm instead tries git ls-remote directly which prompts user for login credentials.
|
|
84
84
|
// HTTP HEAD on https://domain/user/repo, strip out ".git"
|
|
85
|
-
const response = await
|
|
85
|
+
const response = await fetchWithDispatcher(httpsUrl.replace(/\.git$/, ''), { method: 'HEAD', redirect: 'manual', retry: { retries: 0 }, dispatcherOptions });
|
|
86
86
|
if (response.ok) {
|
|
87
87
|
fetchSpec = httpsUrl;
|
|
88
88
|
}
|
|
@@ -108,9 +108,9 @@ async function fromHostedGit(hosted, agentOptions) {
|
|
|
108
108
|
...parseGitParams(hosted.committish),
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
async function isRepoPublic(httpsUrl,
|
|
111
|
+
async function isRepoPublic(httpsUrl, dispatcherOptions) {
|
|
112
112
|
try {
|
|
113
|
-
const response = await
|
|
113
|
+
const response = await fetchWithDispatcher(httpsUrl.replace(/\.git$/, ''), { method: 'HEAD', redirect: 'manual', retry: { retries: 0 }, dispatcherOptions });
|
|
114
114
|
return response.ok;
|
|
115
115
|
}
|
|
116
116
|
catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.git-resolver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.0",
|
|
4
4
|
"description": "Resolver for git-hosted packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -29,18 +29,17 @@
|
|
|
29
29
|
"graceful-git": "^5.0.0",
|
|
30
30
|
"hosted-git-info": "npm:@pnpm/hosted-git-info@1.0.0",
|
|
31
31
|
"semver": "^7.7.2",
|
|
32
|
-
"@pnpm/error": "
|
|
33
|
-
"@pnpm/resolving.resolver-base": "
|
|
34
|
-
"@pnpm/network.fetch": "
|
|
32
|
+
"@pnpm/error": "1100.0.0",
|
|
33
|
+
"@pnpm/resolving.resolver-base": "1100.0.0",
|
|
34
|
+
"@pnpm/network.fetch": "1100.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@jest/globals": "30.0
|
|
38
|
-
"@pnpm/network.agent": "^2.0.3",
|
|
37
|
+
"@jest/globals": "30.3.0",
|
|
39
38
|
"@types/hosted-git-info": "^3.0.5",
|
|
40
39
|
"@types/is-windows": "^1.0.2",
|
|
41
40
|
"@types/semver": "7.7.1",
|
|
42
41
|
"is-windows": "^1.0.2",
|
|
43
|
-
"@pnpm/resolving.git-resolver": "
|
|
42
|
+
"@pnpm/resolving.git-resolver": "1100.0.0"
|
|
44
43
|
},
|
|
45
44
|
"engines": {
|
|
46
45
|
"node": ">=22.13"
|
|
@@ -50,9 +49,9 @@
|
|
|
50
49
|
},
|
|
51
50
|
"scripts": {
|
|
52
51
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
53
|
-
"
|
|
54
|
-
"test": "pnpm run compile && pnpm run _test",
|
|
52
|
+
"test": "pn compile && pn .test",
|
|
55
53
|
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix",
|
|
56
|
-
"compile": "tsgo --build &&
|
|
54
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
55
|
+
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
57
56
|
}
|
|
58
57
|
}
|