@pnpm/client 0.0.0-20230605-20230605142810

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
4
+ Copyright (c) 2016-2023 Zoltan Kochan and other contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @pnpm/client
2
+
3
+ > Creates the package resolve and fetch functions
4
+
5
+ <!--@shields('npm')-->
6
+ [![npm version](https://img.shields.io/npm/v/@pnpm/client.svg)](https://www.npmjs.com/package/@pnpm/client)
7
+ <!--/@-->
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ pnpm add @pnpm/client
13
+ ```
14
+
15
+ ## License
16
+
17
+ MIT
package/lib/index.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { type ResolveFunction, type ResolverFactoryOptions } from '@pnpm/default-resolver';
2
+ import { type AgentOptions } from '@pnpm/fetch';
3
+ import { type RetryTimeoutOptions } from '@pnpm/fetching-types';
4
+ import type { CustomFetchers, GitFetcher, DirectoryFetcher } from '@pnpm/fetcher-base';
5
+ import { type TarballFetchers } from '@pnpm/tarball-fetcher';
6
+ export type { ResolveFunction };
7
+ export type ClientOptions = {
8
+ authConfig: Record<string, string>;
9
+ customFetchers?: CustomFetchers;
10
+ ignoreScripts?: boolean;
11
+ rawConfig: object;
12
+ retry?: RetryTimeoutOptions;
13
+ timeout?: number;
14
+ unsafePerm?: boolean;
15
+ userAgent?: string;
16
+ userConfig?: Record<string, string>;
17
+ gitShallowHosts?: string[];
18
+ resolveSymlinksInInjectedDirs?: boolean;
19
+ includeOnlyPackageFiles?: boolean;
20
+ } & ResolverFactoryOptions & AgentOptions;
21
+ export interface Client {
22
+ fetchers: Fetchers;
23
+ resolve: ResolveFunction;
24
+ }
25
+ export declare function createClient(opts: ClientOptions): Client;
26
+ export declare function createResolver(opts: ClientOptions): ResolveFunction;
27
+ type Fetchers = {
28
+ git: GitFetcher;
29
+ directory: DirectoryFetcher;
30
+ } & TarballFetchers;
package/lib/index.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createResolver = exports.createClient = void 0;
7
+ const default_resolver_1 = require("@pnpm/default-resolver");
8
+ const fetch_1 = require("@pnpm/fetch");
9
+ const directory_fetcher_1 = require("@pnpm/directory-fetcher");
10
+ const git_fetcher_1 = require("@pnpm/git-fetcher");
11
+ const tarball_fetcher_1 = require("@pnpm/tarball-fetcher");
12
+ const network_auth_header_1 = require("@pnpm/network.auth-header");
13
+ const map_1 = __importDefault(require("ramda/src/map"));
14
+ function createClient(opts) {
15
+ const fetchFromRegistry = (0, fetch_1.createFetchFromRegistry)(opts);
16
+ const getAuthHeader = (0, network_auth_header_1.createGetAuthHeaderByURI)({ allSettings: opts.authConfig, userSettings: opts.userConfig });
17
+ return {
18
+ fetchers: createFetchers(fetchFromRegistry, getAuthHeader, opts, opts.customFetchers),
19
+ resolve: (0, default_resolver_1.createResolver)(fetchFromRegistry, getAuthHeader, opts),
20
+ };
21
+ }
22
+ exports.createClient = createClient;
23
+ function createResolver(opts) {
24
+ const fetchFromRegistry = (0, fetch_1.createFetchFromRegistry)(opts);
25
+ const getAuthHeader = (0, network_auth_header_1.createGetAuthHeaderByURI)({ allSettings: opts.authConfig, userSettings: opts.userConfig });
26
+ return (0, default_resolver_1.createResolver)(fetchFromRegistry, getAuthHeader, opts);
27
+ }
28
+ exports.createResolver = createResolver;
29
+ function createFetchers(fetchFromRegistry, getAuthHeader, opts, customFetchers) {
30
+ const defaultFetchers = {
31
+ ...(0, tarball_fetcher_1.createTarballFetcher)(fetchFromRegistry, getAuthHeader, opts),
32
+ ...(0, git_fetcher_1.createGitFetcher)(opts),
33
+ ...(0, directory_fetcher_1.createDirectoryFetcher)({ resolveSymlinks: opts.resolveSymlinksInInjectedDirs, includeOnlyPackageFiles: opts.includeOnlyPackageFiles }),
34
+ };
35
+ const overwrites = (0, map_1.default)((factory) => factory({ defaultFetchers }), // eslint-disable-line @typescript-eslint/no-explicit-any
36
+ customFetchers ?? {} // eslint-disable-line @typescript-eslint/no-explicit-any
37
+ );
38
+ return {
39
+ ...defaultFetchers,
40
+ ...overwrites,
41
+ };
42
+ }
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,6DAI+B;AAC/B,uCAAwE;AAGxE,+DAAgE;AAChE,mDAAoD;AACpD,2DAAkF;AAClF,mEAAoE;AACpE,wDAAqC;AAwBrC,SAAgB,YAAY,CAAE,IAAmB;IAC/C,MAAM,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I,EAAS,CAAC,yDAAyD;KACtF,CAAA;IAED,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,UAAU;KACd,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@pnpm/client",
3
+ "version": "0.0.0-20230605-20230605142810",
4
+ "description": "Creates the package resolve and fetch functions",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "!*.map"
10
+ ],
11
+ "engines": {
12
+ "node": ">=16.14"
13
+ },
14
+ "repository": "https://github.com/pnpm/pnpm/blob/main/pkg-manager/client",
15
+ "keywords": [
16
+ "pnpm8",
17
+ "pnpm",
18
+ "resolver",
19
+ "npm"
20
+ ],
21
+ "license": "MIT",
22
+ "bugs": {
23
+ "url": "https://github.com/pnpm/pnpm/issues"
24
+ },
25
+ "homepage": "https://github.com/pnpm/pnpm/blob/main/pkg-manager/client#readme",
26
+ "dependencies": {
27
+ "ramda": "npm:@pnpm/ramda@0.28.1",
28
+ "@pnpm/default-resolver": "0.0.0-20230605-20230605142810",
29
+ "@pnpm/fetch": "7.0.2",
30
+ "@pnpm/directory-fetcher": "0.0.0-20230605-20230605142810",
31
+ "@pnpm/fetching-types": "5.0.0",
32
+ "@pnpm/git-fetcher": "0.0.0-20230605-20230605142810",
33
+ "@pnpm/network.auth-header": "0.0.0-20230605-20230605142810",
34
+ "@pnpm/resolver-base": "10.0.1",
35
+ "@pnpm/tarball-fetcher": "0.0.0-20230605-20230605142810"
36
+ },
37
+ "devDependencies": {
38
+ "@types/ramda": "0.28.20",
39
+ "@pnpm/fetcher-base": "14.0.1",
40
+ "@pnpm/client": "0.0.0-20230605-20230605142810"
41
+ },
42
+ "funding": "https://opencollective.com/pnpm",
43
+ "exports": {
44
+ ".": "./lib/index.js"
45
+ },
46
+ "scripts": {
47
+ "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
48
+ "_test": "jest",
49
+ "test": "pnpm run compile && pnpm run _test",
50
+ "compile": "tsc --build && pnpm run lint --fix"
51
+ }
52
+ }