@verdaccio/core 9.0.0-next-9.3 → 9.0.0-next-9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_virtual/_rolldown/runtime.js +33 -0
- package/build/_virtual/_rolldown/runtime.mjs +13 -0
- package/build/auth-utils.d.ts +1 -1
- package/build/auth-utils.js +23 -25
- package/build/auth-utils.js.map +1 -1
- package/build/auth-utils.mjs +32 -0
- package/build/auth-utils.mjs.map +1 -0
- package/build/constants.js +179 -155
- package/build/constants.js.map +1 -1
- package/build/constants.mjs +163 -0
- package/build/constants.mjs.map +1 -0
- package/build/crypto-utils.d.ts +1 -1
- package/build/crypto-utils.js +33 -29
- package/build/crypto-utils.js.map +1 -1
- package/build/crypto-utils.mjs +40 -0
- package/build/crypto-utils.mjs.map +1 -0
- package/build/error-utils.d.ts +1 -1
- package/build/error-utils.js +92 -80
- package/build/error-utils.js.map +1 -1
- package/build/error-utils.mjs +107 -0
- package/build/error-utils.mjs.map +1 -0
- package/build/file-utils.js +35 -31
- package/build/file-utils.js.map +1 -1
- package/build/file-utils.mjs +35 -0
- package/build/file-utils.mjs.map +1 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +118 -183
- package/build/index.mjs +14 -0
- package/build/pkg-utils.d.ts +1 -1
- package/build/pkg-utils.js +60 -76
- package/build/pkg-utils.js.map +1 -1
- package/build/pkg-utils.mjs +69 -0
- package/build/pkg-utils.mjs.map +1 -0
- package/build/plugin-utils.d.ts +4 -4
- package/build/plugin-utils.js +27 -78
- package/build/plugin-utils.js.map +1 -1
- package/build/plugin-utils.mjs +26 -0
- package/build/plugin-utils.mjs.map +1 -0
- package/build/schemes/publish-manifest.js +33 -43
- package/build/schemes/publish-manifest.js.map +1 -1
- package/build/schemes/publish-manifest.mjs +36 -0
- package/build/schemes/publish-manifest.mjs.map +1 -0
- package/build/schemes/unpublish-manifest.js +51 -72
- package/build/schemes/unpublish-manifest.js.map +1 -1
- package/build/schemes/unpublish-manifest.mjs +54 -0
- package/build/schemes/unpublish-manifest.mjs.map +1 -0
- package/build/search-utils.js +9 -9
- package/build/search-utils.js.map +1 -1
- package/build/search-utils.mjs +8 -0
- package/build/search-utils.mjs.map +1 -0
- package/build/stream-utils.d.ts +1 -2
- package/build/stream-utils.js +29 -28
- package/build/stream-utils.js.map +1 -1
- package/build/stream-utils.mjs +30 -0
- package/build/stream-utils.mjs.map +1 -0
- package/build/string-utils.js +31 -34
- package/build/string-utils.js.map +1 -1
- package/build/string-utils.mjs +31 -0
- package/build/string-utils.mjs.map +1 -0
- package/build/tarball-utils.js +40 -39
- package/build/tarball-utils.js.map +1 -1
- package/build/tarball-utils.mjs +46 -0
- package/build/tarball-utils.mjs.map +1 -0
- package/build/validation-utils.d.ts +1 -1
- package/build/validation-utils.js +78 -112
- package/build/validation-utils.js.map +1 -1
- package/build/validation-utils.mjs +91 -0
- package/build/validation-utils.mjs.map +1 -0
- package/build/warning-utils.js +52 -52
- package/build/warning-utils.js.map +1 -1
- package/build/warning-utils.mjs +62 -0
- package/build/warning-utils.mjs.map +1 -0
- package/package.json +17 -6
- package/build/index.js.map +0 -1
- package/build/path-utils.js +0 -2
- package/build/path-utils.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { URL } from "node:url";
|
|
3
|
+
//#region src/tarball-utils.ts
|
|
4
|
+
var tarball_utils_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
composeTarballFromPackage: () => composeTarballFromPackage,
|
|
6
|
+
extractTarballFromUrl: () => extractTarballFromUrl,
|
|
7
|
+
getVersionFromTarball: () => getVersionFromTarball
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Return package version from tarball name
|
|
11
|
+
*
|
|
12
|
+
* test-1.2.4.tgz -> 1.2.4
|
|
13
|
+
* @param {String} fileName
|
|
14
|
+
* @returns {String}
|
|
15
|
+
*/
|
|
16
|
+
function getVersionFromTarball(fileName) {
|
|
17
|
+
const groups = fileName.replace(/\.tgz$/, "").match(/^[^/]+-(\d+\.\d+\.\d+.*)/);
|
|
18
|
+
return groups !== null ? groups[1] : void 0;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Extract the tarball name from a registry dist url
|
|
22
|
+
*
|
|
23
|
+
* https://registry.npmjs.org/test/-/test-0.0.2.tgz -> test-0.0.2.tgz
|
|
24
|
+
* @param tarball tarball url
|
|
25
|
+
* @returns tarball filename
|
|
26
|
+
*/
|
|
27
|
+
function extractTarballFromUrl(url) {
|
|
28
|
+
return new URL(url).pathname.replace(/^.*\//, "");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build the tarball filename from paackage name and version
|
|
32
|
+
*
|
|
33
|
+
* test, 1.2.4 -> test-1.2.4.tgz
|
|
34
|
+
* @scope/name, 1.2.4 -> name-1.2.4.tgz
|
|
35
|
+
* @param name package name
|
|
36
|
+
* @param version package version
|
|
37
|
+
* @returns tarball filename
|
|
38
|
+
*/
|
|
39
|
+
function composeTarballFromPackage(name, version) {
|
|
40
|
+
if (name.includes("/")) return `${name.split("/")[1]}-${version}.tgz`;
|
|
41
|
+
else return `${name}-${version}.tgz`;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { tarball_utils_exports };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=tarball-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tarball-utils.mjs","names":[],"sources":["../src/tarball-utils.ts"],"sourcesContent":["import { URL } from 'node:url';\n\n/**\n * Return package version from tarball name\n *\n * test-1.2.4.tgz -> 1.2.4\n * @param {String} fileName\n * @returns {String}\n */\nexport function getVersionFromTarball(fileName: string): string | void {\n const groups = fileName.replace(/\\.tgz$/, '').match(/^[^/]+-(\\d+\\.\\d+\\.\\d+.*)/);\n\n return groups !== null ? groups[1] : undefined;\n}\n\n/**\n * Extract the tarball name from a registry dist url\n *\n * https://registry.npmjs.org/test/-/test-0.0.2.tgz -> test-0.0.2.tgz\n * @param tarball tarball url\n * @returns tarball filename\n */\nexport function extractTarballFromUrl(url: string): string {\n const urlObject = new URL(url);\n return urlObject.pathname.replace(/^.*\\//, '');\n}\n\n/**\n * Build the tarball filename from paackage name and version\n *\n * test, 1.2.4 -> test-1.2.4.tgz\n * @scope/name, 1.2.4 -> name-1.2.4.tgz\n * @param name package name\n * @param version package version\n * @returns tarball filename\n */\nexport function composeTarballFromPackage(name: string, version: string): string {\n if (name.includes('/')) {\n return `${name.split('/')[1]}-${version}.tgz`;\n } else {\n return `${name}-${version}.tgz`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AASA,SAAgB,sBAAsB,UAAiC;CACrE,MAAM,SAAS,SAAS,QAAQ,UAAU,GAAG,CAAC,MAAM,2BAA2B;AAE/E,QAAO,WAAW,OAAO,OAAO,KAAK,KAAA;;;;;;;;;AAUvC,SAAgB,sBAAsB,KAAqB;AAEzD,QADkB,IAAI,IAAI,IAAI,CACb,SAAS,QAAQ,SAAS,GAAG;;;;;;;;;;;AAYhD,SAAgB,0BAA0B,MAAc,SAAyB;AAC/E,KAAI,KAAK,SAAS,IAAI,CACpB,QAAO,GAAG,KAAK,MAAM,IAAI,CAAC,GAAG,GAAG,QAAQ;KAExC,QAAO,GAAG,KAAK,GAAG,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Manifest } from '@verdaccio/types';
|
|
2
2
|
export { validatePublishSingleVersion } from './schemes/publish-manifest';
|
|
3
3
|
export { validateUnPublishSingleVersion } from './schemes/unpublish-manifest';
|
|
4
4
|
export declare function isPackageNameScoped(name: string): boolean;
|
|
@@ -1,131 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(exports, "validateUnPublishSingleVersion", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _unpublishManifest.validateUnPublishSingleVersion;
|
|
22
|
-
}
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_constants = require("./constants.js");
|
|
3
|
+
const require_publish_manifest = require("./schemes/publish-manifest.js");
|
|
4
|
+
const require_unpublish_manifest = require("./schemes/unpublish-manifest.js");
|
|
5
|
+
let node_assert = require("node:assert");
|
|
6
|
+
node_assert = require_runtime.__toESM(node_assert);
|
|
7
|
+
//#region src/validation-utils.ts
|
|
8
|
+
var validation_utils_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
9
|
+
isObject: () => isObject,
|
|
10
|
+
isPackageNameScoped: () => isPackageNameScoped,
|
|
11
|
+
normalizeMetadata: () => normalizeMetadata,
|
|
12
|
+
validateName: () => validateName,
|
|
13
|
+
validatePackage: () => validatePackage,
|
|
14
|
+
validatePassword: () => validatePassword,
|
|
15
|
+
validatePublishSingleVersion: () => require_publish_manifest.validatePublishSingleVersion,
|
|
16
|
+
validateUnPublishSingleVersion: () => require_unpublish_manifest.validateUnPublishSingleVersion,
|
|
17
|
+
validateUserName: () => validateUserName
|
|
23
18
|
});
|
|
24
|
-
exports.validateUserName = validateUserName;
|
|
25
|
-
var _nodeAssert = _interopRequireDefault(require("node:assert"));
|
|
26
|
-
var _constants = require("./constants");
|
|
27
|
-
var _publishManifest = require("./schemes/publish-manifest");
|
|
28
|
-
var _unpublishManifest = require("./schemes/unpublish-manifest");
|
|
29
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
19
|
function isPackageNameScoped(name) {
|
|
31
|
-
|
|
20
|
+
return name.startsWith("@");
|
|
32
21
|
}
|
|
33
|
-
|
|
34
22
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
* From normalize-package-data/lib/fixer.js
|
|
24
|
+
* @param {*} name the package name
|
|
25
|
+
* @return {Boolean} whether is valid or not
|
|
26
|
+
*/
|
|
39
27
|
function validateName(name) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return !(!normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) || normalizedName.startsWith('.') ||
|
|
62
|
-
// ".bin", etc.
|
|
63
|
-
['node_modules', '__proto__', 'favicon.ico'].includes(normalizedName));
|
|
28
|
+
if (typeof name !== "string") return false;
|
|
29
|
+
let normalizedName = name.toLowerCase();
|
|
30
|
+
const isScoped = isPackageNameScoped(name);
|
|
31
|
+
const scopedName = name.split("/", 2)[1];
|
|
32
|
+
if (isScoped && typeof scopedName !== "undefined") normalizedName = scopedName.toLowerCase();
|
|
33
|
+
/**
|
|
34
|
+
* Some context about the first regex
|
|
35
|
+
* - npm used to have a different tarball naming system.
|
|
36
|
+
* eg: http://registry.npmjs.com/thirty-two
|
|
37
|
+
* https://registry.npmjs.org/thirty-two/-/thirty-two@0.0.1.tgz
|
|
38
|
+
* The file name thirty-two@0.0.1.tgz, the version and the pkg name was separated by an at (@)
|
|
39
|
+
* while nowadays the naming system is based in dashes
|
|
40
|
+
* https://registry.npmjs.org/verdaccio/-/verdaccio-1.4.0.tgz
|
|
41
|
+
*
|
|
42
|
+
* more info here: https://github.com/rlidwka/sinopia/issues/75
|
|
43
|
+
*/
|
|
44
|
+
return !(!normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) || normalizedName.startsWith(".") || [
|
|
45
|
+
"node_modules",
|
|
46
|
+
"__proto__",
|
|
47
|
+
"favicon.ico"
|
|
48
|
+
].includes(normalizedName));
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
51
|
+
* Validate a package.
|
|
52
|
+
* @return {Boolean} whether the package is valid or not
|
|
53
|
+
*/
|
|
70
54
|
function validatePackage(name) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return validateName(nameList[0]);
|
|
75
|
-
}
|
|
76
|
-
// scoped package
|
|
77
|
-
return nameList[0][0] === '@' && validateName(nameList[0].slice(1)) && validateName(nameList[1]);
|
|
55
|
+
const nameList = name.split("/", 2);
|
|
56
|
+
if (nameList.length === 1) return validateName(nameList[0]);
|
|
57
|
+
return nameList[0][0] === "@" && validateName(nameList[0].slice(1)) && validateName(nameList[1]);
|
|
78
58
|
}
|
|
79
|
-
|
|
80
59
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
60
|
+
* Validate the package metadata, add additional properties whether are missing within
|
|
61
|
+
* the metadata properties.
|
|
62
|
+
* @param {*} manifest
|
|
63
|
+
* @param {*} name
|
|
64
|
+
* @return {Object} the object with additional properties as dist-tags ad versions
|
|
65
|
+
*/
|
|
87
66
|
function normalizeMetadata(manifest, name) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!Array.isArray(manifest[_constants.MAINTAINERS])) {
|
|
96
|
-
_manifest[_constants.MAINTAINERS] = [];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// This may not be needed
|
|
100
|
-
if (!isObject(manifest['versions'])) {
|
|
101
|
-
_manifest['versions'] = {};
|
|
102
|
-
}
|
|
103
|
-
if (!isObject(manifest['time'])) {
|
|
104
|
-
_manifest['time'] = {};
|
|
105
|
-
}
|
|
106
|
-
return _manifest;
|
|
67
|
+
node_assert.default.strictEqual(manifest.name, name);
|
|
68
|
+
const _manifest = { ...manifest };
|
|
69
|
+
if (!isObject(manifest["dist-tags"])) _manifest[require_constants.DIST_TAGS] = {};
|
|
70
|
+
if (!Array.isArray(manifest["maintainers"])) _manifest[require_constants.MAINTAINERS] = [];
|
|
71
|
+
if (!isObject(manifest["versions"])) _manifest["versions"] = {};
|
|
72
|
+
if (!isObject(manifest["time"])) _manifest["time"] = {};
|
|
73
|
+
return _manifest;
|
|
107
74
|
}
|
|
108
|
-
|
|
109
75
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
76
|
+
* Check whether an element is an Object
|
|
77
|
+
* @param {*} obj the element
|
|
78
|
+
* @return {Boolean}
|
|
79
|
+
*/
|
|
114
80
|
function isObject(obj) {
|
|
115
|
-
|
|
116
|
-
// return false;
|
|
117
|
-
// }
|
|
118
|
-
|
|
119
|
-
// return (
|
|
120
|
-
// (typeof obj === 'object' || typeof obj.prototype === 'undefined') &&
|
|
121
|
-
// Array.isArray(obj) === false
|
|
122
|
-
// );
|
|
123
|
-
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
81
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
124
82
|
}
|
|
125
|
-
function validatePassword(password, validation =
|
|
126
|
-
|
|
83
|
+
function validatePassword(password, validation = require_constants.DEFAULT_PASSWORD_VALIDATION) {
|
|
84
|
+
return typeof password === "string" && validation instanceof RegExp ? password.match(validation) !== null : false;
|
|
127
85
|
}
|
|
128
86
|
function validateUserName(userName, expectedName) {
|
|
129
|
-
|
|
87
|
+
return typeof userName === "string" && userName.split(":")[0] === "org.couchdb.user" && userName.split(":")[1] === expectedName;
|
|
130
88
|
}
|
|
89
|
+
//#endregion
|
|
90
|
+
Object.defineProperty(exports, "validation_utils_exports", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function() {
|
|
93
|
+
return validation_utils_exports;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
131
97
|
//# sourceMappingURL=validation-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-utils.js","names":[
|
|
1
|
+
{"version":3,"file":"validation-utils.js","names":[],"sources":["../src/validation-utils.ts"],"sourcesContent":["import assert from 'node:assert';\n\nimport type { Manifest } from '@verdaccio/types';\n\nimport { DEFAULT_PASSWORD_VALIDATION, DIST_TAGS, MAINTAINERS } from './constants';\n\nexport { validatePublishSingleVersion } from './schemes/publish-manifest';\nexport { validateUnPublishSingleVersion } from './schemes/unpublish-manifest';\n\nexport function isPackageNameScoped(name: string): boolean {\n return name.startsWith('@');\n}\n\n/**\n * From normalize-package-data/lib/fixer.js\n * @param {*} name the package name\n * @return {Boolean} whether is valid or not\n */\nexport function validateName(name: string): boolean {\n if (typeof name !== 'string') {\n return false;\n }\n\n let normalizedName: string = name.toLowerCase();\n\n const isScoped: boolean = isPackageNameScoped(name);\n const scopedName = name.split('/', 2)[1];\n\n if (isScoped && typeof scopedName !== 'undefined') {\n normalizedName = scopedName.toLowerCase();\n }\n\n /**\n * Some context about the first regex\n * - npm used to have a different tarball naming system.\n * eg: http://registry.npmjs.com/thirty-two\n * https://registry.npmjs.org/thirty-two/-/thirty-two@0.0.1.tgz\n * The file name thirty-two@0.0.1.tgz, the version and the pkg name was separated by an at (@)\n * while nowadays the naming system is based in dashes\n * https://registry.npmjs.org/verdaccio/-/verdaccio-1.4.0.tgz\n *\n * more info here: https://github.com/rlidwka/sinopia/issues/75\n */\n return !(\n !normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) ||\n normalizedName.startsWith('.') || // \".bin\", etc.\n ['node_modules', '__proto__', 'favicon.ico'].includes(normalizedName)\n );\n}\n\n/**\n * Validate a package.\n * @return {Boolean} whether the package is valid or not\n */\nexport function validatePackage(name: string): boolean {\n const nameList = name.split('/', 2);\n if (nameList.length === 1) {\n // normal package\n return validateName(nameList[0]);\n }\n // scoped package\n return nameList[0][0] === '@' && validateName(nameList[0].slice(1)) && validateName(nameList[1]);\n}\n\n/**\n * Validate the package metadata, add additional properties whether are missing within\n * the metadata properties.\n * @param {*} manifest\n * @param {*} name\n * @return {Object} the object with additional properties as dist-tags ad versions\n */\nexport function normalizeMetadata(manifest: Manifest, name: string): Manifest {\n assert.strictEqual(manifest.name, name);\n const _manifest = { ...manifest };\n\n if (!isObject(manifest[DIST_TAGS])) {\n _manifest[DIST_TAGS] = {};\n }\n\n if (!Array.isArray(manifest[MAINTAINERS])) {\n _manifest[MAINTAINERS] = [];\n }\n\n // This may not be needed\n if (!isObject(manifest['versions'])) {\n _manifest['versions'] = {};\n }\n\n if (!isObject(manifest['time'])) {\n _manifest['time'] = {};\n }\n\n return _manifest;\n}\n\n/**\n * Check whether an element is an Object\n * @param {*} obj the element\n * @return {Boolean}\n */\nexport function isObject(obj: any): boolean {\n // if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {\n // return false;\n // }\n\n // return (\n // (typeof obj === 'object' || typeof obj.prototype === 'undefined') &&\n // Array.isArray(obj) === false\n // );\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\nexport function validatePassword(\n password: string,\n validation: RegExp = DEFAULT_PASSWORD_VALIDATION\n): boolean {\n return typeof password === 'string' && validation instanceof RegExp\n ? password.match(validation) !== null\n : false;\n}\n\nexport function validateUserName(userName: any, expectedName: string): boolean {\n return (\n typeof userName === 'string' &&\n userName.split(':')[0] === 'org.couchdb.user' &&\n userName.split(':')[1] === expectedName\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AASA,SAAgB,oBAAoB,MAAuB;AACzD,QAAO,KAAK,WAAW,IAAI;;;;;;;AAQ7B,SAAgB,aAAa,MAAuB;AAClD,KAAI,OAAO,SAAS,SAClB,QAAO;CAGT,IAAI,iBAAyB,KAAK,aAAa;CAE/C,MAAM,WAAoB,oBAAoB,KAAK;CACnD,MAAM,aAAa,KAAK,MAAM,KAAK,EAAE,CAAC;AAEtC,KAAI,YAAY,OAAO,eAAe,YACpC,kBAAiB,WAAW,aAAa;;;;;;;;;;;;AAc3C,QAAO,EACL,CAAC,eAAe,MAAM,2BAA2B,IACjD,eAAe,WAAW,IAAI,IAC9B;EAAC;EAAgB;EAAa;EAAc,CAAC,SAAS,eAAe;;;;;;AAQzE,SAAgB,gBAAgB,MAAuB;CACrD,MAAM,WAAW,KAAK,MAAM,KAAK,EAAE;AACnC,KAAI,SAAS,WAAW,EAEtB,QAAO,aAAa,SAAS,GAAG;AAGlC,QAAO,SAAS,GAAG,OAAO,OAAO,aAAa,SAAS,GAAG,MAAM,EAAE,CAAC,IAAI,aAAa,SAAS,GAAG;;;;;;;;;AAUlG,SAAgB,kBAAkB,UAAoB,MAAwB;AAC5E,aAAA,QAAO,YAAY,SAAS,MAAM,KAAK;CACvC,MAAM,YAAY,EAAE,GAAG,UAAU;AAEjC,KAAI,CAAC,SAAS,SAAA,aAAoB,CAChC,WAAU,kBAAA,aAAa,EAAE;AAG3B,KAAI,CAAC,MAAM,QAAQ,SAAA,eAAsB,CACvC,WAAU,kBAAA,eAAe,EAAE;AAI7B,KAAI,CAAC,SAAS,SAAS,YAAY,CACjC,WAAU,cAAc,EAAE;AAG5B,KAAI,CAAC,SAAS,SAAS,QAAQ,CAC7B,WAAU,UAAU,EAAE;AAGxB,QAAO;;;;;;;AAQT,SAAgB,SAAS,KAAmB;AAS1C,QAAO,OAAO,UAAU,SAAS,KAAK,IAAI,KAAK;;AAGjD,SAAgB,iBACd,UACA,aAAqB,kBAAA,6BACZ;AACT,QAAO,OAAO,aAAa,YAAY,sBAAsB,SACzD,SAAS,MAAM,WAAW,KAAK,OAC/B;;AAGN,SAAgB,iBAAiB,UAAe,cAA+B;AAC7E,QACE,OAAO,aAAa,YACpB,SAAS,MAAM,IAAI,CAAC,OAAO,sBAC3B,SAAS,MAAM,IAAI,CAAC,OAAO"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { DEFAULT_PASSWORD_VALIDATION, DIST_TAGS, MAINTAINERS } from "./constants.mjs";
|
|
3
|
+
import { validatePublishSingleVersion } from "./schemes/publish-manifest.mjs";
|
|
4
|
+
import { validateUnPublishSingleVersion } from "./schemes/unpublish-manifest.mjs";
|
|
5
|
+
import assert from "node:assert";
|
|
6
|
+
//#region src/validation-utils.ts
|
|
7
|
+
var validation_utils_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
isObject: () => isObject,
|
|
9
|
+
isPackageNameScoped: () => isPackageNameScoped,
|
|
10
|
+
normalizeMetadata: () => normalizeMetadata,
|
|
11
|
+
validateName: () => validateName,
|
|
12
|
+
validatePackage: () => validatePackage,
|
|
13
|
+
validatePassword: () => validatePassword,
|
|
14
|
+
validatePublishSingleVersion: () => validatePublishSingleVersion,
|
|
15
|
+
validateUnPublishSingleVersion: () => validateUnPublishSingleVersion,
|
|
16
|
+
validateUserName: () => validateUserName
|
|
17
|
+
});
|
|
18
|
+
function isPackageNameScoped(name) {
|
|
19
|
+
return name.startsWith("@");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* From normalize-package-data/lib/fixer.js
|
|
23
|
+
* @param {*} name the package name
|
|
24
|
+
* @return {Boolean} whether is valid or not
|
|
25
|
+
*/
|
|
26
|
+
function validateName(name) {
|
|
27
|
+
if (typeof name !== "string") return false;
|
|
28
|
+
let normalizedName = name.toLowerCase();
|
|
29
|
+
const isScoped = isPackageNameScoped(name);
|
|
30
|
+
const scopedName = name.split("/", 2)[1];
|
|
31
|
+
if (isScoped && typeof scopedName !== "undefined") normalizedName = scopedName.toLowerCase();
|
|
32
|
+
/**
|
|
33
|
+
* Some context about the first regex
|
|
34
|
+
* - npm used to have a different tarball naming system.
|
|
35
|
+
* eg: http://registry.npmjs.com/thirty-two
|
|
36
|
+
* https://registry.npmjs.org/thirty-two/-/thirty-two@0.0.1.tgz
|
|
37
|
+
* The file name thirty-two@0.0.1.tgz, the version and the pkg name was separated by an at (@)
|
|
38
|
+
* while nowadays the naming system is based in dashes
|
|
39
|
+
* https://registry.npmjs.org/verdaccio/-/verdaccio-1.4.0.tgz
|
|
40
|
+
*
|
|
41
|
+
* more info here: https://github.com/rlidwka/sinopia/issues/75
|
|
42
|
+
*/
|
|
43
|
+
return !(!normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) || normalizedName.startsWith(".") || [
|
|
44
|
+
"node_modules",
|
|
45
|
+
"__proto__",
|
|
46
|
+
"favicon.ico"
|
|
47
|
+
].includes(normalizedName));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate a package.
|
|
51
|
+
* @return {Boolean} whether the package is valid or not
|
|
52
|
+
*/
|
|
53
|
+
function validatePackage(name) {
|
|
54
|
+
const nameList = name.split("/", 2);
|
|
55
|
+
if (nameList.length === 1) return validateName(nameList[0]);
|
|
56
|
+
return nameList[0][0] === "@" && validateName(nameList[0].slice(1)) && validateName(nameList[1]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validate the package metadata, add additional properties whether are missing within
|
|
60
|
+
* the metadata properties.
|
|
61
|
+
* @param {*} manifest
|
|
62
|
+
* @param {*} name
|
|
63
|
+
* @return {Object} the object with additional properties as dist-tags ad versions
|
|
64
|
+
*/
|
|
65
|
+
function normalizeMetadata(manifest, name) {
|
|
66
|
+
assert.strictEqual(manifest.name, name);
|
|
67
|
+
const _manifest = { ...manifest };
|
|
68
|
+
if (!isObject(manifest["dist-tags"])) _manifest[DIST_TAGS] = {};
|
|
69
|
+
if (!Array.isArray(manifest["maintainers"])) _manifest[MAINTAINERS] = [];
|
|
70
|
+
if (!isObject(manifest["versions"])) _manifest["versions"] = {};
|
|
71
|
+
if (!isObject(manifest["time"])) _manifest["time"] = {};
|
|
72
|
+
return _manifest;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check whether an element is an Object
|
|
76
|
+
* @param {*} obj the element
|
|
77
|
+
* @return {Boolean}
|
|
78
|
+
*/
|
|
79
|
+
function isObject(obj) {
|
|
80
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
81
|
+
}
|
|
82
|
+
function validatePassword(password, validation = DEFAULT_PASSWORD_VALIDATION) {
|
|
83
|
+
return typeof password === "string" && validation instanceof RegExp ? password.match(validation) !== null : false;
|
|
84
|
+
}
|
|
85
|
+
function validateUserName(userName, expectedName) {
|
|
86
|
+
return typeof userName === "string" && userName.split(":")[0] === "org.couchdb.user" && userName.split(":")[1] === expectedName;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { validation_utils_exports };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=validation-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-utils.mjs","names":[],"sources":["../src/validation-utils.ts"],"sourcesContent":["import assert from 'node:assert';\n\nimport type { Manifest } from '@verdaccio/types';\n\nimport { DEFAULT_PASSWORD_VALIDATION, DIST_TAGS, MAINTAINERS } from './constants';\n\nexport { validatePublishSingleVersion } from './schemes/publish-manifest';\nexport { validateUnPublishSingleVersion } from './schemes/unpublish-manifest';\n\nexport function isPackageNameScoped(name: string): boolean {\n return name.startsWith('@');\n}\n\n/**\n * From normalize-package-data/lib/fixer.js\n * @param {*} name the package name\n * @return {Boolean} whether is valid or not\n */\nexport function validateName(name: string): boolean {\n if (typeof name !== 'string') {\n return false;\n }\n\n let normalizedName: string = name.toLowerCase();\n\n const isScoped: boolean = isPackageNameScoped(name);\n const scopedName = name.split('/', 2)[1];\n\n if (isScoped && typeof scopedName !== 'undefined') {\n normalizedName = scopedName.toLowerCase();\n }\n\n /**\n * Some context about the first regex\n * - npm used to have a different tarball naming system.\n * eg: http://registry.npmjs.com/thirty-two\n * https://registry.npmjs.org/thirty-two/-/thirty-two@0.0.1.tgz\n * The file name thirty-two@0.0.1.tgz, the version and the pkg name was separated by an at (@)\n * while nowadays the naming system is based in dashes\n * https://registry.npmjs.org/verdaccio/-/verdaccio-1.4.0.tgz\n *\n * more info here: https://github.com/rlidwka/sinopia/issues/75\n */\n return !(\n !normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) ||\n normalizedName.startsWith('.') || // \".bin\", etc.\n ['node_modules', '__proto__', 'favicon.ico'].includes(normalizedName)\n );\n}\n\n/**\n * Validate a package.\n * @return {Boolean} whether the package is valid or not\n */\nexport function validatePackage(name: string): boolean {\n const nameList = name.split('/', 2);\n if (nameList.length === 1) {\n // normal package\n return validateName(nameList[0]);\n }\n // scoped package\n return nameList[0][0] === '@' && validateName(nameList[0].slice(1)) && validateName(nameList[1]);\n}\n\n/**\n * Validate the package metadata, add additional properties whether are missing within\n * the metadata properties.\n * @param {*} manifest\n * @param {*} name\n * @return {Object} the object with additional properties as dist-tags ad versions\n */\nexport function normalizeMetadata(manifest: Manifest, name: string): Manifest {\n assert.strictEqual(manifest.name, name);\n const _manifest = { ...manifest };\n\n if (!isObject(manifest[DIST_TAGS])) {\n _manifest[DIST_TAGS] = {};\n }\n\n if (!Array.isArray(manifest[MAINTAINERS])) {\n _manifest[MAINTAINERS] = [];\n }\n\n // This may not be needed\n if (!isObject(manifest['versions'])) {\n _manifest['versions'] = {};\n }\n\n if (!isObject(manifest['time'])) {\n _manifest['time'] = {};\n }\n\n return _manifest;\n}\n\n/**\n * Check whether an element is an Object\n * @param {*} obj the element\n * @return {Boolean}\n */\nexport function isObject(obj: any): boolean {\n // if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {\n // return false;\n // }\n\n // return (\n // (typeof obj === 'object' || typeof obj.prototype === 'undefined') &&\n // Array.isArray(obj) === false\n // );\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\nexport function validatePassword(\n password: string,\n validation: RegExp = DEFAULT_PASSWORD_VALIDATION\n): boolean {\n return typeof password === 'string' && validation instanceof RegExp\n ? password.match(validation) !== null\n : false;\n}\n\nexport function validateUserName(userName: any, expectedName: string): boolean {\n return (\n typeof userName === 'string' &&\n userName.split(':')[0] === 'org.couchdb.user' &&\n userName.split(':')[1] === expectedName\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AASA,SAAgB,oBAAoB,MAAuB;AACzD,QAAO,KAAK,WAAW,IAAI;;;;;;;AAQ7B,SAAgB,aAAa,MAAuB;AAClD,KAAI,OAAO,SAAS,SAClB,QAAO;CAGT,IAAI,iBAAyB,KAAK,aAAa;CAE/C,MAAM,WAAoB,oBAAoB,KAAK;CACnD,MAAM,aAAa,KAAK,MAAM,KAAK,EAAE,CAAC;AAEtC,KAAI,YAAY,OAAO,eAAe,YACpC,kBAAiB,WAAW,aAAa;;;;;;;;;;;;AAc3C,QAAO,EACL,CAAC,eAAe,MAAM,2BAA2B,IACjD,eAAe,WAAW,IAAI,IAC9B;EAAC;EAAgB;EAAa;EAAc,CAAC,SAAS,eAAe;;;;;;AAQzE,SAAgB,gBAAgB,MAAuB;CACrD,MAAM,WAAW,KAAK,MAAM,KAAK,EAAE;AACnC,KAAI,SAAS,WAAW,EAEtB,QAAO,aAAa,SAAS,GAAG;AAGlC,QAAO,SAAS,GAAG,OAAO,OAAO,aAAa,SAAS,GAAG,MAAM,EAAE,CAAC,IAAI,aAAa,SAAS,GAAG;;;;;;;;;AAUlG,SAAgB,kBAAkB,UAAoB,MAAwB;AAC5E,QAAO,YAAY,SAAS,MAAM,KAAK;CACvC,MAAM,YAAY,EAAE,GAAG,UAAU;AAEjC,KAAI,CAAC,SAAS,SAAA,aAAoB,CAChC,WAAU,aAAa,EAAE;AAG3B,KAAI,CAAC,MAAM,QAAQ,SAAA,eAAsB,CACvC,WAAU,eAAe,EAAE;AAI7B,KAAI,CAAC,SAAS,SAAS,YAAY,CACjC,WAAU,cAAc,EAAE;AAG5B,KAAI,CAAC,SAAS,SAAS,QAAQ,CAC7B,WAAU,UAAU,EAAE;AAGxB,QAAO;;;;;;;AAQT,SAAgB,SAAS,KAAmB;AAS1C,QAAO,OAAO,UAAU,SAAS,KAAK,IAAI,KAAK;;AAGjD,SAAgB,iBACd,UACA,aAAqB,6BACZ;AACT,QAAO,OAAO,aAAa,YAAY,sBAAsB,SACzD,SAAS,MAAM,WAAW,KAAK,OAC/B;;AAGN,SAAgB,iBAAiB,UAAe,cAA+B;AAC7E,QACE,OAAO,aAAa,YACpB,SAAS,MAAM,IAAI,CAAC,OAAO,sBAC3B,SAAS,MAAM,IAAI,CAAC,OAAO"}
|
package/build/warning-utils.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
let process_warning = require("process-warning");
|
|
3
|
+
//#region src/warning-utils.ts
|
|
4
|
+
var warning_utils_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
5
|
+
Codes: () => Codes,
|
|
6
|
+
emit: () => emit
|
|
5
7
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Codes["VERDEP003"] = "VERDEP003";
|
|
17
|
-
Codes["VERWAR006"] = "VERWAR006";
|
|
18
|
-
Codes["VERWAR007"] = "VERWAR007";
|
|
19
|
-
return Codes;
|
|
8
|
+
var verdaccioWarning = "VerdaccioWarning";
|
|
9
|
+
var Codes = /* @__PURE__ */ function(Codes) {
|
|
10
|
+
Codes["VERWAR001"] = "VERWAR001";
|
|
11
|
+
Codes["VERWAR002"] = "VERWAR002";
|
|
12
|
+
Codes["VERWAR003"] = "VERWAR003";
|
|
13
|
+
Codes["VERWAR004"] = "VERWAR004";
|
|
14
|
+
Codes["VERDEP003"] = "VERDEP003";
|
|
15
|
+
Codes["VERWAR006"] = "VERWAR006";
|
|
16
|
+
Codes["VERWAR007"] = "VERWAR007";
|
|
17
|
+
return Codes;
|
|
20
18
|
}({});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
message: `Verdaccio doesn't need superuser privileges. don't run it under root`
|
|
19
|
+
var warnings = {};
|
|
20
|
+
warnings[Codes.VERWAR001] = (0, process_warning.createWarning)({
|
|
21
|
+
name: verdaccioWarning,
|
|
22
|
+
code: Codes.VERWAR001,
|
|
23
|
+
message: `Verdaccio doesn't need superuser privileges. don't run it under root`
|
|
27
24
|
});
|
|
28
|
-
warnings[Codes.VERWAR002] = (0,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
warnings[Codes.VERWAR002] = (0, process_warning.createWarning)({
|
|
26
|
+
name: verdaccioWarning,
|
|
27
|
+
code: Codes.VERWAR002,
|
|
28
|
+
message: `The configuration property "logs" has been deprecated, please rename to "log" for future compatibility`
|
|
32
29
|
});
|
|
33
|
-
warnings[Codes.VERWAR003] = (0,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
warnings[Codes.VERWAR003] = (0, process_warning.createWarning)({
|
|
31
|
+
name: verdaccioWarning,
|
|
32
|
+
code: Codes.VERWAR003,
|
|
33
|
+
message: "rotating-file type is not longer supported, consider use [logrotate] instead"
|
|
37
34
|
});
|
|
38
|
-
warnings[Codes.VERWAR004] = (0,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
warnings[Codes.VERWAR004] = (0, process_warning.createWarning)({
|
|
36
|
+
name: verdaccioWarning,
|
|
37
|
+
code: Codes.VERWAR004,
|
|
38
|
+
message: `invalid address - %s, we expect a port (e.g. "4873"),
|
|
42
39
|
host:port (e.g. "localhost:4873") or full url '(e.g. "http://localhost:4873/")
|
|
43
40
|
https://verdaccio.org/docs/en/configuration#listen-port`
|
|
44
41
|
});
|
|
45
|
-
warnings[Codes.VERWAR006] = (0,
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
warnings[Codes.VERWAR006] = (0, process_warning.createDeprecation)({
|
|
43
|
+
code: Codes.VERWAR006,
|
|
44
|
+
message: "the auth plugin method \"add_user\" in the auth plugin is deprecated and will be removed in next major release, rename to \"adduser\""
|
|
48
45
|
});
|
|
49
|
-
warnings[Codes.VERWAR007] = (0,
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
warnings[Codes.VERWAR007] = (0, process_warning.createDeprecation)({
|
|
47
|
+
code: Codes.VERWAR007,
|
|
48
|
+
message: `the secret length is too long, it must be 32 characters long, please consider generate a new one
|
|
52
49
|
Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`
|
|
53
50
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
warnings[Codes.VERDEP003] = (0, _processWarning.createDeprecation)({
|
|
58
|
-
code: Codes.VERDEP003,
|
|
59
|
-
message: 'multiple addresses will be deprecated in the next major, only use one'
|
|
51
|
+
warnings[Codes.VERDEP003] = (0, process_warning.createDeprecation)({
|
|
52
|
+
code: Codes.VERDEP003,
|
|
53
|
+
message: "multiple addresses will be deprecated in the next major, only use one"
|
|
60
54
|
});
|
|
61
55
|
function emit(code, a, b, c) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
warning(a, b, c);
|
|
65
|
-
}
|
|
56
|
+
const warning = warnings[code];
|
|
57
|
+
if (warning) warning(a, b, c);
|
|
66
58
|
}
|
|
59
|
+
//#endregion
|
|
60
|
+
Object.defineProperty(exports, "warning_utils_exports", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function() {
|
|
63
|
+
return warning_utils_exports;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
67
|
//# sourceMappingURL=warning-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warning-utils.js","names":[
|
|
1
|
+
{"version":3,"file":"warning-utils.js","names":[],"sources":["../src/warning-utils.ts"],"sourcesContent":["import { createDeprecation, createWarning } from 'process-warning';\n\nconst verdaccioWarning = 'VerdaccioWarning';\n\nexport enum Codes {\n VERWAR001 = 'VERWAR001',\n VERWAR002 = 'VERWAR002',\n VERWAR003 = 'VERWAR003',\n VERWAR004 = 'VERWAR004',\n // deprecation warnings\n VERDEP003 = 'VERDEP003',\n VERWAR006 = 'VERWAR006',\n VERWAR007 = 'VERWAR007',\n}\n\n/* general warnings */\n\nconst warnings: Record<string, (a?: any, b?: any, c?: any) => void> = {};\n\nwarnings[Codes.VERWAR001] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR001,\n message: `Verdaccio doesn't need superuser privileges. don't run it under root`,\n});\n\nwarnings[Codes.VERWAR002] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR002,\n message: `The configuration property \"logs\" has been deprecated, please rename to \"log\" for future compatibility`,\n});\n\nwarnings[Codes.VERWAR003] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR003,\n message: 'rotating-file type is not longer supported, consider use [logrotate] instead',\n});\n\nwarnings[Codes.VERWAR004] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR004,\n message: `invalid address - %s, we expect a port (e.g. \"4873\"),\nhost:port (e.g. \"localhost:4873\") or full url '(e.g. \"http://localhost:4873/\")\nhttps://verdaccio.org/docs/en/configuration#listen-port`,\n});\n\nwarnings[Codes.VERWAR006] = createDeprecation({\n code: Codes.VERWAR006,\n message:\n 'the auth plugin method \"add_user\" in the auth plugin is deprecated and will be removed in next major release, rename to \"adduser\"',\n});\n\nwarnings[Codes.VERWAR007] = createDeprecation({\n code: Codes.VERWAR007,\n message: `the secret length is too long, it must be 32 characters long, please consider generate a new one\n Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`,\n});\n\n/* deprecation warnings */\n\nwarnings[Codes.VERDEP003] = createDeprecation({\n code: Codes.VERDEP003,\n message: 'multiple addresses will be deprecated in the next major, only use one',\n});\n\nexport function emit(code: string, a?: string, b?: string, c?: string) {\n const warning = warnings[code];\n if (warning) {\n warning(a, b, c);\n }\n}\n"],"mappings":";;;;;;;AAEA,IAAM,mBAAmB;AAEzB,IAAY,QAAL,yBAAA,OAAA;AACL,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;AAEA,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;;KACD;AAID,IAAM,WAAgE,EAAE;AAExE,SAAS,MAAM,cAAA,GAAA,gBAAA,eAA2B;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,cAAA,GAAA,gBAAA,eAA2B;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,cAAA,GAAA,gBAAA,eAA2B;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,cAAA,GAAA,gBAAA,eAA2B;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;;;CAGV,CAAC;AAEF,SAAS,MAAM,cAAA,GAAA,gBAAA,mBAA+B;CAC5C,MAAM,MAAM;CACZ,SACE;CACH,CAAC;AAEF,SAAS,MAAM,cAAA,GAAA,gBAAA,mBAA+B;CAC5C,MAAM,MAAM;CACZ,SAAS;;CAEV,CAAC;AAIF,SAAS,MAAM,cAAA,GAAA,gBAAA,mBAA+B;CAC5C,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAgB,KAAK,MAAc,GAAY,GAAY,GAAY;CACrE,MAAM,UAAU,SAAS;AACzB,KAAI,QACF,SAAQ,GAAG,GAAG,EAAE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { createDeprecation, createWarning } from "process-warning";
|
|
3
|
+
//#region src/warning-utils.ts
|
|
4
|
+
var warning_utils_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Codes: () => Codes,
|
|
6
|
+
emit: () => emit
|
|
7
|
+
});
|
|
8
|
+
var verdaccioWarning = "VerdaccioWarning";
|
|
9
|
+
var Codes = /* @__PURE__ */ function(Codes) {
|
|
10
|
+
Codes["VERWAR001"] = "VERWAR001";
|
|
11
|
+
Codes["VERWAR002"] = "VERWAR002";
|
|
12
|
+
Codes["VERWAR003"] = "VERWAR003";
|
|
13
|
+
Codes["VERWAR004"] = "VERWAR004";
|
|
14
|
+
Codes["VERDEP003"] = "VERDEP003";
|
|
15
|
+
Codes["VERWAR006"] = "VERWAR006";
|
|
16
|
+
Codes["VERWAR007"] = "VERWAR007";
|
|
17
|
+
return Codes;
|
|
18
|
+
}({});
|
|
19
|
+
var warnings = {};
|
|
20
|
+
warnings[Codes.VERWAR001] = createWarning({
|
|
21
|
+
name: verdaccioWarning,
|
|
22
|
+
code: Codes.VERWAR001,
|
|
23
|
+
message: `Verdaccio doesn't need superuser privileges. don't run it under root`
|
|
24
|
+
});
|
|
25
|
+
warnings[Codes.VERWAR002] = createWarning({
|
|
26
|
+
name: verdaccioWarning,
|
|
27
|
+
code: Codes.VERWAR002,
|
|
28
|
+
message: `The configuration property "logs" has been deprecated, please rename to "log" for future compatibility`
|
|
29
|
+
});
|
|
30
|
+
warnings[Codes.VERWAR003] = createWarning({
|
|
31
|
+
name: verdaccioWarning,
|
|
32
|
+
code: Codes.VERWAR003,
|
|
33
|
+
message: "rotating-file type is not longer supported, consider use [logrotate] instead"
|
|
34
|
+
});
|
|
35
|
+
warnings[Codes.VERWAR004] = createWarning({
|
|
36
|
+
name: verdaccioWarning,
|
|
37
|
+
code: Codes.VERWAR004,
|
|
38
|
+
message: `invalid address - %s, we expect a port (e.g. "4873"),
|
|
39
|
+
host:port (e.g. "localhost:4873") or full url '(e.g. "http://localhost:4873/")
|
|
40
|
+
https://verdaccio.org/docs/en/configuration#listen-port`
|
|
41
|
+
});
|
|
42
|
+
warnings[Codes.VERWAR006] = createDeprecation({
|
|
43
|
+
code: Codes.VERWAR006,
|
|
44
|
+
message: "the auth plugin method \"add_user\" in the auth plugin is deprecated and will be removed in next major release, rename to \"adduser\""
|
|
45
|
+
});
|
|
46
|
+
warnings[Codes.VERWAR007] = createDeprecation({
|
|
47
|
+
code: Codes.VERWAR007,
|
|
48
|
+
message: `the secret length is too long, it must be 32 characters long, please consider generate a new one
|
|
49
|
+
Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`
|
|
50
|
+
});
|
|
51
|
+
warnings[Codes.VERDEP003] = createDeprecation({
|
|
52
|
+
code: Codes.VERDEP003,
|
|
53
|
+
message: "multiple addresses will be deprecated in the next major, only use one"
|
|
54
|
+
});
|
|
55
|
+
function emit(code, a, b, c) {
|
|
56
|
+
const warning = warnings[code];
|
|
57
|
+
if (warning) warning(a, b, c);
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { warning_utils_exports };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=warning-utils.mjs.map
|