0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

#2606 add prettier plugin sort imports (#2607)

* #2606 add prettier plugin sort imprts

* #2606 update pnpm-lock.yaml

* #2606 update eslint rules

* #2606 fixes website directory formatting

Co-authored-by: Ayush Sharma <ayush.sharma@trivago.com>
This commit is contained in:
Behrang Yarahmadi 2021-10-29 17:33:05 +02:00 committed by GitHub
parent 16458f801e
commit 13310814da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
407 changed files with 1196 additions and 1141 deletions

View file

@ -1,11 +0,0 @@
{
"endOfLine": "lf",
"useTabs": false,
"printWidth": 100,
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"trailingComma": "es5",
"semi": true
}

View file

@ -42,6 +42,7 @@
"@changesets/cli": "2.15.0",
"@changesets/get-dependents-graph": "1.2.2",
"@crowdin/cli": "3.7.1",
"@trivago/prettier-plugin-sort-imports": "3.0.0",
"@types/async": "3.2.7",
"@types/autocannon": "4.1.1",
"@types/autosuggest-highlight": "3.1.1",

View file

@ -1,12 +1,13 @@
import mime from 'mime';
import _ from 'lodash';
import { Router } from 'express';
import _ from 'lodash';
import mime from 'mime';
import { media, allow } from '@verdaccio/middleware';
import { constants, VerdaccioError } from '@verdaccio/core';
import { Package } from '@verdaccio/types';
import { Storage } from '@verdaccio/store';
import { IAuth } from '@verdaccio/auth';
import { VerdaccioError, constants } from '@verdaccio/core';
import { allow, media } from '@verdaccio/middleware';
import { Storage } from '@verdaccio/store';
import { Package } from '@verdaccio/types';
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
export default function (route: Router, auth: IAuth, storage: Storage): void {

View file

@ -1,28 +1,29 @@
import bodyParser from 'body-parser';
import express, { Router } from 'express';
import semver from 'semver';
import { IAuth } from '@verdaccio/auth';
import {
antiLoop,
encodeScopePackage,
match,
validateName,
validatePackage,
encodeScopePackage,
antiLoop,
} from '@verdaccio/middleware';
import { IAuth } from '@verdaccio/auth';
import { Storage } from '@verdaccio/store';
import { Config } from '@verdaccio/types';
import bodyParser from 'body-parser';
import semver from 'semver';
import whoami from './whoami';
import ping from './ping';
import user from './user';
import distTags from './dist-tags';
import pkg from './package';
import ping from './ping';
import publish from './publish';
import search from './search';
import pkg from './package';
import stars from './stars';
import user from './user';
import profile from './v1/profile';
import token from './v1/token';
import v1Search from './v1/search';
import token from './v1/token';
import whoami from './whoami';
if (semver.lte(process.version, 'v15.0.0')) {
global.AbortController = require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController;

View file

@ -1,15 +1,16 @@
import _ from 'lodash';
import { Router } from 'express';
import buildDebug from 'debug';
import { Router } from 'express';
import _ from 'lodash';
import { allow } from '@verdaccio/middleware';
import { getVersion } from '@verdaccio/utils';
import { HEADERS, DIST_TAGS, API_ERROR, errorUtils } from '@verdaccio/core';
import { Config, Package } from '@verdaccio/types';
import { IAuth } from '@verdaccio/auth';
import { API_ERROR, DIST_TAGS, HEADERS, errorUtils } from '@verdaccio/core';
import { allow } from '@verdaccio/middleware';
import { Storage } from '@verdaccio/store';
import { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball';
import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom';
import { Config, Package } from '@verdaccio/types';
import { getVersion } from '@verdaccio/utils';
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
const debug = buildDebug('verdaccio:api:package');

View file

@ -1,5 +1,6 @@
import { Router } from 'express';
import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom';
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
export default function (route: Router): void {
route.get(

View file

@ -1,26 +1,26 @@
import Path from 'path';
import buildDebug from 'debug';
import { Router } from 'express';
import _ from 'lodash';
import mime from 'mime';
import { Router } from 'express';
import buildDebug from 'debug';
import Path from 'path';
import { IAuth } from '@verdaccio/auth';
import {
API_MESSAGE,
HEADERS,
DIST_TAGS,
API_ERROR,
API_MESSAGE,
DIST_TAGS,
HEADERS,
HTTP_STATUS,
errorUtils,
} from '@verdaccio/core';
import { validateMetadata, isObject, hasDiffOneKey } from '@verdaccio/utils';
import { media, expectJson, allow } from '@verdaccio/middleware';
import { notify } from '@verdaccio/hooks';
import { Config, Callback, MergeTags, Version, Package, CallbackAction } from '@verdaccio/types';
import { logger } from '@verdaccio/logger';
import { IAuth } from '@verdaccio/auth';
import { allow, expectJson, media } from '@verdaccio/middleware';
import { Storage } from '@verdaccio/store';
import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom';
import { Callback, CallbackAction, Config, MergeTags, Package, Version } from '@verdaccio/types';
import { hasDiffOneKey, isObject, validateMetadata } from '@verdaccio/utils';
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
import star from './star';
import { isPublishablePackage, isRelatedToDeprecation } from './utils';

View file

@ -1,10 +1,11 @@
import { USERS, HTTP_STATUS } from '@verdaccio/core';
import buildDebug from 'debug';
import { Response } from 'express';
import _ from 'lodash';
import buildDebug from 'debug';
import { HTTP_STATUS, USERS } from '@verdaccio/core';
import { Storage } from '@verdaccio/store';
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
const debug = buildDebug('verdaccio:api:publish:star');

View file

@ -1,11 +1,11 @@
import _ from 'lodash';
import { Response, Router } from 'express';
import _ from 'lodash';
import { USERS, HTTP_STATUS } from '@verdaccio/core';
import { HTTP_STATUS, USERS } from '@verdaccio/core';
import { Storage } from '@verdaccio/store';
import { Package } from '@verdaccio/types';
import { Storage } from '@verdaccio/store';
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
type Packages = Package[];

View file

@ -1,16 +1,16 @@
import _ from 'lodash';
import { Response, Router } from 'express';
import buildDebug from 'debug';
import { Response, Router } from 'express';
import _ from 'lodash';
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
import { getApiToken } from '@verdaccio/auth';
import { logger } from '@verdaccio/logger';
import { createRemoteUser } from '@verdaccio/config';
import { Config, RemoteUser } from '@verdaccio/types';
import { IAuth } from '@verdaccio/auth';
import { createRemoteUser } from '@verdaccio/config';
import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils } from '@verdaccio/core';
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
import { logger } from '@verdaccio/logger';
import { Config, RemoteUser } from '@verdaccio/types';
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
const debug = buildDebug('verdaccio:api:user');

View file

@ -1,6 +1,7 @@
import { Package } from '@verdaccio/types';
import _ from 'lodash';
import { Package } from '@verdaccio/types';
/**
* Check whether the package metadta has enough data to be published
* @param pkg metadata

View file

@ -1,10 +1,11 @@
import _ from 'lodash';
import { Response, Router } from 'express';
import _ from 'lodash';
import { IAuth } from '@verdaccio/auth';
import { API_ERROR, APP_ERROR, HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core';
import { validatePassword } from '@verdaccio/utils';
import { IAuth } from '@verdaccio/auth';
import { $RequestExtend, $NextFunctionVer } from '../../types/custom';
import { $NextFunctionVer, $RequestExtend } from '../../types/custom';
export interface Profile {
tfa: boolean;

View file

@ -1,8 +1,9 @@
import _ from 'lodash';
import buildDebug from 'debug';
import { logger } from '@verdaccio/logger';
import _ from 'lodash';
import { IAuth } from '@verdaccio/auth';
import { HTTP_STATUS, searchUtils } from '@verdaccio/core';
import { logger } from '@verdaccio/logger';
import { Storage } from '@verdaccio/store';
import { Package } from '@verdaccio/types';

View file

@ -1,14 +1,15 @@
import _ from 'lodash';
import { errorUtils, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/core';
import { stringToMD5, mask } from '@verdaccio/utils';
import { getApiToken } from '@verdaccio/auth';
import { logger } from '@verdaccio/logger';
import { Response, Router } from 'express';
import _ from 'lodash';
import { Config, RemoteUser, Token } from '@verdaccio/types';
import { getApiToken } from '@verdaccio/auth';
import { IAuth } from '@verdaccio/auth';
import { HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core';
import { logger } from '@verdaccio/logger';
import { Storage } from '@verdaccio/store';
import { $RequestExtend, $NextFunctionVer } from '../../types/custom';
import { Config, RemoteUser, Token } from '@verdaccio/types';
import { mask, stringToMD5 } from '@verdaccio/utils';
import { $NextFunctionVer, $RequestExtend } from '../../types/custom';
export type NormalizeToken = Token & {
created: string;

View file

@ -1,6 +1,7 @@
import { Response, Router } from 'express';
import buildDebug from 'debug';
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
import { Response, Router } from 'express';
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
const debug = buildDebug('verdaccio:api:user');

View file

@ -1,14 +1,15 @@
import path from 'path';
import express, { Application } from 'express';
import supertest from 'supertest';
import bodyParser from 'body-parser';
import express, { Application } from 'express';
import path from 'path';
import supertest from 'supertest';
import { Config, parseConfigFile } from '@verdaccio/config';
import { Storage } from '@verdaccio/store';
import { generatePackageMetadata } from '@verdaccio/helper';
import { final, handleError, errorReportingMiddleware } from '@verdaccio/middleware';
import { Auth, IAuth } from '@verdaccio/auth';
import { Config, parseConfigFile } from '@verdaccio/config';
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
import { generatePackageMetadata } from '@verdaccio/helper';
import { errorReportingMiddleware, final, handleError } from '@verdaccio/middleware';
import { Storage } from '@verdaccio/store';
import apiEndpoints from '../../src';
const getConf = (conf) => {

View file

@ -1,7 +1,8 @@
import supertest from 'supertest';
import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core';
import { $ResponseExtend, $RequestExtend } from '../../types/custom';
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
import { $RequestExtend, $ResponseExtend } from '../../types/custom';
import { initializeServer, publishTaggedVersion, publishVersion } from './_helper';
const mockApiJWTmiddleware = jest.fn(

View file

@ -1,6 +1,7 @@
import supertest from 'supertest';
import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core';
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
import { initializeServer } from './_helper';
describe('ping', () => {

View file

@ -1,8 +1,10 @@
import { HTTP_STATUS } from '@verdaccio/core';
import supertest from 'supertest';
import { API_ERROR, API_MESSAGE, HEADER_TYPE, HEADERS } from '@verdaccio/core';
import { HTTP_STATUS } from '@verdaccio/core';
import { API_ERROR, API_MESSAGE, HEADERS, HEADER_TYPE } from '@verdaccio/core';
import { generatePackageMetadata } from '@verdaccio/helper';
import { $ResponseExtend, $RequestExtend } from '../../types/custom';
import { $RequestExtend, $ResponseExtend } from '../../types/custom';
import { initializeServer, publishVersion } from './_helper';
const mockApiJWTmiddleware = jest.fn(

View file

@ -1,13 +1,13 @@
import supertest from 'supertest';
import _ from 'lodash';
import supertest from 'supertest';
import {
errorUtils,
API_ERROR,
API_MESSAGE,
HEADERS,
HEADER_TYPE,
API_MESSAGE,
HTTP_STATUS,
API_ERROR,
errorUtils,
} from '@verdaccio/core';
import { $RequestExtend, $ResponseExtend } from '../../types/custom';

View file

@ -1,10 +1,11 @@
import { errorUtils, HTTP_STATUS, API_ERROR } from '@verdaccio/core';
import { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core';
import {
addVersion,
uploadPackageTarball,
publishPackage,
removeTarball,
unPublishPackage,
publishPackage,
uploadPackageTarball,
} from '../../src/publish';
const REVISION_MOCK = '15-e53a77096b0ee33e';

View file

@ -1,7 +1,7 @@
/* eslint-disable curly */
// ensure that all arguments are validated
import path from 'path';
import fs from 'fs';
import path from 'path';
/**
* Validate.

View file

@ -1,6 +1,7 @@
import { Logger, RemoteUser } from '@verdaccio/types';
import { NextFunction, Request, Response } from 'express';
import { Logger, RemoteUser } from '@verdaccio/types';
export type $RequestExtend = Request & { remote_user?: any; log: Logger };
export type $ResponseExtend = Response & { cookies?: any };
export type $NextFunctionVer = NextFunction & any;

View file

@ -1,7 +1,9 @@
import _ from 'lodash';
import { NextFunction, Request, Response } from 'express';
import buildDebug from 'debug';
import { NextFunction, Request, Response } from 'express';
import _ from 'lodash';
import { HTPasswd, HTPasswdConfig } from 'verdaccio-htpasswd';
import { createAnonymousRemoteUser, createRemoteUser } from '@verdaccio/config';
import {
API_ERROR,
SUPPORT_ERRORS,
@ -11,38 +13,33 @@ import {
errorUtils,
} from '@verdaccio/core';
import { loadPlugin } from '@verdaccio/loaders';
import { HTPasswd, HTPasswdConfig } from 'verdaccio-htpasswd';
import {
Config,
Logger,
Callback,
IPluginAuth,
RemoteUser,
JWTSignOptions,
Security,
AuthPluginPackage,
AllowAccess,
AuthPluginPackage,
Callback,
Config,
IPluginAuth,
JWTSignOptions,
Logger,
PackageAccess,
PluginOptions,
RemoteUser,
Security,
} from '@verdaccio/types';
import { getMatchedPackagesSpec, isNil, isFunction } from '@verdaccio/utils';
import { createAnonymousRemoteUser, createRemoteUser } from '@verdaccio/config';
import {
getMiddlewareCredentials,
getDefaultPlugins,
verifyJWTPayload,
parseAuthTokenHeader,
isAuthHeaderValid,
isAESLegacy,
convertPayloadToBase64,
} from './utils';
import { getMatchedPackagesSpec, isFunction, isNil } from '@verdaccio/utils';
import { signPayload } from './jwt-token';
import { aesEncrypt } from './legacy-token';
import { parseBasicPayload } from './token';
import {
convertPayloadToBase64,
getDefaultPlugins,
getMiddlewareCredentials,
isAESLegacy,
isAuthHeaderValid,
parseAuthTokenHeader,
verifyJWTPayload,
} from './utils';
/* eslint-disable @typescript-eslint/no-var-requires */
const LoggerApi = require('@verdaccio/logger');

View file

@ -1,5 +1,5 @@
import jwt from 'jsonwebtoken';
import buildDebug from 'debug';
import jwt from 'jsonwebtoken';
import { JWTSignOptions, RemoteUser } from '@verdaccio/types';

View file

@ -1,13 +1,14 @@
import {
HexBase64BinaryEncoding,
Utf8AsciiBinaryEncoding,
createCipheriv,
createDecipheriv,
HexBase64BinaryEncoding,
randomBytes,
Utf8AsciiBinaryEncoding,
} from 'crypto';
import { TOKEN_VALID_LENGTH } from '@verdaccio/config';
import buildDebug from 'debug';
import { TOKEN_VALID_LENGTH } from '@verdaccio/config';
const debug = buildDebug('verdaccio:auth:token:legacy');
export const defaultAlgorithm = process.env.VERDACCIO_LEGACY_ALGORITHM || 'aes-256-ctr';

View file

@ -1,26 +1,27 @@
import _ from 'lodash';
import buildDebug from 'debug';
import _ from 'lodash';
import { createAnonymousRemoteUser } from '@verdaccio/config';
import {
API_ERROR,
HTTP_STATUS,
TOKEN_BASIC,
TOKEN_BEARER,
VerdaccioError,
errorUtils,
} from '@verdaccio/core';
import {
AuthPackageAllow,
Callback,
Config,
IPluginAuth,
RemoteUser,
Security,
AuthPackageAllow,
} from '@verdaccio/types';
import {
HTTP_STATUS,
TOKEN_BASIC,
TOKEN_BEARER,
API_ERROR,
VerdaccioError,
errorUtils,
} from '@verdaccio/core';
import { createAnonymousRemoteUser } from '@verdaccio/config';
import { TokenEncryption, AESPayload } from './auth';
import { aesDecrypt } from './legacy-token';
import { AESPayload, TokenEncryption } from './auth';
import { verifyPayload } from './jwt-token';
import { aesDecrypt } from './legacy-token';
import { parseBasicPayload } from './token';
const debug = buildDebug('verdaccio:auth:utils');

View file

@ -1,43 +1,42 @@
import path from 'path';
import _ from 'lodash';
import path from 'path';
import { configExample } from '@verdaccio/mock';
import {
Config as AppConfig,
parseConfigFile,
ROLES,
createRemoteUser,
createAnonymousRemoteUser,
createRemoteUser,
parseConfigFile,
} from '@verdaccio/config';
import {
getAuthenticatedMessage,
buildToken,
AllowActionCallbackResponse,
buildUserBuffer,
} from '@verdaccio/utils';
import { Config, Security, RemoteUser } from '@verdaccio/types';
import {
VerdaccioError,
API_ERROR,
CHARACTER_ENCODING,
TOKEN_BEARER,
API_ERROR,
VerdaccioError,
errorUtils,
} from '@verdaccio/core';
import { setup } from '@verdaccio/logger';
import { configExample } from '@verdaccio/mock';
import { Config, RemoteUser, Security } from '@verdaccio/types';
import {
AllowActionCallbackResponse,
buildToken,
buildUserBuffer,
getAuthenticatedMessage,
} from '@verdaccio/utils';
import {
IAuth,
Auth,
ActionsAllowed,
Auth,
IAuth,
aesDecrypt,
allow_action,
getApiToken,
getDefaultPlugins,
getMiddlewareCredentials,
getApiToken,
verifyJWTPayload,
aesDecrypt,
verifyPayload,
signPayload,
verifyJWTPayload,
verifyPayload,
} from '../src';
setup([]);

View file

@ -1,13 +1,13 @@
import _ from 'lodash';
import { ROLES, Config as AppConfig } from '@verdaccio/config';
import { setup } from '@verdaccio/logger';
import { IAuth } from '@verdaccio/auth';
import { Config } from '@verdaccio/types';
import { Config as AppConfig, ROLES } from '@verdaccio/config';
import { errorUtils } from '@verdaccio/core';
import { setup } from '@verdaccio/logger';
import { Config } from '@verdaccio/types';
import { Auth } from '../src';
import { authProfileConf, authPluginFailureConf, authPluginPassThrougConf } from './helper/plugin';
import { authPluginFailureConf, authPluginPassThrougConf, authProfileConf } from './helper/plugin';
setup([]);

View file

@ -1,4 +1,5 @@
import path from 'path';
import { configExample as config } from '@verdaccio/mock';
export const authProfileConf = config({

View file

@ -1,11 +1,12 @@
import { Cli } from 'clipanion';
import { warningUtils } from '@verdaccio/core';
import { FastifyServer } from './commands/FastifyServer';
import { InfoCommand } from './commands/info';
import { InitCommand } from './commands/init';
import { VersionCommand } from './commands/version';
import { FastifyServer } from './commands/FastifyServer';
import { isVersionValid, MIN_NODE_VERSION } from './utils';
import { MIN_NODE_VERSION, isVersionValid } from './utils';
if (process.getuid && process.getuid() === 0) {
warningUtils.emit(warningUtils.Codes.VERWAR001);

View file

@ -1,7 +1,8 @@
import { Command, Option } from 'clipanion';
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
import { setup, logger } from '@verdaccio/logger';
import server from '@verdaccio/fastify-migration';
import { logger, setup } from '@verdaccio/logger';
import { ConfigRuntime } from '@verdaccio/types';
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';

View file

@ -1,5 +1,5 @@
import envinfo from 'envinfo';
import { Command } from 'clipanion';
import envinfo from 'envinfo';
export class InfoCommand extends Command {
public static paths = [[`--info`], [`-i`]];

View file

@ -1,9 +1,10 @@
import { Command, Option } from 'clipanion';
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
import { setup, logger } from '@verdaccio/logger';
import { warningUtils } from '@verdaccio/core';
import { logger, setup } from '@verdaccio/logger';
import { initServer } from '@verdaccio/node-api';
import { ConfigRuntime } from '@verdaccio/types';
import { warningUtils } from '@verdaccio/core';
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';

View file

@ -1,10 +1,11 @@
import fs from 'fs';
import path from 'path';
import _ from 'lodash';
import buildDebug from 'debug';
import fs from 'fs';
import _ from 'lodash';
import path from 'path';
import { CHARACTER_ENCODING } from '@verdaccio/core';
import { folderExists, fileExists } from './config-utils';
import { fileExists, folderExists } from './config-utils';
const CONFIG_FILE = 'config.yaml';
const XDG = 'xdg';

View file

@ -1,25 +1,25 @@
import assert from 'assert';
import _ from 'lodash';
import buildDebug from 'debug';
import _ from 'lodash';
import { getMatchedPackagesSpec, generateRandomHexString, isObject } from '@verdaccio/utils';
import { APP_ERROR } from '@verdaccio/core';
import {
PackageList,
Config as AppConfig,
ConfigRuntime,
Security,
PackageAccess,
ServerSettingsConf,
AuthConf,
ConfigRuntime,
PackageAccess,
PackageList,
Security,
ServerSettingsConf,
} from '@verdaccio/types';
import { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils';
import { generateRandomSecretKey } from './token';
import { normalisePackageAccess } from './package-access';
import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';
import { defaultSecurity } from './security';
import { getUserAgent } from './agent';
import { normalisePackageAccess } from './package-access';
import { defaultSecurity } from './security';
import serverSettings from './serverSettings';
import { generateRandomSecretKey } from './token';
import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';
const strategicConfigProps = ['uplinks', 'packages'];
const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];

View file

@ -1,7 +1,9 @@
import assert from 'assert';
import _ from 'lodash';
import { PackageAccess } from '@verdaccio/types';
import { errorUtils } from '@verdaccio/core';
import { PackageAccess } from '@verdaccio/types';
export interface LegacyPackageList {
[key: string]: PackageAccess;
}

View file

@ -1,5 +1,6 @@
import fs from 'fs';
import YAML from 'js-yaml';
import { APP_ERROR } from '@verdaccio/core';
import { ConfigRuntime, ConfigYaml } from '@verdaccio/types';

View file

@ -1,8 +1,9 @@
import assert from 'assert';
import { getMatchedPackagesSpec } from '@verdaccio/utils';
import { PackageList, UpLinksConfList } from '@verdaccio/types';
import _ from 'lodash';
import { PackageList, UpLinksConfList } from '@verdaccio/types';
import { getMatchedPackagesSpec } from '@verdaccio/utils';
export const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
export const DEFAULT_UPLINK = 'npmjs';

View file

@ -1,4 +1,5 @@
import os from 'os';
import { findConfigFile } from '../src/config-path';
const mockmkDir = jest.fn();

View file

@ -1,14 +1,14 @@
import path from 'path';
import _ from 'lodash';
import path from 'path';
import {
Config,
DEFAULT_REGISTRY,
DEFAULT_UPLINK,
defaultSecurity,
parseConfigFile,
ROLES,
WEB_TITLE,
defaultSecurity,
parseConfigFile,
} from '../src';
import { parseConfigurationFile } from './utils';

View file

@ -1,7 +1,7 @@
import _ from 'lodash';
import { normalisePackageAccess, PACKAGE_ACCESS } from '../src/package-access';
import { parseConfigFile } from '../src';
import { PACKAGE_ACCESS, normalisePackageAccess } from '../src/package-access';
import { parseConfigurationFile } from './utils';
describe('Package access utilities', () => {

View file

@ -1,4 +1,4 @@
import { generateRandomSecretKey, TOKEN_VALID_LENGTH } from '../src/token';
import { TOKEN_VALID_LENGTH, generateRandomSecretKey } from '../src/token';
test('token test valid length', () => {
const token = generateRandomSecretKey();

View file

@ -1,5 +1,5 @@
import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks';
import { normalisePackageAccess, parseConfigFile } from '../src';
import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks';
import { parseConfigurationFile } from './utils';
describe('Uplinks Utilities', () => {

View file

@ -1,5 +1,5 @@
import { ROLES, createAnonymousRemoteUser, createRemoteUser } from '../src';
import { spliceURL } from '../src/string';
import { createAnonymousRemoteUser, createRemoteUser, ROLES } from '../src';
describe('spliceURL', () => {
test('should splice two strings and generate a url', () => {

View file

@ -1,4 +1,5 @@
import createError, { HttpError } from 'http-errors';
import { DEFAULT_MIN_LIMIT_PASSWORD, HTTP_STATUS } from './constants';
export const API_ERROR = {

View file

@ -1,11 +1,11 @@
import * as searchUtils from './search-utils';
import * as streamUtils from './stream-utils';
import * as errorUtils from './error-utils';
import * as validatioUtils from './validation-utils';
import * as constants from './constants';
import * as pluginUtils from './plugin-utils';
import * as errorUtils from './error-utils';
import * as fileUtils from './file-utils';
import * as pkgUtils from './pkg-utils';
import * as pluginUtils from './plugin-utils';
import * as searchUtils from './search-utils';
import * as streamUtils from './stream-utils';
import * as validatioUtils from './validation-utils';
import * as warningUtils from './warning-utils';
export { VerdaccioError, API_ERROR, SUPPORT_ERRORS, APP_ERROR } from './error-utils';

View file

@ -1,5 +1,7 @@
import { Package } from '@verdaccio/types';
import semver from 'semver';
import { Package } from '@verdaccio/types';
import { DIST_TAGS } from './constants';
/**

View file

@ -1,4 +1,5 @@
import { Config, IPackageStorage, Token, TokenFilter } from '@verdaccio/types';
import { searchUtils } from '.';
interface IPlugin {

View file

@ -1,4 +1,4 @@
import { PassThrough, TransformOptions, Transform } from 'stream';
import { PassThrough, Transform, TransformOptions } from 'stream';
export interface IReadTarball {
abort?: () => void;

View file

@ -1,5 +1,7 @@
import assert from 'assert';
import { Package } from '@verdaccio/types';
import { DIST_TAGS } from './constants';
export function isPackageNameScoped(name: string): boolean {

View file

@ -1,17 +1,17 @@
import _ from 'lodash';
import { HTTP_STATUS } from '../src/constants';
import { HTTP_STATUS } from '../src/constants';
import {
getNotFound,
VerdaccioError,
getConflict,
getBadData,
getInternalError,
API_ERROR,
getUnauthorized,
getForbidden,
getServiceUnavailable,
VerdaccioError,
getBadData,
getCode,
getConflict,
getForbidden,
getInternalError,
getNotFound,
getServiceUnavailable,
getUnauthorized,
} from '../src/error-utils';
describe('testing errors', () => {

View file

@ -1,4 +1,4 @@
import { semverSort, mergeVersions } from '../src/pkg-utils';
import { mergeVersions, semverSort } from '../src/pkg-utils';
describe('Storage._merge_versions versions', () => {
test('simple', () => {

View file

@ -1,5 +1,6 @@
import { Stream } from 'stream';
import { readableToString, ReadTarball, UploadTarball } from '../src/stream-utils';
import { ReadTarball, UploadTarball, readableToString } from '../src/stream-utils';
describe('mystreams', () => {
test('should delay events on ReadTarball abort', (cb) => {

View file

@ -1,4 +1,4 @@
import { validateName, validatePackage, isObject } from '../src/validation-utils';
import { isObject, validateName, validatePackage } from '../src/validation-utils';
describe('validatePackage', () => {
test('should validate package names', () => {

View file

@ -1,4 +1,5 @@
import locker from 'lockfile';
import { Callback } from '@verdaccio/types';
// unlocks file by removing existing lock file

View file

@ -1,7 +1,6 @@
import fs from 'fs';
import path from 'path';
import locker from 'lockfile';
import path from 'path';
export const statDir = (name: string): Promise<Error | null> => {
return new Promise((resolve, reject): void => {

View file

@ -1,7 +1,7 @@
import path from 'path';
import fs from 'fs';
import path from 'path';
import { lockFile, unlockFile, readFile } from '../src/index';
import { lockFile, readFile, unlockFile } from '../src/index';
interface Error {
message: string;

View file

@ -1,6 +1,6 @@
import marked from 'marked';
import createDOMPurify from 'dompurify';
import { JSDOM } from 'jsdom';
import marked from 'marked';
const DOMPurify = createDOMPurify(new JSDOM('').window);

View file

@ -1,7 +1,9 @@
import path from 'path';
import buildDebug from 'debug';
import path from 'path';
import { parseConfigFile } from '@verdaccio/config';
import { setup, logger } from '@verdaccio/logger';
import { logger, setup } from '@verdaccio/logger';
import server from '../src/index';
const debug = buildDebug('verdaccio:fastify:debug');

View file

@ -1,8 +1,10 @@
/* eslint-disable no-console */
/* eslint-disable no-invalid-this */
import { logger } from '@verdaccio/logger';
import { FastifyInstance } from 'fastify';
import { logger } from '@verdaccio/logger';
async function pingRoute(fastify: FastifyInstance) {
fastify.get('/-/ping', async () => {
logger.http('ping endpoint');

View file

@ -1,8 +1,10 @@
/* eslint-disable no-console */
/* eslint-disable no-invalid-this */
import { logger } from '@verdaccio/logger';
import { FastifyInstance } from 'fastify';
import { logger } from '@verdaccio/logger';
async function searchRoute(fastify: FastifyInstance) {
fastify.get('/-/v1/search', async (request, reply) => {
// TODO: apply security layer here like in

View file

@ -1,5 +1,5 @@
import { FastifyInstance } from 'fastify';
import buildDebug from 'debug';
import { FastifyInstance } from 'fastify';
const debug = buildDebug('verdaccio:api:tarball');

View file

@ -1,13 +1,15 @@
/* eslint-disable no-console */
/* eslint-disable no-invalid-this */
import _ from 'lodash';
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
import { RemoteUser } from '@verdaccio/types';
import { logger } from '@verdaccio/logger';
import { createRemoteUser } from '@verdaccio/config';
import { getApiToken } from '@verdaccio/auth';
import buildDebug from 'debug';
import { FastifyInstance, FastifyRequest } from 'fastify';
import _ from 'lodash';
import { getApiToken } from '@verdaccio/auth';
import { createRemoteUser } from '@verdaccio/config';
import { logger } from '@verdaccio/logger';
import { RemoteUser } from '@verdaccio/types';
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
const debug = buildDebug('verdaccio:api:user');

View file

@ -1,5 +1,5 @@
import { FastifyInstance } from 'fastify';
import buildDebug from 'debug';
import { FastifyInstance } from 'fastify';
const debug = buildDebug('verdaccio:api:whoami');

View file

@ -1,7 +1,8 @@
import fp from 'fastify-plugin';
import { Config as IConfig } from '@verdaccio/types';
import { Auth, IAuth } from '@verdaccio/auth';
import { FastifyInstance } from 'fastify';
import fp from 'fastify-plugin';
import { Auth, IAuth } from '@verdaccio/auth';
import { Config as IConfig } from '@verdaccio/types';
export default fp(
async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) {

View file

@ -1,8 +1,8 @@
import { FastifyInstance } from 'fastify';
import fp from 'fastify-plugin';
import { Config as IConfig, ConfigRuntime } from '@verdaccio/types';
import { Config as AppConfig } from '@verdaccio/config';
import { FastifyInstance } from 'fastify';
import { ConfigRuntime, Config as IConfig } from '@verdaccio/types';
export default fp(
async function (fastify: FastifyInstance, opts: { config: ConfigRuntime }) {

View file

@ -1,6 +1,6 @@
import fp from 'fastify-plugin';
import { errorUtils, validatioUtils, API_ERROR, API_MESSAGE, HTTP_STATUS } from '@verdaccio/core';
import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils, validatioUtils } from '@verdaccio/core';
export default fp(
async function (fastify) {

View file

@ -1,7 +1,8 @@
import fp from 'fastify-plugin';
import { Config as IConfig } from '@verdaccio/types';
import { Storage } from '@verdaccio/store';
import { FastifyInstance } from 'fastify';
import fp from 'fastify-plugin';
import { Storage } from '@verdaccio/store';
import { Config as IConfig } from '@verdaccio/types';
export default fp(
async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) {

View file

@ -1,18 +1,18 @@
import { Config as IConfig, RemoteUser } from '@verdaccio/types';
import { Config as AppConfig, createAnonymousRemoteUser } from '@verdaccio/config';
import fastify from 'fastify';
import buildDebug from 'debug';
import fastify from 'fastify';
import { Config as AppConfig, createAnonymousRemoteUser } from '@verdaccio/config';
import { Config as IConfig, RemoteUser } from '@verdaccio/types';
import search from './endpoints/search';
import storagePlugin from './plugins/storage';
import authPlugin from './plugins/auth';
import coreUtils from './plugins/coreUtils';
import configPlugin from './plugins/config';
import ping from './endpoints/ping';
import search from './endpoints/search';
import tarball from './endpoints/tarball';
import user from './endpoints/user';
import whoami from './endpoints/whoami';
import tarball from './endpoints/tarball';
import authPlugin from './plugins/auth';
import configPlugin from './plugins/config';
import coreUtils from './plugins/coreUtils';
import storagePlugin from './plugins/storage';
const debug = buildDebug('verdaccio:fastify');

View file

@ -1,6 +1,7 @@
import _ from 'lodash';
import { Package } from '@verdaccio/types';
import { RequestOptions } from '@verdaccio/url';
import _ from 'lodash';
import { getLocalRegistryTarballUri } from './getLocalRegistryTarballUri';

View file

@ -1,7 +1,7 @@
import URL from 'url';
import { RequestOptions } from '@verdaccio/url';
import buildDebug from 'debug';
import URL from 'url';
import { RequestOptions } from '@verdaccio/url';
import { getPublicUrl } from '@verdaccio/url';
const debug = buildDebug('verdaccio:core:url');

View file

@ -1,5 +1,7 @@
import * as httpMocks from 'node-mocks-http';
import { HEADERS } from '@verdaccio/core';
import { convertDistRemoteToLocalTarballUrls } from '../src';
describe('convertDistRemoteToLocalTarballUrls', () => {

View file

@ -1,6 +1,6 @@
/// <reference types="node" />
import { PassThrough } from 'stream';
declare module '@verdaccio/types' {
type StringValue = string | void | null;

View file

@ -1,6 +1,7 @@
import { URL } from 'url';
import buildDebug from 'debug';
import { URL } from 'url';
import isURLValidator from 'validator/lib/isURL';
import { HEADERS } from '@verdaccio/core';
const debug = buildDebug('verdaccio:core:url');

View file

@ -1,6 +1,7 @@
import * as httpMocks from 'node-mocks-http';
import { HEADERS } from '@verdaccio/core';
import { getPublicUrl } from '../src';
describe('host', () => {

View file

@ -1,7 +1,7 @@
import buildDebug from 'debug';
import { logger } from '@verdaccio/logger';
import { HTTP_STATUS } from '@verdaccio/core';
import { logger } from '@verdaccio/logger';
const debug = buildDebug('verdaccio:hooks:request');
const fetch = require('undici-fetch');

View file

@ -1,11 +1,11 @@
/* eslint-disable no-undef */
import buildDebug from 'debug';
import Handlebars from 'handlebars';
import buildDebug from 'debug';
import { Config, Package, RemoteUser, Notification } from '@verdaccio/types';
import { logger } from '@verdaccio/logger';
import { notifyRequest, FetchOptions } from './notify-request';
import { Config, Notification, Package, RemoteUser } from '@verdaccio/types';
import { FetchOptions, notifyRequest } from './notify-request';
const debug = buildDebug('verdaccio:hooks');

View file

@ -1,6 +1,7 @@
import { createRemoteUser, parseConfigFile } from '@verdaccio/config';
import { setup } from '@verdaccio/logger';
import { Config } from '@verdaccio/types';
import { parseConfigFile, createRemoteUser } from '@verdaccio/config';
import { notify } from '../src/notify';
import { parseConfigurationFile } from './__helper';

View file

@ -1,6 +1,6 @@
import Path from 'path';
import _ from 'lodash';
import buildDebug from 'debug';
import _ from 'lodash';
import Path from 'path';
import { logger } from '@verdaccio/logger';
import { Config, IPlugin } from '@verdaccio/types';

View file

@ -1,4 +1,5 @@
import path from 'path';
import { setup } from '@verdaccio/logger';
import { loadPlugin } from '../src/plugin-loader';

View file

@ -1,9 +1,9 @@
import { green, red, white } from 'kleur';
import { inspect } from 'util';
import { white, red, green } from 'kleur';
import { calculateLevel, LevelCode, levelsColors, subSystemLevels } from './levels';
import { formatLoggingDate, isObject, padLeft, padRight } from './utils';
import { LevelCode, calculateLevel, levelsColors, subSystemLevels } from './levels';
import { PrettyOptionsExtended } from './types';
import { formatLoggingDate, isObject, padLeft, padRight } from './utils';
let LEVEL_VALUE_MAX = 0;
for (const l in levelsColors) {

View file

@ -1,4 +1,4 @@
import { yellow, green, red, magenta, black, blue, cyan, white } from 'kleur';
import { black, blue, cyan, green, magenta, red, white, yellow } from 'kleur';
export type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';

View file

@ -1,5 +1,5 @@
import _ from 'lodash';
import dayjs from 'dayjs';
import _ from 'lodash';
export const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';
export const CUSTOM_PAD_LENGTH = 1;

View file

@ -1,6 +1,7 @@
import pino from 'pino';
import _ from 'lodash';
import buildDebug from 'debug';
import _ from 'lodash';
import pino from 'pino';
import { warningUtils } from '@verdaccio/core';
const debug = buildDebug('verdaccio:logger');

View file

@ -1,4 +1,5 @@
import { warningUtils } from '@verdaccio/core';
import { logger, setup } from '../src';
const mockWarningUtils = jest.fn();

View file

@ -1,29 +1,28 @@
import _ from 'lodash';
import buildDebug from 'debug';
import {
validateName as utilValidateName,
validatePackage as utilValidatePackage,
isObject,
stringToMD5,
} from '@verdaccio/utils';
import { NextFunction, Request, Response } from 'express';
import { HttpError } from 'http-errors';
import _ from 'lodash';
import { Config, Package, RemoteUser, Logger } from '@verdaccio/types';
import { logger } from '@verdaccio/logger';
import { IAuth } from '@verdaccio/auth';
import {
errorUtils,
API_ERROR,
HEADER_TYPE,
HEADERS,
HEADER_TYPE,
HTTP_STATUS,
TOKEN_BASIC,
TOKEN_BEARER,
VerdaccioError,
errorUtils,
} from '@verdaccio/core';
import { HttpError } from 'http-errors';
import { logger } from '@verdaccio/logger';
import { Config, Logger, Package, RemoteUser } from '@verdaccio/types';
import {
isObject,
stringToMD5,
validateName as utilValidateName,
validatePackage as utilValidatePackage,
} from '@verdaccio/utils';
import { getVersionFromTarball } from './middleware-utils';
export type $RequestExtend = Request & { remote_user?: RemoteUser; log: Logger };

View file

@ -1,6 +1,6 @@
// <reference types="node" />
import * as http from 'http';
import { Logger, RemoteUser } from '@verdaccio/types';
declare global {

View file

@ -1,17 +1,18 @@
/* eslint-disable */
import _, { assign, isFunction } from 'lodash';
import http from 'http';
import https from 'https';
import constants from 'constants';
import buildDebug from 'debug';
import fs from 'fs';
import http from 'http';
import https from 'https';
import _, { assign, isFunction } from 'lodash';
import url from 'url';
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
import { API_ERROR } from '@verdaccio/core';
import { ConfigRuntime, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types';
import { setup, logger } from '@verdaccio/logger';
import { logger, setup } from '@verdaccio/logger';
import server from '@verdaccio/server';
import { ConfigRuntime, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types';
import { getListListenAddresses } from './cli-utils';
import { displayExperimentsInfoBox } from './experiments';

View file

@ -1,4 +1,5 @@
import _ from 'lodash';
import {
DEFAULT_DOMAIN,
DEFAULT_PORT,

View file

@ -1,4 +1,5 @@
import _ from 'lodash';
import { DEFAULT_DOMAIN, DEFAULT_PORT, parseAddress } from '../src/cli-utils';
describe('Parse listen address', () => {

View file

@ -1,5 +1,7 @@
import request from 'supertest';
import { runServer } from '../src';
describe('startServer via API', () => {
test('should provide all HTTP server data', async () => {
const webServer = await runServer();

View file

@ -1,6 +1,7 @@
import ActiveDirectory from 'activedirectory2';
import { errorUtils } from '@verdaccio/core';
import { Callback, IPluginAuth, Logger } from '@verdaccio/types';
import ActiveDirectory from 'activedirectory2';
export const NotAuthMessage = 'AD - Active Directory authentication failed';

View file

@ -1,8 +1,8 @@
import ActiveDirectory from 'activedirectory2';
import { HTTP_STATUS } from '@verdaccio/core';
import ActiveDirectoryPlugin, { NotAuthMessage } from '../src/active-directory';
// eslint-disable-next-line jest/no-mocks-import
import logger from './__mocks__/Logger';

View file

@ -1,11 +1,11 @@
import https from 'https';
import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent';
import express, { Request, Response } from 'express';
import { Logger, IPluginMiddleware, IBasicAuth, PluginOptions } from '@verdaccio/types';
import { json as jsonParser } from 'body-parser';
import express, { Request, Response } from 'express';
import https from 'https';
import createHttpsProxyAgent from 'https-proxy-agent';
import fetch from 'node-fetch';
import { IBasicAuth, IPluginMiddleware, Logger, PluginOptions } from '@verdaccio/types';
import { ConfigAudit } from './types';
// FUTURE: we should be able to overwrite this

View file

@ -1,15 +1,16 @@
import buildDebug from 'debug';
import {
PluginOptions,
Callback,
PackageAccess,
IPluginAuth,
RemoteUser,
Logger,
} from '@verdaccio/types';
import { errorUtils, API_ERROR } from '@verdaccio/core';
import { VerdaccioMemoryConfig, Users, UserMemory } from './types';
import { API_ERROR, errorUtils } from '@verdaccio/core';
import {
Callback,
IPluginAuth,
Logger,
PackageAccess,
PluginOptions,
RemoteUser,
} from '@verdaccio/types';
import { UserMemory, Users, VerdaccioMemoryConfig } from './types';
const debug = buildDebug('verdaccio:plugin:auth:memory:user');

View file

@ -1,7 +1,7 @@
import { Callback } from '@verdaccio/types';
import { VerdaccioMemoryConfig } from '../src/types';
import Memory from '../src/index';
import { VerdaccioMemoryConfig } from '../src/types';
describe('Memory', function () {
let auth;

View file

@ -1,19 +1,20 @@
import { S3 } from 'aws-sdk';
import { VerdaccioError, errorUtils } from '@verdaccio/core';
import {
LocalStorage,
Logger,
Config,
IPluginStorage,
LocalStorage,
Logger,
PluginOptions,
Token,
TokenFilter,
} from '@verdaccio/types';
import { errorUtils, VerdaccioError } from '@verdaccio/core';
import { S3 } from 'aws-sdk';
import { S3Config } from './config';
import S3PackageManager from './s3PackageManager';
import { convertS3Error, is404Error } from './s3Errors';
import addTrailingSlash from './addTrailingSlash';
import { S3Config } from './config';
import { convertS3Error, is404Error } from './s3Errors';
import S3PackageManager from './s3PackageManager';
import setConfigValue from './setConfigValue';
export default class S3Database implements IPluginStorage<S3Config> {

View file

@ -1,5 +1,6 @@
import { AWSError } from 'aws-sdk';
import { errorUtils, API_ERROR, HTTP_STATUS, VerdaccioError } from '@verdaccio/core';
import { API_ERROR, HTTP_STATUS, VerdaccioError, errorUtils } from '@verdaccio/core';
export function is404Error(err: VerdaccioError): boolean {
return err.code === HTTP_STATUS.NOT_FOUND;

View file

@ -1,13 +1,14 @@
import { S3, AWSError } from 'aws-sdk';
import { UploadTarball, ReadTarball } from '@verdaccio/streams';
import { HEADERS, HTTP_STATUS, VerdaccioError } from '@verdaccio/core';
import { Callback, Logger, Package, ILocalPackageManager, CallbackAction } from '@verdaccio/types';
import { AWSError, S3 } from 'aws-sdk';
import { HttpError } from 'http-errors';
import { is404Error, convertS3Error, create409Error } from './s3Errors';
import { deleteKeyPrefix } from './deleteKeyPrefix';
import { S3Config } from './config';
import { HEADERS, HTTP_STATUS, VerdaccioError } from '@verdaccio/core';
import { ReadTarball, UploadTarball } from '@verdaccio/streams';
import { Callback, CallbackAction, ILocalPackageManager, Logger, Package } from '@verdaccio/types';
import addTrailingSlash from './addTrailingSlash';
import { S3Config } from './config';
import { deleteKeyPrefix } from './deleteKeyPrefix';
import { convertS3Error, create409Error, is404Error } from './s3Errors';
const pkgFileName = 'package.json';

Some files were not shown because too many files have changed in this diff Show more