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

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)