@pnpm/resolving.default-resolver 1100.1.2 → 1100.2.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 +19 -2
- package/lib/index.js +42 -1
- package/package.json +18 -17
package/lib/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ import type { FetchFromRegistry, GetAuthHeader } from '@pnpm/fetching.types';
|
|
|
5
5
|
import { type CustomResolver } from '@pnpm/hooks.types';
|
|
6
6
|
import { type GitResolveResult } from '@pnpm/resolving.git-resolver';
|
|
7
7
|
import { type LocalResolveResult } from '@pnpm/resolving.local-resolver';
|
|
8
|
-
import { type JsrResolveResult, type NamedRegistryResolveResult, type NpmResolveResult, type PackageMeta, type PackageMetaCache, type ResolverFactoryOptions, type WorkspaceResolveResult } from '@pnpm/resolving.npm-resolver';
|
|
9
|
-
import type { ResolveFunction, ResolveOptions, ResolveResult, WantedDependency } from '@pnpm/resolving.resolver-base';
|
|
8
|
+
import { type CreateNpmResolutionVerifierOptions, type JsrResolveResult, type NamedRegistryResolveResult, type NpmResolveResult, type PackageMeta, type PackageMetaCache, type ResolverFactoryOptions, type WorkspaceResolveResult } from '@pnpm/resolving.npm-resolver';
|
|
9
|
+
import type { ResolutionVerifier, ResolveFunction, ResolveOptions, ResolveResult, WantedDependency } from '@pnpm/resolving.resolver-base';
|
|
10
10
|
import { type TarballResolveResult } from '@pnpm/resolving.tarball-resolver';
|
|
11
|
+
import type { RegistryConfig } from '@pnpm/types';
|
|
11
12
|
export type { PackageMeta, PackageMetaCache, ResolveFunction, ResolverFactoryOptions, };
|
|
12
13
|
export interface CustomResolverResolveResult extends ResolveResult {
|
|
13
14
|
resolvedVia: 'custom-resolver';
|
|
@@ -21,3 +22,19 @@ export declare function createResolver(fetchFromRegistry: FetchFromRegistry, get
|
|
|
21
22
|
resolve: DefaultResolver;
|
|
22
23
|
clearCache: () => void;
|
|
23
24
|
};
|
|
25
|
+
export type ResolutionVerifierFactoryOptions = Pick<ResolverFactoryOptions, 'cacheDir' | 'registries' | 'namedRegistries' | 'retry' | 'timeout' | 'fetchWarnTimeoutMs'> & Pick<CreateNpmResolutionVerifierOptions, 'minimumReleaseAge' | 'minimumReleaseAgeStrict' | 'minimumReleaseAgeExclude' | 'ignoreMissingTimeField' | 'trustPolicy' | 'trustPolicyExclude' | 'trustPolicyIgnoreAfter' | 'now'> & {
|
|
26
|
+
configByUri?: Record<string, RegistryConfig>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Companion to {@link createResolver}. Collects the resolver-specific
|
|
30
|
+
* verifier factories (today: npm) into a list. Returns an empty array
|
|
31
|
+
* when no policy is active — callers can cheaply decide whether to
|
|
32
|
+
* iterate at all by checking `verifiers.length`.
|
|
33
|
+
*
|
|
34
|
+
* Future protocols (jsr, git, attestation, etc.) plug in here by pushing
|
|
35
|
+
* their own `ResolutionVerifier` onto the list. Each verifier handles
|
|
36
|
+
* its own protocol short-circuit inside `verify` (returns `{ ok: true }`
|
|
37
|
+
* for resolutions outside its scope), so dispatch happens naturally at
|
|
38
|
+
* the install side — no combinator needed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createResolutionVerifiers(fetchFromRegistry: FetchFromRegistry, opts: ResolutionVerifierFactoryOptions): ResolutionVerifier[];
|
package/lib/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import { resolveDenoRuntime } from '@pnpm/engine.runtime.deno-resolver';
|
|
|
3
3
|
import { resolveNodeRuntime } from '@pnpm/engine.runtime.node-resolver';
|
|
4
4
|
import { PnpmError } from '@pnpm/error';
|
|
5
5
|
import { checkCustomResolverCanResolve } from '@pnpm/hooks.types';
|
|
6
|
+
import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header';
|
|
6
7
|
import { createGitResolver } from '@pnpm/resolving.git-resolver';
|
|
7
8
|
import { resolveFromLocalPath, resolveFromLocalScheme } from '@pnpm/resolving.local-resolver';
|
|
8
|
-
import { createNpmResolver, } from '@pnpm/resolving.npm-resolver';
|
|
9
|
+
import { createNpmResolutionVerifier, createNpmResolver, } from '@pnpm/resolving.npm-resolver';
|
|
9
10
|
import { resolveFromTarball } from '@pnpm/resolving.tarball-resolver';
|
|
10
11
|
async function resolveFromCustomResolvers(customResolvers, wantedDependency, opts) {
|
|
11
12
|
if (!customResolvers || customResolvers.length === 0) {
|
|
@@ -76,4 +77,44 @@ export function createResolver(fetchFromRegistry, getAuthHeader, pnpmOpts) {
|
|
|
76
77
|
clearCache,
|
|
77
78
|
};
|
|
78
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Companion to {@link createResolver}. Collects the resolver-specific
|
|
82
|
+
* verifier factories (today: npm) into a list. Returns an empty array
|
|
83
|
+
* when no policy is active — callers can cheaply decide whether to
|
|
84
|
+
* iterate at all by checking `verifiers.length`.
|
|
85
|
+
*
|
|
86
|
+
* Future protocols (jsr, git, attestation, etc.) plug in here by pushing
|
|
87
|
+
* their own `ResolutionVerifier` onto the list. Each verifier handles
|
|
88
|
+
* its own protocol short-circuit inside `verify` (returns `{ ok: true }`
|
|
89
|
+
* for resolutions outside its scope), so dispatch happens naturally at
|
|
90
|
+
* the install side — no combinator needed.
|
|
91
|
+
*/
|
|
92
|
+
export function createResolutionVerifiers(fetchFromRegistry, opts) {
|
|
93
|
+
const fetchOpts = {
|
|
94
|
+
fetch: fetchFromRegistry,
|
|
95
|
+
retry: opts.retry ?? {},
|
|
96
|
+
timeout: opts.timeout ?? 60_000,
|
|
97
|
+
fetchWarnTimeoutMs: opts.fetchWarnTimeoutMs ?? 10_000,
|
|
98
|
+
};
|
|
99
|
+
const getAuthHeaderValueByURI = createGetAuthHeaderByURI(opts.configByUri ?? {}, opts.registries.default);
|
|
100
|
+
const verifiers = [];
|
|
101
|
+
const npmVerifier = createNpmResolutionVerifier({
|
|
102
|
+
minimumReleaseAge: opts.minimumReleaseAge,
|
|
103
|
+
minimumReleaseAgeStrict: opts.minimumReleaseAgeStrict,
|
|
104
|
+
minimumReleaseAgeExclude: opts.minimumReleaseAgeExclude,
|
|
105
|
+
ignoreMissingTimeField: opts.ignoreMissingTimeField,
|
|
106
|
+
trustPolicy: opts.trustPolicy,
|
|
107
|
+
trustPolicyExclude: opts.trustPolicyExclude,
|
|
108
|
+
trustPolicyIgnoreAfter: opts.trustPolicyIgnoreAfter,
|
|
109
|
+
registries: opts.registries,
|
|
110
|
+
namedRegistries: opts.namedRegistries,
|
|
111
|
+
fetchOpts,
|
|
112
|
+
getAuthHeaderValueByURI,
|
|
113
|
+
cacheDir: opts.cacheDir,
|
|
114
|
+
now: opts.now,
|
|
115
|
+
});
|
|
116
|
+
if (npmVerifier)
|
|
117
|
+
verifiers.push(npmVerifier);
|
|
118
|
+
return verifiers;
|
|
119
|
+
}
|
|
79
120
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.default-resolver",
|
|
3
|
-
"version": "1100.
|
|
3
|
+
"version": "1100.2.0",
|
|
4
4
|
"description": "pnpm's default package resolver",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -26,29 +26,30 @@
|
|
|
26
26
|
"!*.map"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pnpm/engine.runtime.
|
|
30
|
-
"@pnpm/
|
|
29
|
+
"@pnpm/engine.runtime.bun-resolver": "1101.0.7",
|
|
30
|
+
"@pnpm/engine.runtime.node-resolver": "1101.0.9",
|
|
31
31
|
"@pnpm/error": "1100.0.0",
|
|
32
|
-
"@pnpm/
|
|
33
|
-
"@pnpm/
|
|
34
|
-
"@pnpm/hooks.types": "1100.0.
|
|
35
|
-
"@pnpm/
|
|
36
|
-
"@pnpm/resolving.
|
|
37
|
-
"@pnpm/resolving.resolver
|
|
32
|
+
"@pnpm/fetching.types": "1100.0.1",
|
|
33
|
+
"@pnpm/engine.runtime.deno-resolver": "1101.0.7",
|
|
34
|
+
"@pnpm/hooks.types": "1100.0.7",
|
|
35
|
+
"@pnpm/network.auth-header": "1100.0.2",
|
|
36
|
+
"@pnpm/resolving.git-resolver": "1100.0.8",
|
|
37
|
+
"@pnpm/resolving.local-resolver": "1101.0.2",
|
|
38
|
+
"@pnpm/resolving.resolver-base": "1100.2.0",
|
|
39
|
+
"@pnpm/resolving.npm-resolver": "1101.2.0",
|
|
38
40
|
"@pnpm/types": "1101.1.0",
|
|
39
|
-
"@pnpm/resolving.tarball-resolver": "1100.0.
|
|
40
|
-
"@pnpm/engine.runtime.bun-resolver": "1101.0.6"
|
|
41
|
+
"@pnpm/resolving.tarball-resolver": "1100.0.6"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@jest/globals": "30.3.0",
|
|
44
45
|
"load-json-file": "^7.0.1",
|
|
45
46
|
"tempy": "3.0.0",
|
|
46
|
-
"@pnpm/fetching.fetcher-base": "1100.1.
|
|
47
|
-
"@pnpm/
|
|
48
|
-
"@pnpm/network.fetch": "1100.0.
|
|
49
|
-
"@pnpm/
|
|
50
|
-
"@pnpm/
|
|
51
|
-
"@pnpm/
|
|
47
|
+
"@pnpm/fetching.fetcher-base": "1100.1.4",
|
|
48
|
+
"@pnpm/fetching.tarball-fetcher": "1101.0.8",
|
|
49
|
+
"@pnpm/network.fetch": "1100.0.5",
|
|
50
|
+
"@pnpm/resolving.default-resolver": "1100.2.0",
|
|
51
|
+
"@pnpm/store.cafs-types": "1100.0.1",
|
|
52
|
+
"@pnpm/testing.mock-agent": "1100.0.5"
|
|
52
53
|
},
|
|
53
54
|
"engines": {
|
|
54
55
|
"node": ">=22.13"
|