@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.
Files changed (76) hide show
  1. package/build/_virtual/_rolldown/runtime.js +33 -0
  2. package/build/_virtual/_rolldown/runtime.mjs +13 -0
  3. package/build/auth-utils.d.ts +1 -1
  4. package/build/auth-utils.js +23 -25
  5. package/build/auth-utils.js.map +1 -1
  6. package/build/auth-utils.mjs +32 -0
  7. package/build/auth-utils.mjs.map +1 -0
  8. package/build/constants.js +179 -155
  9. package/build/constants.js.map +1 -1
  10. package/build/constants.mjs +163 -0
  11. package/build/constants.mjs.map +1 -0
  12. package/build/crypto-utils.d.ts +1 -1
  13. package/build/crypto-utils.js +33 -29
  14. package/build/crypto-utils.js.map +1 -1
  15. package/build/crypto-utils.mjs +40 -0
  16. package/build/crypto-utils.mjs.map +1 -0
  17. package/build/error-utils.d.ts +1 -1
  18. package/build/error-utils.js +92 -80
  19. package/build/error-utils.js.map +1 -1
  20. package/build/error-utils.mjs +107 -0
  21. package/build/error-utils.mjs.map +1 -0
  22. package/build/file-utils.js +35 -31
  23. package/build/file-utils.js.map +1 -1
  24. package/build/file-utils.mjs +35 -0
  25. package/build/file-utils.mjs.map +1 -0
  26. package/build/index.d.ts +2 -1
  27. package/build/index.js +118 -183
  28. package/build/index.mjs +14 -0
  29. package/build/pkg-utils.d.ts +1 -1
  30. package/build/pkg-utils.js +60 -76
  31. package/build/pkg-utils.js.map +1 -1
  32. package/build/pkg-utils.mjs +69 -0
  33. package/build/pkg-utils.mjs.map +1 -0
  34. package/build/plugin-utils.d.ts +4 -4
  35. package/build/plugin-utils.js +27 -78
  36. package/build/plugin-utils.js.map +1 -1
  37. package/build/plugin-utils.mjs +26 -0
  38. package/build/plugin-utils.mjs.map +1 -0
  39. package/build/schemes/publish-manifest.js +33 -43
  40. package/build/schemes/publish-manifest.js.map +1 -1
  41. package/build/schemes/publish-manifest.mjs +36 -0
  42. package/build/schemes/publish-manifest.mjs.map +1 -0
  43. package/build/schemes/unpublish-manifest.js +51 -72
  44. package/build/schemes/unpublish-manifest.js.map +1 -1
  45. package/build/schemes/unpublish-manifest.mjs +54 -0
  46. package/build/schemes/unpublish-manifest.mjs.map +1 -0
  47. package/build/search-utils.js +9 -9
  48. package/build/search-utils.js.map +1 -1
  49. package/build/search-utils.mjs +8 -0
  50. package/build/search-utils.mjs.map +1 -0
  51. package/build/stream-utils.d.ts +1 -2
  52. package/build/stream-utils.js +29 -28
  53. package/build/stream-utils.js.map +1 -1
  54. package/build/stream-utils.mjs +30 -0
  55. package/build/stream-utils.mjs.map +1 -0
  56. package/build/string-utils.js +31 -34
  57. package/build/string-utils.js.map +1 -1
  58. package/build/string-utils.mjs +31 -0
  59. package/build/string-utils.mjs.map +1 -0
  60. package/build/tarball-utils.js +40 -39
  61. package/build/tarball-utils.js.map +1 -1
  62. package/build/tarball-utils.mjs +46 -0
  63. package/build/tarball-utils.mjs.map +1 -0
  64. package/build/validation-utils.d.ts +1 -1
  65. package/build/validation-utils.js +78 -112
  66. package/build/validation-utils.js.map +1 -1
  67. package/build/validation-utils.mjs +91 -0
  68. package/build/validation-utils.mjs.map +1 -0
  69. package/build/warning-utils.js +52 -52
  70. package/build/warning-utils.js.map +1 -1
  71. package/build/warning-utils.mjs +62 -0
  72. package/build/warning-utils.mjs.map +1 -0
  73. package/package.json +17 -6
  74. package/build/index.js.map +0 -1
  75. package/build/path-utils.js +0 -2
  76. 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 type { Manifest } from '@verdaccio/types';
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
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isObject = isObject;
7
- exports.isPackageNameScoped = isPackageNameScoped;
8
- exports.normalizeMetadata = normalizeMetadata;
9
- exports.validateName = validateName;
10
- exports.validatePackage = validatePackage;
11
- exports.validatePassword = validatePassword;
12
- Object.defineProperty(exports, "validatePublishSingleVersion", {
13
- enumerable: true,
14
- get: function () {
15
- return _publishManifest.validatePublishSingleVersion;
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
- return name.startsWith('@');
20
+ return name.startsWith("@");
32
21
  }
33
-
34
22
  /**
35
- * From normalize-package-data/lib/fixer.js
36
- * @param {*} name the package name
37
- * @return {Boolean} whether is valid or not
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
- if (typeof name !== 'string') {
41
- return false;
42
- }
43
- let normalizedName = name.toLowerCase();
44
- const isScoped = isPackageNameScoped(name);
45
- const scopedName = name.split('/', 2)[1];
46
- if (isScoped && typeof scopedName !== 'undefined') {
47
- normalizedName = scopedName.toLowerCase();
48
- }
49
-
50
- /**
51
- * Some context about the first regex
52
- * - npm used to have a different tarball naming system.
53
- * eg: http://registry.npmjs.com/thirty-two
54
- * https://registry.npmjs.org/thirty-two/-/thirty-two@0.0.1.tgz
55
- * The file name thirty-two@0.0.1.tgz, the version and the pkg name was separated by an at (@)
56
- * while nowadays the naming system is based in dashes
57
- * https://registry.npmjs.org/verdaccio/-/verdaccio-1.4.0.tgz
58
- *
59
- * more info here: https://github.com/rlidwka/sinopia/issues/75
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
- * Validate a package.
68
- * @return {Boolean} whether the package is valid or not
69
- */
51
+ * Validate a package.
52
+ * @return {Boolean} whether the package is valid or not
53
+ */
70
54
  function validatePackage(name) {
71
- const nameList = name.split('/', 2);
72
- if (nameList.length === 1) {
73
- // normal package
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
- * Validate the package metadata, add additional properties whether are missing within
82
- * the metadata properties.
83
- * @param {*} manifest
84
- * @param {*} name
85
- * @return {Object} the object with additional properties as dist-tags ad versions
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
- _nodeAssert.default.strictEqual(manifest.name, name);
89
- const _manifest = {
90
- ...manifest
91
- };
92
- if (!isObject(manifest[_constants.DIST_TAGS])) {
93
- _manifest[_constants.DIST_TAGS] = {};
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
- * Check whether an element is an Object
111
- * @param {*} obj the element
112
- * @return {Boolean}
113
- */
76
+ * Check whether an element is an Object
77
+ * @param {*} obj the element
78
+ * @return {Boolean}
79
+ */
114
80
  function isObject(obj) {
115
- // if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {
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 = _constants.DEFAULT_PASSWORD_VALIDATION) {
126
- return typeof password === 'string' && validation instanceof RegExp ? password.match(validation) !== null : false;
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
- return typeof userName === 'string' && userName.split(':')[0] === 'org.couchdb.user' && userName.split(':')[1] === expectedName;
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":["_nodeAssert","_interopRequireDefault","require","_constants","_publishManifest","_unpublishManifest","e","__esModule","default","isPackageNameScoped","name","startsWith","validateName","normalizedName","toLowerCase","isScoped","scopedName","split","match","includes","validatePackage","nameList","length","slice","normalizeMetadata","manifest","assert","strictEqual","_manifest","isObject","DIST_TAGS","Array","isArray","MAINTAINERS","obj","Object","prototype","toString","call","validatePassword","password","validation","DEFAULT_PASSWORD_VALIDATION","RegExp","validateUserName","userName","expectedName"],"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":"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","ignoreList":[]}
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"}
@@ -1,67 +1,67 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
- exports.Codes = void 0;
7
- exports.emit = emit;
8
- var _processWarning = require("process-warning");
9
- const verdaccioWarning = 'VerdaccioWarning';
10
- let Codes = exports.Codes = /*#__PURE__*/function (Codes) {
11
- Codes["VERWAR001"] = "VERWAR001";
12
- Codes["VERWAR002"] = "VERWAR002";
13
- Codes["VERWAR003"] = "VERWAR003";
14
- Codes["VERWAR004"] = "VERWAR004";
15
- // deprecation warnings
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
- /* general warnings */
22
- const warnings = {};
23
- warnings[Codes.VERWAR001] = (0, _processWarning.createWarning)({
24
- name: verdaccioWarning,
25
- code: Codes.VERWAR001,
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, _processWarning.createWarning)({
29
- name: verdaccioWarning,
30
- code: Codes.VERWAR002,
31
- message: `The configuration property "logs" has been deprecated, please rename to "log" for future compatibility`
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, _processWarning.createWarning)({
34
- name: verdaccioWarning,
35
- code: Codes.VERWAR003,
36
- message: 'rotating-file type is not longer supported, consider use [logrotate] instead'
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, _processWarning.createWarning)({
39
- name: verdaccioWarning,
40
- code: Codes.VERWAR004,
41
- message: `invalid address - %s, we expect a port (e.g. "4873"),
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, _processWarning.createDeprecation)({
46
- code: Codes.VERWAR006,
47
- message: 'the auth plugin method "add_user" in the auth plugin is deprecated and will be removed in next major release, rename to "adduser"'
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, _processWarning.createDeprecation)({
50
- code: Codes.VERWAR007,
51
- message: `the secret length is too long, it must be 32 characters long, please consider generate a new one
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
- /* deprecation warnings */
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
- const warning = warnings[code];
63
- if (warning) {
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":["_processWarning","require","verdaccioWarning","Codes","exports","warnings","VERWAR001","createWarning","name","code","message","VERWAR002","VERWAR003","VERWAR004","VERWAR006","createDeprecation","VERWAR007","VERDEP003","emit","a","b","c","warning"],"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":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,MAAMC,gBAAgB,GAAG,kBAAkB;AAAC,IAEhCC,KAAK,GAAAC,OAAA,CAAAD,KAAA,0BAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAKf;EALUA,KAAK;EAALA,KAAK;EAALA,KAAK;EAAA,OAALA,KAAK;AAAA;AAWjB;AAEA,MAAME,QAA6D,GAAG,CAAC,CAAC;AAExEA,QAAQ,CAACF,KAAK,CAACG,SAAS,CAAC,GAAG,IAAAC,6BAAa,EAAC;EACxCC,IAAI,EAAEN,gBAAgB;EACtBO,IAAI,EAAEN,KAAK,CAACG,SAAS;EACrBI,OAAO,EAAE;AACX,CAAC,CAAC;AAEFL,QAAQ,CAACF,KAAK,CAACQ,SAAS,CAAC,GAAG,IAAAJ,6BAAa,EAAC;EACxCC,IAAI,EAAEN,gBAAgB;EACtBO,IAAI,EAAEN,KAAK,CAACQ,SAAS;EACrBD,OAAO,EAAE;AACX,CAAC,CAAC;AAEFL,QAAQ,CAACF,KAAK,CAACS,SAAS,CAAC,GAAG,IAAAL,6BAAa,EAAC;EACxCC,IAAI,EAAEN,gBAAgB;EACtBO,IAAI,EAAEN,KAAK,CAACS,SAAS;EACrBF,OAAO,EAAE;AACX,CAAC,CAAC;AAEFL,QAAQ,CAACF,KAAK,CAACU,SAAS,CAAC,GAAG,IAAAN,6BAAa,EAAC;EACxCC,IAAI,EAAEN,gBAAgB;EACtBO,IAAI,EAAEN,KAAK,CAACU,SAAS;EACrBH,OAAO,EAAE;AACX;AACA;AACA,CAAC,CAAC;AAEFL,QAAQ,CAACF,KAAK,CAACW,SAAS,CAAC,GAAG,IAAAC,iCAAiB,EAAC;EAC5CN,IAAI,EAAEN,KAAK,CAACW,SAAS;EACrBJ,OAAO,EACL;AACJ,CAAC,CAAC;AAEFL,QAAQ,CAACF,KAAK,CAACa,SAAS,CAAC,GAAG,IAAAD,iCAAiB,EAAC;EAC5CN,IAAI,EAAEN,KAAK,CAACa,SAAS;EACrBN,OAAO,EAAE;AACX;AACA,CAAC,CAAC;;AAEF;;AAEAL,QAAQ,CAACF,KAAK,CAACc,SAAS,CAAC,GAAG,IAAAF,iCAAiB,EAAC;EAC5CN,IAAI,EAAEN,KAAK,CAACc,SAAS;EACrBP,OAAO,EAAE;AACX,CAAC,CAAC;AAEK,SAASQ,IAAIA,CAACT,IAAY,EAAEU,CAAU,EAAEC,CAAU,EAAEC,CAAU,EAAE;EACrE,MAAMC,OAAO,GAAGjB,QAAQ,CAACI,IAAI,CAAC;EAC9B,IAAIa,OAAO,EAAE;IACXA,OAAO,CAACH,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;EAClB;AACF","ignoreList":[]}
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