This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
/// <reference types="node" />
export declare function envReplace(settingValue: string, env: NodeJS.ProcessEnv): string;

View File

@@ -0,0 +1,18 @@
---
labels: ['configuration']
description: 'A function for repacing env variables in configuration settings'
---
API:
```ts
function envReplace(settingValue: string, env: NodeJS.ProcessEnv): string;
```
Usage:
```ts
import { envReplace } from '@pnpm/config.env-replace'
envReplace('${foo}', process.env)
```

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.envReplace = void 0;
const ENV_EXPR = /(?<!\\)(\\*)\$\{([^${}]+)\}/g;
function envReplace(settingValue, env) {
return settingValue.replace(ENV_EXPR, replaceEnvMatch.bind(null, env));
}
exports.envReplace = envReplace;
function replaceEnvMatch(env, orig, escape, name) {
if (escape.length % 2) {
return orig.slice((escape.length + 1) / 2);
}
const envValue = getEnvValue(env, name);
if (envValue === undefined) {
throw new Error(`Failed to replace env in config: ${orig}`);
}
return `${(escape.slice(escape.length / 2))}${envValue}`;
}
const ENV_VALUE = /([^:-]+)(:?)-(.+)/;
function getEnvValue(env, name) {
const matched = name.match(ENV_VALUE);
if (!matched)
return env[name];
const [, variableName, colon, fallback] = matched;
if (Object.prototype.hasOwnProperty.call(env, variableName)) {
return !env[variableName] && colon ? fallback : env[variableName];
}
return fallback;
}
//# sourceMappingURL=env-replace.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"env-replace.js","sourceRoot":"","sources":["../env-replace.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AAE/C,SAAgB,UAAU,CAAC,YAAoB,EAAE,GAAsB;IACrE,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;AACxE,CAAC;AAFD,gCAEC;AAED,SAAS,eAAe,CAAE,GAAsB,EAAE,IAAY,EAAE,MAAc,EAAE,IAAY;IAC1F,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;KAC3C;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACvC,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAA;AAC1D,CAAC;AAED,MAAM,SAAS,GAAG,mBAAmB,CAAA;AAErC,SAAS,WAAW,CAAE,GAAsB,EAAE,IAAY;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACrC,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAA;IACjD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE;QAC3D,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;KAClE;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const env_replace_1 = require("./env-replace");
const ENV = {
foo: 'foo_value',
bar: 'bar_value',
zoo: '',
};
test.each([
['-${foo}-${bar}', '-foo_value-bar_value'],
['\\${foo}', '${foo}'],
['\\${zoo}', '${zoo}'],
['\\\\${foo}', '\\foo_value'],
['-${foo-fallback-value}-${bar:-fallback-value}', '-foo_value-bar_value'],
['-${qar-fallback-value}-${zoo-fallback-value}', '-fallback-value-'],
['-${qar-fallback-value}-${zoo:-fallback-for-empty-value}', '-fallback-value-fallback-for-empty-value']
])('success %s => %s', (settingValue, expected) => {
const actual = (0, env_replace_1.envReplace)(settingValue, ENV);
expect(actual).toEqual(expected);
});
test('fail when the env variable is not found', () => {
expect(() => (0, env_replace_1.envReplace)('${baz}', ENV)).toThrow(`Failed to replace env in config: \${baz}`);
expect(() => (0, env_replace_1.envReplace)('${foo-}', ENV)).toThrow(`Failed to replace env in config: \${foo-}`);
expect(() => (0, env_replace_1.envReplace)('${foo:-}', ENV)).toThrow(`Failed to replace env in config: \${foo:-}`);
});
//# sourceMappingURL=env-replace.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"env-replace.spec.js","sourceRoot":"","sources":["../env-replace.spec.ts"],"names":[],"mappings":";;AAAA,+CAA2C;AAE3C,MAAM,GAAG,GAAG;IACV,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,EAAE;CACR,CAAA;AAED,IAAI,CAAC,IAAI,CAAC;IACR,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;IAC1C,CAAC,UAAU,EAAE,QAAQ,CAAC;IACtB,CAAC,UAAU,EAAE,QAAQ,CAAC;IACtB,CAAC,YAAY,EAAE,aAAa,CAAC;IAC7B,CAAC,+CAA+C,EAAE,sBAAsB,CAAC;IACzE,CAAC,8CAA8C,EAAE,kBAAkB,CAAC;IACpE,CAAC,yDAAyD,EAAE,0CAA0C,CAAC;CACxG,CAAC,CAAC,kBAAkB,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE;IAChD,MAAM,MAAM,GAAG,IAAA,wBAAU,EAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAC7C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACnD,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;IAC5F,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,wBAAU,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAC;IAC9F,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,wBAAU,EAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAClG,CAAC,CAAC,CAAA"}

View File

@@ -0,0 +1 @@
export { envReplace } from './env-replace';

6
node_modules/@pnpm/config.env-replace/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.envReplace = void 0;
var env_replace_1 = require("./env-replace");
Object.defineProperty(exports, "envReplace", { enumerable: true, get: function () { return env_replace_1.envReplace; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}

View File

@@ -0,0 +1,7 @@
;
import * as overview_0 from '/Users/zoltan/Library/Caches/Bit/capsules/05f6140f72f7d4c5be56111dbe63734e37f4e9e4/pnpm.config_env-replace@1.1.0/dist/env-replace.docs.mdx';
export const compositions = [];
export const overview = [overview_0];
export const compositions_metadata = {"compositions":[]};

View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
"lib": [
"es2019",
"DOM",
"ES6",
"DOM.Iterable"
],
"target": "es2015",
"module": "CommonJS",
"jsx": "react",
"allowJs": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"rootDir": ".",
"resolveJsonModule": true
},
"exclude": [
"dist",
"package.json"
],
"include": [
"**/*",
"**/*.json"
]
}

View File

@@ -0,0 +1,18 @@
---
labels: ['configuration']
description: 'A function for repacing env variables in configuration settings'
---
API:
```ts
function envReplace(settingValue: string, env: NodeJS.ProcessEnv): string;
```
Usage:
```ts
import { envReplace } from '@pnpm/config.env-replace'
envReplace('${foo}', process.env)
```

View File

@@ -0,0 +1,27 @@
import { envReplace } from './env-replace';
const ENV = {
foo: 'foo_value',
bar: 'bar_value',
zoo: '',
}
test.each([
['-${foo}-${bar}', '-foo_value-bar_value'],
['\\${foo}', '${foo}'],
['\\${zoo}', '${zoo}'],
['\\\\${foo}', '\\foo_value'],
['-${foo-fallback-value}-${bar:-fallback-value}', '-foo_value-bar_value'],
['-${qar-fallback-value}-${zoo-fallback-value}', '-fallback-value-'],
['-${qar-fallback-value}-${zoo:-fallback-for-empty-value}', '-fallback-value-fallback-for-empty-value']
])('success %s => %s', (settingValue, expected) => {
const actual = envReplace(settingValue, ENV);
expect(actual).toEqual(expected);
})
test('fail when the env variable is not found', () => {
expect(() => envReplace('${baz}', ENV)).toThrow(`Failed to replace env in config: \${baz}`);
expect(() => envReplace('${foo-}', ENV)).toThrow(`Failed to replace env in config: \${foo-}`);
expect(() => envReplace('${foo:-}', ENV)).toThrow(`Failed to replace env in config: \${foo:-}`);
})

28
node_modules/@pnpm/config.env-replace/env-replace.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
const ENV_EXPR = /(?<!\\)(\\*)\$\{([^${}]+)\}/g
export function envReplace(settingValue: string, env: NodeJS.ProcessEnv): string {
return settingValue.replace(ENV_EXPR, replaceEnvMatch.bind(null, env))
}
function replaceEnvMatch (env: NodeJS.ProcessEnv, orig: string, escape: string, name: string): string {
if (escape.length % 2) {
return orig.slice((escape.length + 1) / 2)
}
const envValue = getEnvValue(env, name)
if (envValue === undefined) {
throw new Error(`Failed to replace env in config: ${orig}`)
}
return `${(escape.slice(escape.length / 2))}${envValue}`
}
const ENV_VALUE = /([^:-]+)(:?)-(.+)/
function getEnvValue (env: NodeJS.ProcessEnv, name: string): string {
const matched = name.match(ENV_VALUE)
if (!matched) return env[name]
const [, variableName, colon, fallback] = matched
if (Object.prototype.hasOwnProperty.call(env, variableName)) {
return !env[variableName] && colon ? fallback : env[variableName]
}
return fallback
}

1
node_modules/@pnpm/config.env-replace/index.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { envReplace } from './env-replace';

31
node_modules/@pnpm/config.env-replace/package.json generated vendored Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "@pnpm/config.env-replace",
"version": "1.1.0",
"homepage": "https://bit.cloud/pnpm/config/env-replace",
"main": "dist/index.js",
"componentId": {
"scope": "pnpm.config",
"name": "env-replace",
"version": "1.1.0"
},
"dependencies": {},
"devDependencies": {
"@types/jest": "26.0.20",
"@types/node": "12.20.4",
"@babel/runtime": "7.20.0"
},
"peerDependencies": {},
"license": "MIT",
"private": false,
"engines": {
"node": ">=12.22.0"
},
"repository": {
"type": "git",
"url": "https://github.com/pnpm/components"
},
"keywords": [],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}

32
node_modules/@pnpm/config.env-replace/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
"lib": [
"es2019",
"DOM",
"ES6",
"DOM.Iterable"
],
"target": "es2015",
"module": "CommonJS",
"jsx": "react",
"allowJs": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"rootDir": ".",
"resolveJsonModule": true
},
"exclude": [
"dist",
"package.json"
],
"include": [
"**/*",
"**/*.json"
]
}

29
node_modules/@pnpm/config.env-replace/types/asset.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
declare module '*.png' {
const value: any;
export = value;
}
declare module '*.svg' {
import type { FunctionComponent, SVGProps } from 'react';
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
const src: string;
export default src;
}
// @TODO Gilad
declare module '*.jpg' {
const value: any;
export = value;
}
declare module '*.jpeg' {
const value: any;
export = value;
}
declare module '*.gif' {
const value: any;
export = value;
}
declare module '*.bmp' {
const value: any;
export = value;
}

42
node_modules/@pnpm/config.env-replace/types/style.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.mdx' {
const component: any;
export default component;
}

12
node_modules/@pnpm/network.ca-file/ca-file.docs.mdx generated vendored Normal file
View File

@@ -0,0 +1,12 @@
---
labels: ['ca', 'certificate authority']
description: 'A component for reading the certificate authority data from a text file'
---
API:
```ts
import { readCAFileSync } from '@pnpm/network.ca-file'
readCAFileSync('cafile.txt')
```

20
node_modules/@pnpm/network.ca-file/ca-file.spec.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import path from 'path'
import { readCAFileSync } from './ca-file';
it('should read CA file', () => {
expect(readCAFileSync(path.join(__dirname, 'fixtures/ca-file1.txt'))).toStrictEqual([
`-----BEGIN CERTIFICATE-----
XXXX
-----END CERTIFICATE-----`,
`-----BEGIN CERTIFICATE-----
YYYY
-----END CERTIFICATE-----`,
`-----BEGIN CERTIFICATE-----
ZZZZ
-----END CERTIFICATE-----`,
]);
});
it('should not fail when the file does not exist', () => {
expect(readCAFileSync(path.join(__dirname, 'not-exists.txt'))).toEqual(undefined)
})

16
node_modules/@pnpm/network.ca-file/ca-file.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import fs from 'graceful-fs'
export function readCAFileSync (filePath: string): string[] | undefined {
try {
const contents = fs.readFileSync(filePath, 'utf8')
const delim = '-----END CERTIFICATE-----'
const output = contents
.split(delim)
.filter((ca) => Boolean(ca.trim()))
.map((ca) => `${ca.trimLeft()}${delim}`)
return output
} catch (err) {
if (err.code === 'ENOENT') return undefined
throw err
}
}

1
node_modules/@pnpm/network.ca-file/dist/ca-file.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function readCAFileSync(filePath: string): string[] | undefined;

View File

@@ -0,0 +1,12 @@
---
labels: ['ca', 'certificate authority']
description: 'A component for reading the certificate authority data from a text file'
---
API:
```ts
import { readCAFileSync } from '@pnpm/network.ca-file'
readCAFileSync('cafile.txt')
```

25
node_modules/@pnpm/network.ca-file/dist/ca-file.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.readCAFileSync = void 0;
const graceful_fs_1 = __importDefault(require("graceful-fs"));
function readCAFileSync(filePath) {
try {
const contents = graceful_fs_1.default.readFileSync(filePath, 'utf8');
const delim = '-----END CERTIFICATE-----';
const output = contents
.split(delim)
.filter((ca) => Boolean(ca.trim()))
.map((ca) => `${ca.trimLeft()}${delim}`);
return output;
}
catch (err) {
if (err.code === 'ENOENT')
return undefined;
throw err;
}
}
exports.readCAFileSync = readCAFileSync;
//# sourceMappingURL=ca-file.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ca-file.js","sourceRoot":"","sources":["../ca-file.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA4B;AAE5B,SAAgB,cAAc,CAAE,QAAgB;IAC9C,IAAI;QACF,MAAM,QAAQ,GAAG,qBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAClD,MAAM,KAAK,GAAG,2BAA2B,CAAA;QACzC,MAAM,MAAM,GAAG,QAAQ;aACpB,KAAK,CAAC,KAAK,CAAC;aACZ,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;aAClC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;QAC1C,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAA;QAC3C,MAAM,GAAG,CAAA;KACV;AACH,CAAC;AAbD,wCAaC"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,24 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const ca_file_1 = require("./ca-file");
it('should read CA file', () => {
expect((0, ca_file_1.readCAFileSync)(path_1.default.join(__dirname, 'fixtures/ca-file1.txt'))).toStrictEqual([
`-----BEGIN CERTIFICATE-----
XXXX
-----END CERTIFICATE-----`,
`-----BEGIN CERTIFICATE-----
YYYY
-----END CERTIFICATE-----`,
`-----BEGIN CERTIFICATE-----
ZZZZ
-----END CERTIFICATE-----`,
]);
});
it('should not fail when the file does not exist', () => {
expect((0, ca_file_1.readCAFileSync)(path_1.default.join(__dirname, 'not-exists.txt'))).toEqual(undefined);
});
//# sourceMappingURL=ca-file.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ca-file.spec.js","sourceRoot":"","sources":["../ca-file.spec.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,uCAA2C;AAE3C,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;IAC7B,MAAM,CAAC,IAAA,wBAAc,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAClF;;0BAEsB;QACtB;;0BAEsB;QACtB;;0BAEsB;KACvB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;IACtD,MAAM,CAAC,IAAA,wBAAc,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACnF,CAAC,CAAC,CAAA"}

View File

@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
XXXX
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
YYYY
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
ZZZZ
-----END CERTIFICATE-----

1
node_modules/@pnpm/network.ca-file/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './ca-file';

18
node_modules/@pnpm/network.ca-file/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./ca-file"), exports);
//# sourceMappingURL=index.js.map

1
node_modules/@pnpm/network.ca-file/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB"}

32
node_modules/@pnpm/network.ca-file/dist/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
"lib": [
"es2019",
"DOM",
"ES6",
"DOM.Iterable"
],
"target": "es2015",
"module": "CommonJS",
"jsx": "react",
"allowJs": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"rootDir": ".",
"resolveJsonModule": true
},
"exclude": [
"dist",
"package.json"
],
"include": [
"**/*",
"**/*.json"
]
}

View File

@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
XXXX
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
YYYY
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
ZZZZ
-----END CERTIFICATE-----

1
node_modules/@pnpm/network.ca-file/index.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './ca-file'

View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,143 @@
# graceful-fs
graceful-fs functions as a drop-in replacement for the fs module,
making various improvements.
The improvements are meant to normalize behavior across different
platforms and environments, and to make filesystem access more
resilient to errors.
## Improvements over [fs module](https://nodejs.org/api/fs.html)
* Queues up `open` and `readdir` calls, and retries them once
something closes if there is an EMFILE error from too many file
descriptors.
* fixes `lchmod` for Node versions prior to 0.6.2.
* implements `fs.lutimes` if possible. Otherwise it becomes a noop.
* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
`lchown` if the user isn't root.
* makes `lchmod` and `lchown` become noops, if not available.
* retries reading a file if `read` results in EAGAIN error.
On Windows, it retries renaming a file for up to one second if `EACCESS`
or `EPERM` error occurs, likely because antivirus software has locked
the directory.
## USAGE
```javascript
// use just like fs
var fs = require('graceful-fs')
// now go and do stuff with it...
fs.readFile('some-file-or-whatever', (err, data) => {
// Do stuff here.
})
```
## Sync methods
This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync
methods. If you use sync methods which open file descriptors then you are
responsible for dealing with any errors.
This is a known limitation, not a bug.
## Global Patching
If you want to patch the global fs module (or any other fs-like
module) you can do this:
```javascript
// Make sure to read the caveat below.
var realFs = require('fs')
var gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(realFs)
```
This should only ever be done at the top-level application layer, in
order to delay on EMFILE errors from any fs-using dependencies. You
should **not** do this in a library, because it can cause unexpected
delays in other parts of the program.
## Changes
This module is fairly stable at this point, and used by a lot of
things. That being said, because it implements a subtle behavior
change in a core part of the node API, even modest changes can be
extremely breaking, and the versioning is thus biased towards
bumping the major when in doubt.
The main change between major versions has been switching between
providing a fully-patched `fs` module vs monkey-patching the node core
builtin, and the approach by which a non-monkey-patched `fs` was
created.
The goal is to trade `EMFILE` errors for slower fs operations. So, if
you try to open a zillion files, rather than crashing, `open`
operations will be queued up and wait for something else to `close`.
There are advantages to each approach. Monkey-patching the fs means
that no `EMFILE` errors can possibly occur anywhere in your
application, because everything is using the same core `fs` module,
which is patched. However, it can also obviously cause undesirable
side-effects, especially if the module is loaded multiple times.
Implementing a separate-but-identical patched `fs` module is more
surgical (and doesn't run the risk of patching multiple times), but
also imposes the challenge of keeping in sync with the core module.
The current approach loads the `fs` module, and then creates a
lookalike object that has all the same methods, except a few that are
patched. It is safe to use in all versions of Node from 0.8 through
7.0.
### v4
* Do not monkey-patch the fs module. This module may now be used as a
drop-in dep, and users can opt into monkey-patching the fs builtin
if their app requires it.
### v3
* Monkey-patch fs, because the eval approach no longer works on recent
node.
* fixed possible type-error throw if rename fails on windows
* verify that we *never* get EMFILE errors
* Ignore ENOSYS from chmod/chown
* clarify that graceful-fs must be used as a drop-in
### v2.1.0
* Use eval rather than monkey-patching fs.
* readdir: Always sort the results
* win32: requeue a file if error has an OK status
### v2.0
* A return to monkey patching
* wrap process.cwd
### v1.1
* wrap readFile
* Wrap fs.writeFile.
* readdir protection
* Don't clobber the fs builtin
* Handle fs.read EAGAIN errors by trying again
* Expose the curOpen counter
* No-op lchown/lchmod if not implemented
* fs.rename patch only for win32
* Patch fs.rename to handle AV software on Windows
* Close #4 Chown should not fail on einval or eperm if non-root
* Fix isaacs/fstream#1 Only wrap fs one time
* Fix #3 Start at 1024 max files, then back off on EMFILE
* lutimes that doens't blow up on Linux
* A full on-rewrite using a queue instead of just swallowing the EMFILE error
* Wrap Read/Write streams as well
### 1.0
* Update engines for node 0.6
* Be lstat-graceful on Windows
* first

View File

@@ -0,0 +1,23 @@
'use strict'
module.exports = clone
var getPrototypeOf = Object.getPrototypeOf || function (obj) {
return obj.__proto__
}
function clone (obj) {
if (obj === null || typeof obj !== 'object')
return obj
if (obj instanceof Object)
var copy = { __proto__: getPrototypeOf(obj) }
else
var copy = Object.create(null)
Object.getOwnPropertyNames(obj).forEach(function (key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
})
return copy
}

View File

@@ -0,0 +1,448 @@
var fs = require('fs')
var polyfills = require('./polyfills.js')
var legacy = require('./legacy-streams.js')
var clone = require('./clone.js')
var util = require('util')
/* istanbul ignore next - node 0.x polyfill */
var gracefulQueue
var previousSymbol
/* istanbul ignore else - node 0.x polyfill */
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
gracefulQueue = Symbol.for('graceful-fs.queue')
// This is used in testing by future versions
previousSymbol = Symbol.for('graceful-fs.previous')
} else {
gracefulQueue = '___graceful-fs.queue'
previousSymbol = '___graceful-fs.previous'
}
function noop () {}
function publishQueue(context, queue) {
Object.defineProperty(context, gracefulQueue, {
get: function() {
return queue
}
})
}
var debug = noop
if (util.debuglog)
debug = util.debuglog('gfs4')
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
debug = function() {
var m = util.format.apply(util, arguments)
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
console.error(m)
}
// Once time initialization
if (!fs[gracefulQueue]) {
// This queue can be shared by multiple loaded instances
var queue = global[gracefulQueue] || []
publishQueue(fs, queue)
// Patch fs.close/closeSync to shared queue version, because we need
// to retry() whenever a close happens *anywhere* in the program.
// This is essential when multiple graceful-fs instances are
// in play at the same time.
fs.close = (function (fs$close) {
function close (fd, cb) {
return fs$close.call(fs, fd, function (err) {
// This function uses the graceful-fs shared queue
if (!err) {
resetQueue()
}
if (typeof cb === 'function')
cb.apply(this, arguments)
})
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
})
return close
})(fs.close)
fs.closeSync = (function (fs$closeSync) {
function closeSync (fd) {
// This function uses the graceful-fs shared queue
fs$closeSync.apply(fs, arguments)
resetQueue()
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
})
return closeSync
})(fs.closeSync)
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
process.on('exit', function() {
debug(fs[gracefulQueue])
require('assert').equal(fs[gracefulQueue].length, 0)
})
}
}
if (!global[gracefulQueue]) {
publishQueue(global, fs[gracefulQueue]);
}
module.exports = patch(clone(fs))
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
module.exports = patch(fs)
fs.__patched = true;
}
function patch (fs) {
// Everything that references the open() function needs to be in here
polyfills(fs)
fs.gracefulify = patch
fs.createReadStream = createReadStream
fs.createWriteStream = createWriteStream
var fs$readFile = fs.readFile
fs.readFile = readFile
function readFile (path, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$readFile(path, options, cb)
function go$readFile (path, options, cb, startTime) {
return fs$readFile(path, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
}
})
}
}
var fs$writeFile = fs.writeFile
fs.writeFile = writeFile
function writeFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$writeFile(path, data, options, cb)
function go$writeFile (path, data, options, cb, startTime) {
return fs$writeFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
}
})
}
}
var fs$appendFile = fs.appendFile
if (fs$appendFile)
fs.appendFile = appendFile
function appendFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$appendFile(path, data, options, cb)
function go$appendFile (path, data, options, cb, startTime) {
return fs$appendFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
}
})
}
}
var fs$copyFile = fs.copyFile
if (fs$copyFile)
fs.copyFile = copyFile
function copyFile (src, dest, flags, cb) {
if (typeof flags === 'function') {
cb = flags
flags = 0
}
return go$copyFile(src, dest, flags, cb)
function go$copyFile (src, dest, flags, cb, startTime) {
return fs$copyFile(src, dest, flags, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
}
})
}
}
var fs$readdir = fs.readdir
fs.readdir = readdir
var noReaddirOptionVersions = /^v[0-5]\./
function readdir (path, options, cb) {
if (typeof options === 'function')
cb = options, options = null
var go$readdir = noReaddirOptionVersions.test(process.version)
? function go$readdir (path, options, cb, startTime) {
return fs$readdir(path, fs$readdirCallback(
path, options, cb, startTime
))
}
: function go$readdir (path, options, cb, startTime) {
return fs$readdir(path, options, fs$readdirCallback(
path, options, cb, startTime
))
}
return go$readdir(path, options, cb)
function fs$readdirCallback (path, options, cb, startTime) {
return function (err, files) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([
go$readdir,
[path, options, cb],
err,
startTime || Date.now(),
Date.now()
])
else {
if (files && files.sort)
files.sort()
if (typeof cb === 'function')
cb.call(this, err, files)
}
}
}
}
if (process.version.substr(0, 4) === 'v0.8') {
var legStreams = legacy(fs)
ReadStream = legStreams.ReadStream
WriteStream = legStreams.WriteStream
}
var fs$ReadStream = fs.ReadStream
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
ReadStream.prototype.open = ReadStream$open
}
var fs$WriteStream = fs.WriteStream
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
WriteStream.prototype.open = WriteStream$open
}
Object.defineProperty(fs, 'ReadStream', {
get: function () {
return ReadStream
},
set: function (val) {
ReadStream = val
},
enumerable: true,
configurable: true
})
Object.defineProperty(fs, 'WriteStream', {
get: function () {
return WriteStream
},
set: function (val) {
WriteStream = val
},
enumerable: true,
configurable: true
})
// legacy names
var FileReadStream = ReadStream
Object.defineProperty(fs, 'FileReadStream', {
get: function () {
return FileReadStream
},
set: function (val) {
FileReadStream = val
},
enumerable: true,
configurable: true
})
var FileWriteStream = WriteStream
Object.defineProperty(fs, 'FileWriteStream', {
get: function () {
return FileWriteStream
},
set: function (val) {
FileWriteStream = val
},
enumerable: true,
configurable: true
})
function ReadStream (path, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
}
function ReadStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
if (that.autoClose)
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
that.read()
}
})
}
function WriteStream (path, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
}
function WriteStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
}
})
}
function createReadStream (path, options) {
return new fs.ReadStream(path, options)
}
function createWriteStream (path, options) {
return new fs.WriteStream(path, options)
}
var fs$open = fs.open
fs.open = open
function open (path, flags, mode, cb) {
if (typeof mode === 'function')
cb = mode, mode = null
return go$open(path, flags, mode, cb)
function go$open (path, flags, mode, cb, startTime) {
return fs$open(path, flags, mode, function (err, fd) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
}
})
}
}
return fs
}
function enqueue (elem) {
debug('ENQUEUE', elem[0].name, elem[1])
fs[gracefulQueue].push(elem)
retry()
}
// keep track of the timeout between retry() calls
var retryTimer
// reset the startTime and lastTime to now
// this resets the start of the 60 second overall timeout as well as the
// delay between attempts so that we'll retry these jobs sooner
function resetQueue () {
var now = Date.now()
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
// entries that are only a length of 2 are from an older version, don't
// bother modifying those since they'll be retried anyway.
if (fs[gracefulQueue][i].length > 2) {
fs[gracefulQueue][i][3] = now // startTime
fs[gracefulQueue][i][4] = now // lastTime
}
}
// call retry to make sure we're actively processing the queue
retry()
}
function retry () {
// clear the timer and remove it to help prevent unintended concurrency
clearTimeout(retryTimer)
retryTimer = undefined
if (fs[gracefulQueue].length === 0)
return
var elem = fs[gracefulQueue].shift()
var fn = elem[0]
var args = elem[1]
// these items may be unset if they were added by an older graceful-fs
var err = elem[2]
var startTime = elem[3]
var lastTime = elem[4]
// if we don't have a startTime we have no way of knowing if we've waited
// long enough, so go ahead and retry this item now
if (startTime === undefined) {
debug('RETRY', fn.name, args)
fn.apply(null, args)
} else if (Date.now() - startTime >= 60000) {
// it's been more than 60 seconds total, bail now
debug('TIMEOUT', fn.name, args)
var cb = args.pop()
if (typeof cb === 'function')
cb.call(null, err)
} else {
// the amount of time between the last attempt and right now
var sinceAttempt = Date.now() - lastTime
// the amount of time between when we first tried, and when we last tried
// rounded up to at least 1
var sinceStart = Math.max(lastTime - startTime, 1)
// backoff. wait longer than the total time we've been retrying, but only
// up to a maximum of 100ms
var desiredDelay = Math.min(sinceStart * 1.2, 100)
// it's been long enough since the last retry, do it again
if (sinceAttempt >= desiredDelay) {
debug('RETRY', fn.name, args)
fn.apply(null, args.concat([startTime]))
} else {
// if we can't do this job yet, push it to the end of the queue
// and let the next iteration check again
fs[gracefulQueue].push(elem)
}
}
// schedule our next run if one isn't already scheduled
if (retryTimer === undefined) {
retryTimer = setTimeout(retry, 0)
}
}

View File

@@ -0,0 +1,118 @@
var Stream = require('stream').Stream
module.exports = legacy
function legacy (fs) {
return {
ReadStream: ReadStream,
WriteStream: WriteStream
}
function ReadStream (path, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
Stream.call(this);
var self = this;
this.path = path;
this.fd = null;
this.readable = true;
this.paused = false;
this.flags = 'r';
this.mode = 438; /*=0666*/
this.bufferSize = 64 * 1024;
options = options || {};
// Mixin options into this
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.encoding) this.setEncoding(this.encoding);
if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError('start must be a Number');
}
if (this.end === undefined) {
this.end = Infinity;
} else if ('number' !== typeof this.end) {
throw TypeError('end must be a Number');
}
if (this.start > this.end) {
throw new Error('start must be <= end');
}
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self._read();
});
return;
}
fs.open(this.path, this.flags, this.mode, function (err, fd) {
if (err) {
self.emit('error', err);
self.readable = false;
return;
}
self.fd = fd;
self.emit('open', fd);
self._read();
})
}
function WriteStream (path, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
Stream.call(this);
this.path = path;
this.fd = null;
this.writable = true;
this.flags = 'w';
this.encoding = 'binary';
this.mode = 438; /*=0666*/
this.bytesWritten = 0;
options = options || {};
// Mixin options into this
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError('start must be a Number');
}
if (this.start < 0) {
throw new Error('start must be >= zero');
}
this.pos = this.start;
}
this.busy = false;
this._queue = [];
if (this.fd === null) {
this._open = fs.open;
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
this.flush();
}
}
}

View File

@@ -0,0 +1,50 @@
{
"name": "graceful-fs",
"description": "A drop-in replacement for fs, making various improvements.",
"version": "4.2.10",
"repository": {
"type": "git",
"url": "https://github.com/isaacs/node-graceful-fs"
},
"main": "graceful-fs.js",
"directories": {
"test": "test"
},
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
"test": "nyc --silent node test.js | tap -c -",
"posttest": "nyc report"
},
"keywords": [
"fs",
"module",
"reading",
"retry",
"retries",
"queue",
"error",
"errors",
"handling",
"EMFILE",
"EAGAIN",
"EINVAL",
"EPERM",
"EACCESS"
],
"license": "ISC",
"devDependencies": {
"import-fresh": "^2.0.0",
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^12.7.0"
},
"files": [
"fs.js",
"graceful-fs.js",
"legacy-streams.js",
"polyfills.js",
"clone.js"
]
}

View File

@@ -0,0 +1,355 @@
var constants = require('constants')
var origCwd = process.cwd
var cwd = null
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process)
return cwd
}
try {
process.cwd()
} catch (er) {}
// This check is needed until node.js 12 is required
if (typeof process.chdir === 'function') {
var chdir = process.chdir
process.chdir = function (d) {
cwd = null
chdir.call(process, d)
}
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)
}
module.exports = patch
function patch (fs) {
// (re-)implement some things that are known busted or missing.
// lchmod, broken prior to 0.6.2
// back-port the fix here.
if (constants.hasOwnProperty('O_SYMLINK') &&
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs)
}
// lutimes implementation, or no-op
if (!fs.lutimes) {
patchLutimes(fs)
}
// https://github.com/isaacs/node-graceful-fs/issues/4
// Chown should not fail on einval or eperm if non-root.
// It should not fail on enosys ever, as this just indicates
// that a fs doesn't support the intended operation.
fs.chown = chownFix(fs.chown)
fs.fchown = chownFix(fs.fchown)
fs.lchown = chownFix(fs.lchown)
fs.chmod = chmodFix(fs.chmod)
fs.fchmod = chmodFix(fs.fchmod)
fs.lchmod = chmodFix(fs.lchmod)
fs.chownSync = chownFixSync(fs.chownSync)
fs.fchownSync = chownFixSync(fs.fchownSync)
fs.lchownSync = chownFixSync(fs.lchownSync)
fs.chmodSync = chmodFixSync(fs.chmodSync)
fs.fchmodSync = chmodFixSync(fs.fchmodSync)
fs.lchmodSync = chmodFixSync(fs.lchmodSync)
fs.stat = statFix(fs.stat)
fs.fstat = statFix(fs.fstat)
fs.lstat = statFix(fs.lstat)
fs.statSync = statFixSync(fs.statSync)
fs.fstatSync = statFixSync(fs.fstatSync)
fs.lstatSync = statFixSync(fs.lstatSync)
// if lchmod/lchown do not exist, then make them no-ops
if (fs.chmod && !fs.lchmod) {
fs.lchmod = function (path, mode, cb) {
if (cb) process.nextTick(cb)
}
fs.lchmodSync = function () {}
}
if (fs.chown && !fs.lchown) {
fs.lchown = function (path, uid, gid, cb) {
if (cb) process.nextTick(cb)
}
fs.lchownSync = function () {}
}
// on Windows, A/V software can lock the directory, causing this
// to fail with an EACCES or EPERM if the directory contains newly
// created files. Try again on failure, for up to 60 seconds.
// Set the timeout this long because some Windows Anti-Virus, such as Parity
// bit9, may lock files for up to a minute, causing npm package install
// failures. Also, take care to yield the scheduler. Windows scheduling gives
// CPU to a busy looping process, which can cause the program causing the lock
// contention to be starved of CPU by node, so the contention doesn't resolve.
if (platform === "win32") {
fs.rename = typeof fs.rename !== 'function' ? fs.rename
: (function (fs$rename) {
function rename (from, to, cb) {
var start = Date.now()
var backoff = 0;
fs$rename(from, to, function CB (er) {
if (er
&& (er.code === "EACCES" || er.code === "EPERM")
&& Date.now() - start < 60000) {
setTimeout(function() {
fs.stat(to, function (stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er)
})
}, backoff)
if (backoff < 100)
backoff += 10;
return;
}
if (cb) cb(er)
})
}
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)
return rename
})(fs.rename)
}
// if read() returns EAGAIN, then just try it again.
fs.read = typeof fs.read !== 'function' ? fs.read
: (function (fs$read) {
function read (fd, buffer, offset, length, position, callback_) {
var callback
if (callback_ && typeof callback_ === 'function') {
var eagCounter = 0
callback = function (er, _, __) {
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
callback_.apply(this, arguments)
}
}
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
// This ensures `util.promisify` works as it does for native `fs.read`.
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)
return read
})(fs.read)
fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
: (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
var eagCounter = 0
while (true) {
try {
return fs$readSync.call(fs, fd, buffer, offset, length, position)
} catch (er) {
if (er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
continue
}
throw er
}
}
}})(fs.readSync)
function patchLchmod (fs) {
fs.lchmod = function (path, mode, callback) {
fs.open( path
, constants.O_WRONLY | constants.O_SYMLINK
, mode
, function (err, fd) {
if (err) {
if (callback) callback(err)
return
}
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
fs.fchmod(fd, mode, function (err) {
fs.close(fd, function(err2) {
if (callback) callback(err || err2)
})
})
})
}
fs.lchmodSync = function (path, mode) {
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
var threw = true
var ret
try {
ret = fs.fchmodSync(fd, mode)
threw = false
} finally {
if (threw) {
try {
fs.closeSync(fd)
} catch (er) {}
} else {
fs.closeSync(fd)
}
}
return ret
}
}
function patchLutimes (fs) {
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
fs.lutimes = function (path, at, mt, cb) {
fs.open(path, constants.O_SYMLINK, function (er, fd) {
if (er) {
if (cb) cb(er)
return
}
fs.futimes(fd, at, mt, function (er) {
fs.close(fd, function (er2) {
if (cb) cb(er || er2)
})
})
})
}
fs.lutimesSync = function (path, at, mt) {
var fd = fs.openSync(path, constants.O_SYMLINK)
var ret
var threw = true
try {
ret = fs.futimesSync(fd, at, mt)
threw = false
} finally {
if (threw) {
try {
fs.closeSync(fd)
} catch (er) {}
} else {
fs.closeSync(fd)
}
}
return ret
}
} else if (fs.futimes) {
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
fs.lutimesSync = function () {}
}
}
function chmodFix (orig) {
if (!orig) return orig
return function (target, mode, cb) {
return orig.call(fs, target, mode, function (er) {
if (chownErOk(er)) er = null
if (cb) cb.apply(this, arguments)
})
}
}
function chmodFixSync (orig) {
if (!orig) return orig
return function (target, mode) {
try {
return orig.call(fs, target, mode)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
function chownFix (orig) {
if (!orig) return orig
return function (target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function (er) {
if (chownErOk(er)) er = null
if (cb) cb.apply(this, arguments)
})
}
}
function chownFixSync (orig) {
if (!orig) return orig
return function (target, uid, gid) {
try {
return orig.call(fs, target, uid, gid)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
function statFix (orig) {
if (!orig) return orig
// Older versions of Node erroneously returned signed integers for
// uid + gid.
return function (target, options, cb) {
if (typeof options === 'function') {
cb = options
options = null
}
function callback (er, stats) {
if (stats) {
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
}
if (cb) cb.apply(this, arguments)
}
return options ? orig.call(fs, target, options, callback)
: orig.call(fs, target, callback)
}
}
function statFixSync (orig) {
if (!orig) return orig
// Older versions of Node erroneously returned signed integers for
// uid + gid.
return function (target, options) {
var stats = options ? orig.call(fs, target, options)
: orig.call(fs, target)
if (stats) {
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
}
return stats;
}
}
// ENOSYS means that the fs doesn't support the op. Just ignore
// that, because it doesn't matter.
//
// if there's no getuid, or if getuid() is something other
// than 0, and the error is EINVAL or EPERM, then just ignore
// it.
//
// This specific case is a silent failure in cp, install, tar,
// and most other unix tools that manage permissions.
//
// When running as root, or if other types of errors are
// encountered, then it's strict.
function chownErOk (er) {
if (!er)
return true
if (er.code === "ENOSYS")
return true
var nonroot = !process.getuid || process.getuid() !== 0
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true
}
return false
}
}

Binary file not shown.

34
node_modules/@pnpm/network.ca-file/package.json generated vendored Normal file
View File

@@ -0,0 +1,34 @@
{
"name": "@pnpm/network.ca-file",
"version": "1.0.2",
"homepage": "https://bit.dev/pnpm/network/ca-file",
"main": "dist/index.js",
"componentId": {
"scope": "pnpm.network",
"name": "ca-file",
"version": "1.0.2"
},
"dependencies": {
"graceful-fs": "4.2.10"
},
"devDependencies": {
"@types/graceful-fs": "4.1.5",
"@babel/runtime": "7.20.0",
"@types/node": "12.20.4",
"@types/jest": "26.0.20"
},
"peerDependencies": {},
"license": "MIT",
"private": false,
"engines": {
"node": ">=12.22.0"
},
"repository": {
"type": "git",
"url": "https://github.com/pnpm/components"
},
"keywords": [],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}

View File

@@ -0,0 +1,7 @@
;
import * as overview_0 from '/home/zoli/Library/Caches/Bit/capsules/05477724e6beef4627535027aa98d5f966dd9894/pnpm.network_ca-file@1.0.2/dist/ca-file.docs.mdx';
export const compositions = [];
export const overview = [overview_0];
export const compositions_metadata = {"compositions":[]};

32
node_modules/@pnpm/network.ca-file/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
"lib": [
"es2019",
"DOM",
"ES6",
"DOM.Iterable"
],
"target": "es2015",
"module": "CommonJS",
"jsx": "react",
"allowJs": true,
"composite": true,
"declaration": true,
"sourceMap": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"rootDir": ".",
"resolveJsonModule": true
},
"exclude": [
"dist",
"package.json"
],
"include": [
"**/*",
"**/*.json"
]
}

29
node_modules/@pnpm/network.ca-file/types/asset.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
declare module '*.png' {
const value: any;
export = value;
}
declare module '*.svg' {
import type { FunctionComponent, SVGProps } from 'react';
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
const src: string;
export default src;
}
// @TODO Gilad
declare module '*.jpg' {
const value: any;
export = value;
}
declare module '*.jpeg' {
const value: any;
export = value;
}
declare module '*.gif' {
const value: any;
export = value;
}
declare module '*.bmp' {
const value: any;
export = value;
}

42
node_modules/@pnpm/network.ca-file/types/style.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.mdx' {
const component: any;
export default component;
}

83
node_modules/@pnpm/npm-conf/index.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
'use strict';
const path = require('path');
const Conf = require('./lib/conf');
const _defaults = require('./lib/defaults');
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L101-L200
module.exports = (opts, types, defaults) => {
const conf = new Conf(Object.assign({}, _defaults.defaults, defaults), types);
conf.add(Object.assign({}, opts), 'cli');
const warnings = [];
let failedToLoadBuiltInConfig = false;
if (require.resolve.paths) {
const paths = require.resolve.paths('npm');
// Assume that last path in resolve paths is builtin modules directory
let npmPath;
try {
npmPath = require.resolve('npm', {paths: paths.slice(-1)});
} catch (error) {
// Error will be thrown if module cannot be found.
// Update the flag while loading builtin config failed.
failedToLoadBuiltInConfig = true;
}
if (npmPath) {
/**
* According to https://github.com/npm/cli/blob/86f5bdb91f7a5971953a5171d32d6eeda6a2e972/lib/npm.js#L258
* and https://github.com/npm/cli/blob/86f5bdb91f7a5971953a5171d32d6eeda6a2e972/lib/config/core.js#L92
*/
warnings.push(conf.addFile(path.resolve(path.dirname(npmPath), '..', 'npmrc'), 'builtin'));
}
}
conf.addEnv();
conf.loadPrefix();
const projectConf = path.resolve(conf.localPrefix, '.npmrc');
const userConf = conf.get('userconfig');
if (!conf.get('global') && projectConf !== userConf) {
warnings.push(conf.addFile(projectConf, 'project'));
} else {
conf.add({}, 'project');
}
// TODO: cover with tests that configs from workspace .npmrc have bigger priority
// than the ones in userconfig
if (conf.get('workspace-prefix') && conf.get('workspace-prefix') !== projectConf) {
const workspaceConf = path.resolve(conf.get('workspace-prefix'), '.npmrc');
warnings.push(conf.addFile(workspaceConf, 'workspace'));
}
warnings.push(conf.addFile(conf.get('userconfig'), 'user'));
if (conf.get('prefix')) {
const etc = path.resolve(conf.get('prefix'), 'etc');
conf.root.globalconfig = path.resolve(etc, 'npmrc');
conf.root.globalignorefile = path.resolve(etc, 'npmignore');
}
warnings.push(conf.addFile(conf.get('globalconfig'), 'global'));
conf.loadUser();
const caFile = conf.get('cafile');
if (caFile) {
conf.loadCAFile(caFile);
}
return {
config: conf,
warnings: warnings.filter(Boolean),
failedToLoadBuiltInConfig,
};
};
Object.defineProperty(module.exports, 'defaults', {
get() {
return _defaults.defaults;
},
enumerable: true
})

163
node_modules/@pnpm/npm-conf/lib/conf.js generated vendored Normal file
View File

@@ -0,0 +1,163 @@
'use strict';
const { readCAFileSync } = require('@pnpm/network.ca-file');
const fs = require('fs');
const path = require('path');
const {ConfigChain} = require('config-chain');
const envKeyToSetting = require('./envKeyToSetting');
const util = require('./util');
class Conf extends ConfigChain {
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L203-L217
constructor(base, types) {
super(base);
this.root = base;
this._parseField = util.parseField.bind(null, types || require('./types'));
}
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L326-L338
add(data, marker) {
try {
for (const x of Object.keys(data)) {
data[x] = this._parseField(data[x], x);
}
} catch (error) {
throw error;
}
return super.add(data, marker);
}
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L306-L319
addFile(file, name) {
name = name || file;
const marker = {__source__: name};
this.sources[name] = {path: file, type: 'ini'};
this.push(marker);
this._await();
try {
const contents = fs.readFileSync(file, 'utf8');
this.addString(contents, file, 'ini', marker);
} catch (error) {
if (error.code === 'ENOENT') {
this.add({}, marker);
} else {
return `Issue while reading "${file}". ${error.message}`
}
}
}
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L341-L357
addEnv(env) {
env = env || process.env;
const conf = {};
Object.keys(env)
.filter(x => /^npm_config_/i.test(x))
.forEach(x => {
if (!env[x]) {
return;
}
conf[envKeyToSetting(x.substr(11))] = env[x];
});
return super.addEnv('', conf, 'env');
}
// https://github.com/npm/cli/blob/latest/lib/config/load-prefix.js
loadPrefix() {
const cli = this.list[0];
Object.defineProperty(this, 'prefix', {
enumerable: true,
set: prefix => {
const g = this.get('global');
this[g ? 'globalPrefix' : 'localPrefix'] = prefix;
},
get: () => {
const g = this.get('global');
return g ? this.globalPrefix : this.localPrefix;
}
});
Object.defineProperty(this, 'globalPrefix', {
enumerable: true,
set: prefix => {
this.set('prefix', prefix);
},
get: () => {
return path.resolve(this.get('prefix'));
}
});
let p;
Object.defineProperty(this, 'localPrefix', {
enumerable: true,
set: prefix => {
p = prefix;
},
get: () => {
return p;
}
});
if (Object.prototype.hasOwnProperty.call(cli, 'prefix')) {
p = path.resolve(cli.prefix);
} else {
try {
const prefix = util.findPrefix(process.cwd());
p = prefix;
} catch (error) {
throw error;
}
}
return p;
}
// https://github.com/npm/cli/blob/latest/lib/config/load-cafile.js
loadCAFile(file) {
if (!file) {
return;
}
const ca = readCAFileSync(file);
if (ca) {
this.set('ca', ca);
}
}
// https://github.com/npm/cli/blob/latest/lib/config/set-user.js
loadUser() {
const defConf = this.root;
if (this.get('global')) {
return;
}
if (process.env.SUDO_UID) {
defConf.user = Number(process.env.SUDO_UID);
return;
}
const prefix = path.resolve(this.get('prefix'));
try {
const stats = fs.statSync(prefix);
defConf.user = stats.uid;
} catch (error) {
if (error.code === 'ENOENT') {
return;
}
throw error;
}
}
}
module.exports = Conf;

176
node_modules/@pnpm/npm-conf/lib/defaults.js generated vendored Normal file
View File

@@ -0,0 +1,176 @@
// Generated with `lib/make.js`
'use strict';
const os = require('os');
const path = require('path');
const temp = os.tmpdir();
const uidOrPid = process.getuid ? process.getuid() : process.pid;
const hasUnicode = () => true;
const isWindows = process.platform === 'win32';
const osenv = {
editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? 'notepad.exe' : 'vi'),
shell: () => isWindows ? (process.env.COMSPEC || 'cmd.exe') : (process.env.SHELL || '/bin/bash')
};
const umask = {
fromString: () => process.umask()
};
let home = os.homedir();
if (home) {
process.env.HOME = home;
} else {
home = path.resolve(temp, 'npm-' + uidOrPid);
}
const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm';
const cacheRoot = process.platform === 'win32' && process.env.APPDATA || home;
const cache = path.resolve(cacheRoot, cacheExtra);
let defaults;
let globalPrefix;
Object.defineProperty(exports, 'defaults', {
get: function () {
if (defaults) return defaults;
if (process.env.PREFIX) {
globalPrefix = process.env.PREFIX;
} else if (process.platform === 'win32') {
// c:\node\node.exe --> prefix=c:\node\
globalPrefix = path.dirname(process.execPath);
} else {
// /usr/local/bin/node --> prefix=/usr/local
globalPrefix = path.dirname(path.dirname(process.execPath)); // destdir only is respected on Unix
if (process.env.DESTDIR) {
globalPrefix = path.join(process.env.DESTDIR, globalPrefix);
}
}
defaults = {
access: null,
'allow-same-version': false,
'always-auth': false,
also: null,
audit: true,
'auth-type': 'legacy',
'bin-links': true,
browser: null,
ca: null,
cafile: null,
cache: cache,
'cache-lock-stale': 60000,
'cache-lock-retries': 10,
'cache-lock-wait': 10000,
'cache-max': Infinity,
'cache-min': 10,
cert: null,
cidr: null,
color: process.env.NO_COLOR == null,
depth: Infinity,
description: true,
dev: false,
'dry-run': false,
editor: osenv.editor(),
'engine-strict': false,
force: false,
'fetch-retries': 2,
'fetch-retry-factor': 10,
'fetch-retry-mintimeout': 10000,
'fetch-retry-maxtimeout': 60000,
git: 'git',
'git-tag-version': true,
'commit-hooks': true,
global: false,
globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'),
'global-style': false,
group: process.platform === 'win32' ? 0 : process.env.SUDO_GID || process.getgid && process.getgid(),
'ham-it-up': false,
heading: 'npm',
'if-present': false,
'ignore-prepublish': false,
'ignore-scripts': false,
'init-module': path.resolve(home, '.npm-init.js'),
'init-author-name': '',
'init-author-email': '',
'init-author-url': '',
'init-version': '1.0.0',
'init-license': 'ISC',
json: false,
key: null,
'legacy-bundling': false,
link: false,
'local-address': undefined,
loglevel: 'notice',
logstream: process.stderr,
'logs-max': 10,
long: false,
maxsockets: 50,
message: '%s',
'metrics-registry': null,
'node-options': null,
// We remove node-version to fix the issue described here: https://github.com/pnpm/pnpm/issues/4203#issuecomment-1133872769
'offline': false,
'onload-script': false,
only: null,
optional: true,
otp: null,
'package-lock': true,
'package-lock-only': false,
parseable: false,
'prefer-offline': false,
'prefer-online': false,
prefix: globalPrefix,
production: process.env.NODE_ENV === 'production',
'progress': !process.env.TRAVIS && !process.env.CI,
provenance: false,
proxy: null,
'https-proxy': null,
'no-proxy': null,
'user-agent': 'npm/{npm-version} ' + 'node/{node-version} ' + '{platform} ' + '{arch}',
'read-only': false,
'rebuild-bundle': true,
registry: 'https://registry.npmjs.org/',
rollback: true,
save: true,
'save-bundle': false,
'save-dev': false,
'save-exact': false,
'save-optional': false,
'save-prefix': '^',
'save-prod': false,
scope: '',
'script-shell': null,
'scripts-prepend-node-path': 'warn-only',
searchopts: '',
searchexclude: null,
searchlimit: 20,
searchstaleness: 15 * 60,
'send-metrics': false,
shell: osenv.shell(),
shrinkwrap: true,
'sign-git-tag': false,
'sso-poll-frequency': 500,
'sso-type': 'oauth',
'strict-ssl': true,
tag: 'latest',
'tag-version-prefix': 'v',
timing: false,
tmp: temp,
unicode: hasUnicode(),
'unsafe-perm': process.platform === 'win32' || process.platform === 'cygwin' || !(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0,
usage: false,
user: process.platform === 'win32' ? 0 : 'nobody',
userconfig: path.resolve(home, '.npmrc'),
umask: process.umask ? process.umask() : umask.fromString('022'),
version: false,
versions: false,
viewer: process.platform === 'win32' ? 'browser' : 'man',
_exit: true
};
return defaults;
}
});

19
node_modules/@pnpm/npm-conf/lib/envKeyToSetting.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
module.exports = function (x) {
const colonIndex = x.indexOf(':');
if (colonIndex === -1) {
return normalize(x);
}
const firstPart = x.substr(0, colonIndex);
const secondPart = x.substr(colonIndex + 1);
return `${normalize(firstPart)}:${normalize(secondPart)}`;
}
function normalize (s) {
s = s.toLowerCase();
if (s === '_authtoken') return '_authToken';
let r = s[0];
for (let i = 1; i < s.length; i++) {
r += s[i] === '_' ? '-' : s[i];
}
return r;
}

View File

@@ -0,0 +1,46 @@
const envKeyToSetting = require('./envKeyToSetting');
const fixtures = [
[
'FOO',
'foo',
],
[
'//npm.pkg.github.com/:_authToken',
'//npm.pkg.github.com/:_authToken',
],
[
'_authToken',
'_authToken',
],
[
'//npm.pkg.github.com/:_authtoken',
'//npm.pkg.github.com/:_authToken',
],
[
'_authtoken',
'_authToken',
],
[
'//npm.pkg.github.com/:_auth',
'//npm.pkg.github.com/:_auth',
],
[
'_auth',
'_auth',
],
[
'//npm.pkg.github.com/:_always_auth',
'//npm.pkg.github.com/:_always-auth',
],
[
'_always_auth',
'_always-auth',
],
];
test('envKeyToSetting()', () => {
for (const [key, expected] of fixtures) {
expect(envKeyToSetting(key)).toBe(expected);
}
})

99
node_modules/@pnpm/npm-conf/lib/make.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
'use strict';
const fs = require('fs');
const path = require('path');
const babylon = require('babylon');
const generate = require('babel-generator').default;
const traverse = require('babel-traverse').default;
const INDENT_REGEXP = /^((?: )+)/gmu;
/** @param {string} match */
const INDENT_REPLACER = match => {
return '\t'.repeat(match.length >>> 1);
};
/** @param {string} body */
const defaultsTemplate = body => `\
// Generated with \`lib/make.js\`
'use strict';
const os = require('os');
const path = require('path');
const temp = os.tmpdir();
const uidOrPid = process.getuid ? process.getuid() : process.pid;
const hasUnicode = () => true;
const isWindows = process.platform === 'win32';
const osenv = {
editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? 'notepad.exe' : 'vi'),
shell: () => isWindows ? (process.env.COMSPEC || 'cmd.exe') : (process.env.SHELL || '/bin/bash')
};
const umask = {
fromString: () => process.umask()
};
let home = os.homedir();
if (home) {
process.env.HOME = home;
} else {
home = path.resolve(temp, 'npm-' + uidOrPid);
}
const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm';
const cacheRoot = process.platform === 'win32' ? process.env.APPDATA : home;
const cache = path.resolve(cacheRoot, cacheExtra);
let defaults;
let globalPrefix;
${body.replace(INDENT_REGEXP, INDENT_REPLACER).replace("'node-version': process.version,", '// We remove node-version to fix the issue described here: https://github.com/pnpm/pnpm/issues/4203#issuecomment-1133872769')};
`;
/** @param {string} body */
const typesTemplate = body => `\
// Generated with \`lib/make.js\`
'use strict';
const path = require('path');
const Stream = require('stream').Stream;
const url = require('url');
const Umask = () => {};
const getLocalAddresses = () => [];
const semver = () => {};
${body.replace(INDENT_REGEXP, INDENT_REPLACER)};
`;
const defaults = require.resolve('npm/lib/config/defaults');
const ast = babylon.parse(fs.readFileSync(defaults, 'utf8'));
const isDefaults = node =>
node.callee.type === 'MemberExpression' &&
node.callee.object.name === 'Object' &&
node.callee.property.name === 'defineProperty' &&
node.arguments.some(x => x.name === 'exports');
const isTypes = node =>
node.type === 'MemberExpression' &&
node.object.name === 'exports' &&
node.property.name === 'types';
let defs;
let types;
traverse(ast, {
CallExpression(path) {
if (isDefaults(path.node)) {
defs = path.node;
}
},
AssignmentExpression(path) {
if (path.node.left && isTypes(path.node.left)) {
types = path.node;
}
}
});
fs.writeFileSync(path.join(__dirname, 'defaults.js'), defaultsTemplate(generate(defs).code));
fs.writeFileSync(path.join(__dirname, 'types.js'), typesTemplate(generate(types).code));

14
node_modules/@pnpm/npm-conf/lib/tsconfig.make-out.json generated vendored Normal file
View File

@@ -0,0 +1,14 @@
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"strictNullChecks": true,
"types": [
"node"
],
},
"files": [
"./types.js",
],
}

122
node_modules/@pnpm/npm-conf/lib/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,122 @@
/// <reference types="node" />
export var types: {
access: (string | null)[];
'allow-same-version': BooleanConstructor;
'always-auth': BooleanConstructor;
also: (string | null)[];
audit: BooleanConstructor;
'auth-type': string[];
'bin-links': BooleanConstructor;
browser: (StringConstructor | null)[];
ca: (StringConstructor | ArrayConstructor | null)[];
cafile: import("path").PlatformPath;
cache: import("path").PlatformPath;
'cache-lock-stale': NumberConstructor;
'cache-lock-retries': NumberConstructor;
'cache-lock-wait': NumberConstructor;
'cache-max': NumberConstructor;
'cache-min': NumberConstructor;
cert: (StringConstructor | null)[];
cidr: (StringConstructor | ArrayConstructor | null)[];
color: (string | BooleanConstructor)[];
depth: NumberConstructor;
description: BooleanConstructor;
dev: BooleanConstructor;
'dry-run': BooleanConstructor;
editor: StringConstructor;
'engine-strict': BooleanConstructor;
force: BooleanConstructor;
'fetch-retries': NumberConstructor;
'fetch-retry-factor': NumberConstructor;
'fetch-retry-mintimeout': NumberConstructor;
'fetch-retry-maxtimeout': NumberConstructor;
git: StringConstructor;
'git-tag-version': BooleanConstructor;
'commit-hooks': BooleanConstructor;
global: BooleanConstructor;
globalconfig: import("path").PlatformPath;
'global-style': BooleanConstructor;
group: (StringConstructor | NumberConstructor)[];
'https-proxy': (typeof import("url") | null)[];
'user-agent': StringConstructor;
'ham-it-up': BooleanConstructor;
heading: StringConstructor;
'if-present': BooleanConstructor;
'ignore-prepublish': BooleanConstructor;
'ignore-scripts': BooleanConstructor;
'init-module': import("path").PlatformPath;
'init-author-name': StringConstructor;
'init-author-email': StringConstructor;
'init-author-url': (string | typeof import("url"))[];
'init-license': StringConstructor;
'init-version': () => void;
json: BooleanConstructor;
key: (StringConstructor | null)[];
'legacy-bundling': BooleanConstructor;
link: BooleanConstructor;
'local-address': never[];
loglevel: string[];
logstream: typeof import("stream").Stream;
'logs-max': NumberConstructor;
long: BooleanConstructor;
maxsockets: NumberConstructor;
message: StringConstructor;
'metrics-registry': (StringConstructor | null)[];
'node-options': (StringConstructor | null)[];
'node-version': ((() => void) | null)[];
'no-proxy': (StringConstructor | ArrayConstructor | null)[];
offline: BooleanConstructor;
'onload-script': (StringConstructor | null)[];
only: (string | null)[];
optional: BooleanConstructor;
'package-lock': BooleanConstructor;
otp: (StringConstructor | null)[];
'package-lock-only': BooleanConstructor;
parseable: BooleanConstructor;
'prefer-offline': BooleanConstructor;
'prefer-online': BooleanConstructor;
prefix: import("path").PlatformPath;
production: BooleanConstructor;
progress: BooleanConstructor;
provenance: BooleanConstructor;
proxy: (boolean | typeof import("url") | null)[];
'read-only': BooleanConstructor;
'rebuild-bundle': BooleanConstructor;
registry: (typeof import("url") | null)[];
rollback: BooleanConstructor;
save: BooleanConstructor;
'save-bundle': BooleanConstructor;
'save-dev': BooleanConstructor;
'save-exact': BooleanConstructor;
'save-optional': BooleanConstructor;
'save-prefix': StringConstructor;
'save-prod': BooleanConstructor;
scope: StringConstructor;
'script-shell': (StringConstructor | null)[];
'scripts-prepend-node-path': (string | boolean)[];
searchopts: StringConstructor;
searchexclude: (StringConstructor | null)[];
searchlimit: NumberConstructor;
searchstaleness: NumberConstructor;
'send-metrics': BooleanConstructor;
shell: StringConstructor;
shrinkwrap: BooleanConstructor;
'sign-git-tag': BooleanConstructor;
'sso-poll-frequency': NumberConstructor;
'sso-type': (string | null)[];
'strict-ssl': BooleanConstructor;
tag: StringConstructor;
timing: BooleanConstructor;
tmp: import("path").PlatformPath;
unicode: BooleanConstructor;
'unsafe-perm': BooleanConstructor;
usage: BooleanConstructor;
user: (StringConstructor | NumberConstructor)[];
userconfig: import("path").PlatformPath;
umask: () => void;
version: BooleanConstructor;
'tag-version-prefix': StringConstructor;
versions: BooleanConstructor;
viewer: StringConstructor;
_exit: BooleanConstructor;
};

134
node_modules/@pnpm/npm-conf/lib/types.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
// Generated with `lib/make.js`
'use strict';
const path = require('path');
const Stream = require('stream').Stream;
const url = require('url');
const Umask = () => {};
const getLocalAddresses = () => [];
const semver = () => {};
exports.types = {
access: [null, 'restricted', 'public'],
'allow-same-version': Boolean,
'always-auth': Boolean,
also: [null, 'dev', 'development'],
audit: Boolean,
'auth-type': ['legacy', 'sso', 'saml', 'oauth'],
'bin-links': Boolean,
browser: [null, String],
ca: [null, String, Array],
cafile: path,
cache: path,
'cache-lock-stale': Number,
'cache-lock-retries': Number,
'cache-lock-wait': Number,
'cache-max': Number,
'cache-min': Number,
cert: [null, String],
cidr: [null, String, Array],
color: ['always', Boolean],
depth: Number,
description: Boolean,
dev: Boolean,
'dry-run': Boolean,
editor: String,
'engine-strict': Boolean,
force: Boolean,
'fetch-retries': Number,
'fetch-retry-factor': Number,
'fetch-retry-mintimeout': Number,
'fetch-retry-maxtimeout': Number,
git: String,
'git-tag-version': Boolean,
'commit-hooks': Boolean,
global: Boolean,
globalconfig: path,
'global-style': Boolean,
group: [Number, String],
'https-proxy': [null, url],
'user-agent': String,
'ham-it-up': Boolean,
'heading': String,
'if-present': Boolean,
'ignore-prepublish': Boolean,
'ignore-scripts': Boolean,
'init-module': path,
'init-author-name': String,
'init-author-email': String,
'init-author-url': ['', url],
'init-license': String,
'init-version': semver,
json: Boolean,
key: [null, String],
'legacy-bundling': Boolean,
link: Boolean,
// local-address must be listed as an IP for a local network interface
// must be IPv4 due to node bug
'local-address': getLocalAddresses(),
loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'],
logstream: Stream,
'logs-max': Number,
long: Boolean,
maxsockets: Number,
message: String,
'metrics-registry': [null, String],
'node-options': [null, String],
'node-version': [null, semver],
'no-proxy': [null, String, Array],
offline: Boolean,
'onload-script': [null, String],
only: [null, 'dev', 'development', 'prod', 'production'],
optional: Boolean,
'package-lock': Boolean,
otp: [null, String],
'package-lock-only': Boolean,
parseable: Boolean,
'prefer-offline': Boolean,
'prefer-online': Boolean,
prefix: path,
production: Boolean,
progress: Boolean,
proxy: [null, false, url],
provenance: Boolean,
// allow proxy to be disabled explicitly
'read-only': Boolean,
'rebuild-bundle': Boolean,
registry: [null, url],
rollback: Boolean,
save: Boolean,
'save-bundle': Boolean,
'save-dev': Boolean,
'save-exact': Boolean,
'save-optional': Boolean,
'save-prefix': String,
'save-prod': Boolean,
scope: String,
'script-shell': [null, String],
'scripts-prepend-node-path': [false, true, 'auto', 'warn-only'],
searchopts: String,
searchexclude: [null, String],
searchlimit: Number,
searchstaleness: Number,
'send-metrics': Boolean,
shell: String,
shrinkwrap: Boolean,
'sign-git-tag': Boolean,
'sso-poll-frequency': Number,
'sso-type': [null, 'oauth', 'saml'],
'strict-ssl': Boolean,
tag: String,
timing: Boolean,
tmp: path,
unicode: Boolean,
'unsafe-perm': Boolean,
usage: Boolean,
user: [Number, String],
userconfig: path,
umask: Umask,
version: Boolean,
'tag-version-prefix': String,
versions: Boolean,
viewer: String,
_exit: Boolean
};

129
node_modules/@pnpm/npm-conf/lib/util.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
'use strict';
const fs = require('fs');
const path = require('path');
const { envReplace } = require('@pnpm/config.env-replace');
// https://github.com/npm/cli/blob/latest/lib/config/core.js#L359-L404
const parseField = (types, field, key) => {
if (typeof field !== 'string') {
return field;
}
const typeList = [].concat(types[key]);
const isPath = typeList.indexOf(path) !== -1;
const isBool = typeList.indexOf(Boolean) !== -1;
const isString = typeList.indexOf(String) !== -1;
const isNumber = typeList.indexOf(Number) !== -1;
field = `${field}`.trim();
if (/^".*"$/.test(field)) {
try {
field = JSON.parse(field);
} catch (error) {
throw new Error(`Failed parsing JSON config key ${key}: ${field}`);
}
}
if (isBool && !isString && field === '') {
return true;
}
switch (field) { // eslint-disable-line default-case
case 'true': {
return true;
}
case 'false': {
return false;
}
case 'null': {
return null;
}
case 'undefined': {
return undefined;
}
}
field = envReplace(field, process.env);
if (isPath) {
const regex = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//;
if (regex.test(field) && process.env.HOME) {
field = path.resolve(process.env.HOME, field.substr(2));
}
field = path.resolve(field);
}
if (isNumber && !isNaN(field)) {
field = Number(field);
}
return field;
};
// https://github.com/npm/cli/blob/latest/lib/config/find-prefix.js
const findPrefix = name => {
name = path.resolve(name);
let walkedUp = false;
while (path.basename(name) === 'node_modules') {
name = path.dirname(name);
walkedUp = true;
}
if (walkedUp) {
return name;
}
const find = (name, original) => {
const regex = /^[a-zA-Z]:(\\|\/)?$/;
if (name === '/' || (process.platform === 'win32' && regex.test(name))) {
return original;
}
try {
const files = fs.readdirSync(name);
if (
files.includes('node_modules') ||
files.includes('package.json') ||
files.includes('package.json5') ||
files.includes('package.yaml') ||
files.includes('pnpm-workspace.yaml')
) {
return name;
}
const dirname = path.dirname(name);
if (dirname === name) {
return original;
}
return find(dirname, original);
} catch (error) {
if (name === original) {
if (error.code === 'ENOENT') {
return original;
}
throw error;
}
return original;
}
};
return find(name, name);
};
exports.envReplace = envReplace;
exports.findPrefix = findPrefix;
exports.parseField = parseField;

9
node_modules/@pnpm/npm-conf/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

42
node_modules/@pnpm/npm-conf/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"name": "@pnpm/npm-conf",
"version": "2.2.2",
"description": "Get the npm config",
"license": "MIT",
"repository": "pnpm/npm-conf",
"engines": {
"node": ">=12"
},
"files": [
"index.js",
"lib"
],
"keywords": [
"conf",
"config",
"global",
"npm",
"path",
"prefix",
"rc"
],
"dependencies": {
"@pnpm/config.env-replace": "^1.1.0",
"@pnpm/network.ca-file": "^1.0.1",
"config-chain": "^1.1.11"
},
"devDependencies": {
"@types/node": "^14.0.14",
"babel-generator": "^6.24.1",
"babel-traverse": "^6.24.1",
"babylon": "^6.17.1",
"eslint-import-resolver-node": "^0.3.2",
"jest": "^25.1.0",
"npm": "^5.0.4",
"typescript": "^3.9.6"
},
"scripts": {
"__prepublishOnly": "node lib/make.js && tsc -p lib/tsconfig.make-out.json",
"test": "jest"
}
}

47
node_modules/@pnpm/npm-conf/readme.md generated vendored Normal file
View File

@@ -0,0 +1,47 @@
# @pnpm/npm-conf [![Build Status](https://travis-ci.com/pnpm/npm-conf.svg?branch=master)](https://travis-ci.com/pnpm/npm-conf)
> Get the npm config
## Install
```
$ pnpm add @pnpm/npm-conf
```
## Usage
```js
const npmConf = require('@pnpm/npm-conf');
const conf = npmConf();
conf.get('prefix')
//=> //=> /Users/unicorn/.npm-packages
conf.get('registry')
//=> https://registry.npmjs.org/
```
To get a list of all available `npm` config options:
```bash
$ npm config list --long
```
## API
### npmConf()
Returns the `npm` config.
### npmConf.defaults
Returns the default `npm` config.
## License
MIT © [Kevin Mårtensson](https://github.com/kevva)