@verdaccio/config 8.1.2 → 8.2.0

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 (61) hide show
  1. package/build/_virtual/_rolldown/runtime.js +23 -0
  2. package/build/address.js +80 -102
  3. package/build/address.js.map +1 -1
  4. package/build/address.mjs +86 -0
  5. package/build/address.mjs.map +1 -0
  6. package/build/agent.js +11 -16
  7. package/build/agent.js.map +1 -1
  8. package/build/agent.mjs +12 -0
  9. package/build/agent.mjs.map +1 -0
  10. package/build/builder.js +128 -131
  11. package/build/builder.js.map +1 -1
  12. package/build/builder.mjs +129 -0
  13. package/build/builder.mjs.map +1 -0
  14. package/build/conf/index.js +10 -11
  15. package/build/conf/index.js.map +1 -1
  16. package/build/conf/index.mjs +12 -0
  17. package/build/conf/index.mjs.map +1 -0
  18. package/build/config-path.js +154 -163
  19. package/build/config-path.js.map +1 -1
  20. package/build/config-path.mjs +171 -0
  21. package/build/config-path.mjs.map +1 -0
  22. package/build/config-utils.js +37 -41
  23. package/build/config-utils.js.map +1 -1
  24. package/build/config-utils.mjs +40 -0
  25. package/build/config-utils.mjs.map +1 -0
  26. package/build/config.js +154 -203
  27. package/build/config.js.map +1 -1
  28. package/build/config.mjs +153 -0
  29. package/build/config.mjs.map +1 -0
  30. package/build/index.js +52 -167
  31. package/build/index.mjs +14 -0
  32. package/build/package-access.js +52 -68
  33. package/build/package-access.js.map +1 -1
  34. package/build/package-access.mjs +52 -0
  35. package/build/package-access.mjs.map +1 -0
  36. package/build/parse.js +83 -100
  37. package/build/parse.js.map +1 -1
  38. package/build/parse.mjs +85 -0
  39. package/build/parse.mjs.map +1 -0
  40. package/build/security.js +15 -22
  41. package/build/security.js.map +1 -1
  42. package/build/security.mjs +16 -0
  43. package/build/security.mjs.map +1 -0
  44. package/build/serverSettings.js +10 -15
  45. package/build/serverSettings.js.map +1 -1
  46. package/build/serverSettings.mjs +12 -0
  47. package/build/serverSettings.mjs.map +1 -0
  48. package/build/token.js +10 -13
  49. package/build/token.js.map +1 -1
  50. package/build/token.mjs +13 -0
  51. package/build/token.mjs.map +1 -0
  52. package/build/uplinks.js +47 -55
  53. package/build/uplinks.js.map +1 -1
  54. package/build/uplinks.mjs +50 -0
  55. package/build/uplinks.mjs.map +1 -0
  56. package/build/user.js +42 -37
  57. package/build/user.js.map +1 -1
  58. package/build/user.mjs +48 -0
  59. package/build/user.mjs.map +1 -0
  60. package/package.json +43 -30
  61. package/build/index.js.map +0 -1
package/build/builder.js CHANGED
@@ -1,134 +1,131 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _lodash = require("lodash");
8
- var _ = require(".");
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ const require_parse = require("./parse.js");
3
+ require("./index.js");
4
+ let lodash = require("lodash");
5
+ lodash = require_runtime.__toESM(lodash);
6
+ //#region src/builder.ts
7
+ var { merge } = lodash.default;
9
8
  /**
10
- * Helper configuration builder constructor, used to build the configuration for testing or
11
- * programatically creating a configuration.
12
- */
13
- class ConfigBuilder {
14
- constructor(config) {
15
- this.config = (0, _lodash.merge)({
16
- uplinks: {},
17
- packages: {},
18
- security: {}
19
- }, config);
20
- }
21
- static build(config) {
22
- return new ConfigBuilder(config);
23
- }
24
- addPackageAccess(pattern, pkgAccess) {
25
- // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]
26
- // The config parser normalizes these later, so the cast is safe here
27
- this.config.packages[pattern] = pkgAccess;
28
- return this;
29
- }
30
- addUplink(id, uplink) {
31
- this.config.uplinks[id] = uplink;
32
- return this;
33
- }
34
- addSecurity(security) {
35
- this.config.security = (0, _lodash.merge)(this.config.security, security);
36
- return this;
37
- }
38
- addAuth(auth) {
39
- this.config.auth = (0, _lodash.merge)(this.config.auth, auth);
40
- return this;
41
- }
42
- addLogger(log) {
43
- this.config.log = log;
44
- return this;
45
- }
46
- addStorage(storage) {
47
- if (typeof storage === 'string') {
48
- this.config.storage = storage;
49
- } else {
50
- this.config.store = storage;
51
- }
52
- return this;
53
- }
54
- addWeb(web) {
55
- this.config.web = (0, _lodash.merge)(this.config.web, web);
56
- return this;
57
- }
58
- addListen(listen) {
59
- this.config.listen = listen;
60
- return this;
61
- }
62
- addHttps(https) {
63
- this.config.https = https;
64
- return this;
65
- }
66
- addPublish(publish) {
67
- this.config.publish = (0, _lodash.merge)(this.config.publish, publish);
68
- return this;
69
- }
70
- addFlags(flags) {
71
- this.config.flags = (0, _lodash.merge)(this.config.flags, flags);
72
- return this;
73
- }
74
- addNotify(notify) {
75
- this.config.notify = notify;
76
- return this;
77
- }
78
- addMiddlewares(middlewares) {
79
- this.config.middlewares = (0, _lodash.merge)(this.config.middlewares, middlewares);
80
- return this;
81
- }
82
- addFilters(filters) {
83
- this.config.filters = (0, _lodash.merge)(this.config.filters, filters);
84
- return this;
85
- }
86
- addMaxBodySize(maxBodySize) {
87
- this.config.max_body_size = maxBodySize;
88
- return this;
89
- }
90
- addUserRateLimit(rateLimit) {
91
- this.config.userRateLimit = (0, _lodash.merge)(this.config.userRateLimit, rateLimit);
92
- return this;
93
- }
94
- addUrlPrefix(urlPrefix) {
95
- this.config.url_prefix = urlPrefix;
96
- return this;
97
- }
98
- addI18n(i18n) {
99
- this.config.i18n = i18n;
100
- return this;
101
- }
102
- addUserAgent(userAgent) {
103
- this.config.user_agent = userAgent;
104
- return this;
105
- }
106
- addHttpProxy(httpProxy) {
107
- this.config.http_proxy = httpProxy;
108
- return this;
109
- }
110
- addHttpsProxy(httpsProxy) {
111
- this.config.https_proxy = httpsProxy;
112
- return this;
113
- }
114
- addNoProxy(noProxy) {
115
- this.config.no_proxy = noProxy;
116
- return this;
117
- }
118
- addPlugins(plugins) {
119
- this.config.plugins = plugins;
120
- return this;
121
- }
122
- addNotifications(notifications) {
123
- this.config.notifications = notifications;
124
- return this;
125
- }
126
- getConfig() {
127
- return this.config;
128
- }
129
- getAsYaml() {
130
- return (0, _.fromJStoYAML)(this.config);
131
- }
132
- }
9
+ * Helper configuration builder constructor, used to build the configuration for testing or
10
+ * programatically creating a configuration.
11
+ */
12
+ var ConfigBuilder = class ConfigBuilder {
13
+ config;
14
+ constructor(config) {
15
+ this.config = merge({
16
+ uplinks: {},
17
+ packages: {},
18
+ security: {}
19
+ }, config);
20
+ }
21
+ static build(config) {
22
+ return new ConfigBuilder(config);
23
+ }
24
+ addPackageAccess(pattern, pkgAccess) {
25
+ this.config.packages[pattern] = pkgAccess;
26
+ return this;
27
+ }
28
+ addUplink(id, uplink) {
29
+ this.config.uplinks[id] = uplink;
30
+ return this;
31
+ }
32
+ addSecurity(security) {
33
+ this.config.security = merge(this.config.security, security);
34
+ return this;
35
+ }
36
+ addAuth(auth) {
37
+ this.config.auth = merge(this.config.auth, auth);
38
+ return this;
39
+ }
40
+ addLogger(log) {
41
+ this.config.log = log;
42
+ return this;
43
+ }
44
+ addStorage(storage) {
45
+ if (typeof storage === "string") this.config.storage = storage;
46
+ else this.config.store = storage;
47
+ return this;
48
+ }
49
+ addWeb(web) {
50
+ this.config.web = merge(this.config.web, web);
51
+ return this;
52
+ }
53
+ addListen(listen) {
54
+ this.config.listen = listen;
55
+ return this;
56
+ }
57
+ addHttps(https) {
58
+ this.config.https = https;
59
+ return this;
60
+ }
61
+ addPublish(publish) {
62
+ this.config.publish = merge(this.config.publish, publish);
63
+ return this;
64
+ }
65
+ addFlags(flags) {
66
+ this.config.flags = merge(this.config.flags, flags);
67
+ return this;
68
+ }
69
+ addNotify(notify) {
70
+ this.config.notify = notify;
71
+ return this;
72
+ }
73
+ addMiddlewares(middlewares) {
74
+ this.config.middlewares = merge(this.config.middlewares, middlewares);
75
+ return this;
76
+ }
77
+ addFilters(filters) {
78
+ this.config.filters = merge(this.config.filters, filters);
79
+ return this;
80
+ }
81
+ addMaxBodySize(maxBodySize) {
82
+ this.config.max_body_size = maxBodySize;
83
+ return this;
84
+ }
85
+ addUserRateLimit(rateLimit) {
86
+ this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);
87
+ return this;
88
+ }
89
+ addUrlPrefix(urlPrefix) {
90
+ this.config.url_prefix = urlPrefix;
91
+ return this;
92
+ }
93
+ addI18n(i18n) {
94
+ this.config.i18n = i18n;
95
+ return this;
96
+ }
97
+ addUserAgent(userAgent) {
98
+ this.config.user_agent = userAgent;
99
+ return this;
100
+ }
101
+ addHttpProxy(httpProxy) {
102
+ this.config.http_proxy = httpProxy;
103
+ return this;
104
+ }
105
+ addHttpsProxy(httpsProxy) {
106
+ this.config.https_proxy = httpsProxy;
107
+ return this;
108
+ }
109
+ addNoProxy(noProxy) {
110
+ this.config.no_proxy = noProxy;
111
+ return this;
112
+ }
113
+ addPlugins(plugins) {
114
+ this.config.plugins = plugins;
115
+ return this;
116
+ }
117
+ addNotifications(notifications) {
118
+ this.config.notifications = notifications;
119
+ return this;
120
+ }
121
+ getConfig() {
122
+ return this.config;
123
+ }
124
+ getAsYaml() {
125
+ return require_parse.fromJStoYAML(this.config);
126
+ }
127
+ };
128
+ //#endregion
133
129
  exports.default = ConfigBuilder;
130
+
134
131
  //# sourceMappingURL=builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","names":["_lodash","require","_","ConfigBuilder","constructor","config","merge","uplinks","packages","security","build","addPackageAccess","pattern","pkgAccess","addUplink","id","uplink","addSecurity","addAuth","auth","addLogger","log","addStorage","storage","store","addWeb","web","addListen","listen","addHttps","https","addPublish","publish","addFlags","flags","addNotify","notify","addMiddlewares","middlewares","addFilters","filters","addMaxBodySize","maxBodySize","max_body_size","addUserRateLimit","rateLimit","userRateLimit","addUrlPrefix","urlPrefix","url_prefix","addI18n","i18n","addUserAgent","userAgent","user_agent","addHttpProxy","httpProxy","http_proxy","addHttpsProxy","httpsProxy","https_proxy","addNoProxy","noProxy","no_proxy","addPlugins","plugins","addNotifications","notifications","getConfig","getAsYaml","fromJStoYAML","exports","default"],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash';\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n UpLinkConf,\n WebConf,\n} from '@verdaccio/types';\n\nimport { fromJStoYAML } from '.';\n\n/**\n * Helper configuration builder constructor, used to build the configuration for testing or\n * programatically creating a configuration.\n */\nexport default class ConfigBuilder {\n private config: ConfigYaml;\n\n public constructor(config?: Partial<ConfigYaml>) {\n this.config = merge({ uplinks: {}, packages: {}, security: {} }, config);\n }\n\n public static build(config?: Partial<ConfigYaml>): ConfigBuilder {\n return new ConfigBuilder(config);\n }\n\n public addPackageAccess(pattern: string, pkgAccess: PackageAccessYaml) {\n // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[pattern] = pkgAccess;\n return this;\n }\n\n public addUplink(id: string, uplink: UpLinkConf) {\n this.config.uplinks[id] = uplink;\n return this;\n }\n\n public addSecurity(security: Partial<Security>) {\n this.config.security = merge(this.config.security, security);\n return this;\n }\n\n public addAuth(auth: Partial<AuthConf>) {\n this.config.auth = merge(this.config.auth, auth);\n return this;\n }\n\n public addLogger(log: LoggerConfigItem) {\n this.config.log = log;\n return this;\n }\n\n public addStorage(storage: string | object) {\n if (typeof storage === 'string') {\n this.config.storage = storage;\n } else {\n this.config.store = storage;\n }\n return this;\n }\n\n public addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\n return this;\n }\n\n public getConfig(): ConfigYaml {\n return this.config;\n }\n\n public getAsYaml(): string {\n return fromJStoYAML(this.config) as string;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAkBA,IAAAC,CAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACe,MAAME,aAAa,CAAC;EAG1BC,WAAWA,CAACC,MAA4B,EAAE;IAC/C,IAAI,CAACA,MAAM,GAAG,IAAAC,aAAK,EAAC;MAAEC,OAAO,EAAE,CAAC,CAAC;MAAEC,QAAQ,EAAE,CAAC,CAAC;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAC,EAAEJ,MAAM,CAAC;EAC1E;EAEA,OAAcK,KAAKA,CAACL,MAA4B,EAAiB;IAC/D,OAAO,IAAIF,aAAa,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AAI;EACb;EAEOE,YAAYA,CAACC,SAAiB,EAAE;IACrC,IAAI,CAAC3C,MAAM,CAAC4C,UAAU,GAAGD,SAAS;IAClC,OAAO,IAAI;EACb;EAEOE,OAAOA,CAACC,IAAwB,EAAE;IACvC,IAAI,CAAC9C,MAAM,CAAC8C,IAAI,GAAGA,IAAI;IACvB,OAAO,IAAI;EACb;EAEOC,YAAYA,CAACC,SAAiB,EAAE;IACrC,IAAI,CAAChD,MAAM,CAACiD,UAAU,GAAGD,SAAS;IAClC,OAAO,IAAI;EACb;EAEOE,YAAYA,CAACC,SAAiB,EAAE;IACrC,IAAI,CAACnD,MAAM,CAACoD,UAAU,GAAGD,SAAS;IAClC,OAAO,IAAI;EACb;EAEOE,aAAaA,CAACC,UAAkB,EAAE;IACvC,IAAI,CAACtD,MAAM,CAACuD,WAAW,GAAGD,UAAU;IACpC,OAAO,IAAI;EACb;EAEOE,UAAUA,CAACC,OAAe,EAAE;IACjC,IAAI,CAACzD,MAAM,CAAC0D,QAAQ,GAAGD,OAAO;IAC9B,OAAO,IAAI;EACb;EAEOE,UAAUA,CAACC,OAAe,EAAE;IACjC,IAAI,CAAC5D,MAAM,CAAC4D,OAAO,GAAGA,OAAO;IAC7B,OAAO,IAAI;EACb;EAEOC,gBAAgBA,CAACC,aAA4B,EAAE;IACpD,IAAI,CAAC9D,MAAM,CAAC8D,aAAa,GAAGA,aAAa;IACzC,OAAO,IAAI;EACb;EAEOC,SAASA,CAAA,EAAe;IAC7B,OAAO,IAAI,CAAC/D,MAAM;EACpB;EAEOgE,SAASA,CAAA,EAAW;IACzB,OAAO,IAAAC,cAAY,EAAC,IAAI,CAACjE,MAAM,CAAC;EAClC;AACF;AAACkE,OAAA,CAAAC,OAAA,GAAArE,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"builder.js","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import _ from 'lodash';\n\nconst { merge } = _;\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n UpLinkConf,\n WebConf,\n} from '@verdaccio/types';\n\nimport { fromJStoYAML } from '.';\n\n/**\n * Helper configuration builder constructor, used to build the configuration for testing or\n * programatically creating a configuration.\n */\nexport default class ConfigBuilder {\n private config: ConfigYaml;\n\n public constructor(config?: Partial<ConfigYaml>) {\n this.config = merge({ uplinks: {}, packages: {}, security: {} }, config);\n }\n\n public static build(config?: Partial<ConfigYaml>): ConfigBuilder {\n return new ConfigBuilder(config);\n }\n\n public addPackageAccess(pattern: string, pkgAccess: PackageAccessYaml) {\n // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[pattern] = pkgAccess;\n return this;\n }\n\n public addUplink(id: string, uplink: UpLinkConf) {\n this.config.uplinks[id] = uplink;\n return this;\n }\n\n public addSecurity(security: Partial<Security>) {\n this.config.security = merge(this.config.security, security);\n return this;\n }\n\n public addAuth(auth: Partial<AuthConf>) {\n this.config.auth = merge(this.config.auth, auth);\n return this;\n }\n\n public addLogger(log: LoggerConfigItem) {\n this.config.log = log;\n return this;\n }\n\n public addStorage(storage: string | object) {\n if (typeof storage === 'string') {\n this.config.storage = storage;\n } else {\n this.config.store = storage;\n }\n return this;\n }\n\n public addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\n return this;\n }\n\n public getConfig(): ConfigYaml {\n return this.config;\n }\n\n public getAsYaml(): string {\n return fromJStoYAML(this.config) as string;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAM,EAAE,UAAU,OAAA;;;;;AAwBlB,IAAqB,gBAArB,MAAqB,cAAc;CACjC;CAEA,YAAmB,QAA8B;EAC/C,KAAK,SAAS,MAAM;GAAE,SAAS,CAAC;GAAG,UAAU,CAAC;GAAG,UAAU,CAAC;EAAE,GAAG,MAAM;CACzE;CAEA,OAAc,MAAM,QAA6C;EAC/D,OAAO,IAAI,cAAc,MAAM;CACjC;CAEA,iBAAwB,SAAiB,WAA8B;EAGrE,KAAM,OAAO,SAA+C,WAAW;EACvE,OAAO;CACT;CAEA,UAAiB,IAAY,QAAoB;EAC/C,KAAK,OAAO,QAAQ,MAAM;EAC1B,OAAO;CACT;CAEA,YAAmB,UAA6B;EAC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AAK,OAAO,OAAO;EACnB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,cAAqB,YAAoB;EACvC,KAAK,OAAO,cAAc;EAC1B,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,WAAW;EACvB,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,UAAU;EACtB,OAAO;CACT;CAEA,iBAAwB,eAA8B;EACpD,KAAK,OAAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,YAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,YAA2B;EACzB,OAAO,cAAA,aAAa,KAAK,MAAM;CACjC;AACF"}
@@ -0,0 +1,129 @@
1
+ import { fromJStoYAML } from "./parse.mjs";
2
+ import "./index.mjs";
3
+ import _ from "lodash";
4
+ //#region src/builder.ts
5
+ var { merge } = _;
6
+ /**
7
+ * Helper configuration builder constructor, used to build the configuration for testing or
8
+ * programatically creating a configuration.
9
+ */
10
+ var ConfigBuilder = class ConfigBuilder {
11
+ config;
12
+ constructor(config) {
13
+ this.config = merge({
14
+ uplinks: {},
15
+ packages: {},
16
+ security: {}
17
+ }, config);
18
+ }
19
+ static build(config) {
20
+ return new ConfigBuilder(config);
21
+ }
22
+ addPackageAccess(pattern, pkgAccess) {
23
+ this.config.packages[pattern] = pkgAccess;
24
+ return this;
25
+ }
26
+ addUplink(id, uplink) {
27
+ this.config.uplinks[id] = uplink;
28
+ return this;
29
+ }
30
+ addSecurity(security) {
31
+ this.config.security = merge(this.config.security, security);
32
+ return this;
33
+ }
34
+ addAuth(auth) {
35
+ this.config.auth = merge(this.config.auth, auth);
36
+ return this;
37
+ }
38
+ addLogger(log) {
39
+ this.config.log = log;
40
+ return this;
41
+ }
42
+ addStorage(storage) {
43
+ if (typeof storage === "string") this.config.storage = storage;
44
+ else this.config.store = storage;
45
+ return this;
46
+ }
47
+ addWeb(web) {
48
+ this.config.web = merge(this.config.web, web);
49
+ return this;
50
+ }
51
+ addListen(listen) {
52
+ this.config.listen = listen;
53
+ return this;
54
+ }
55
+ addHttps(https) {
56
+ this.config.https = https;
57
+ return this;
58
+ }
59
+ addPublish(publish) {
60
+ this.config.publish = merge(this.config.publish, publish);
61
+ return this;
62
+ }
63
+ addFlags(flags) {
64
+ this.config.flags = merge(this.config.flags, flags);
65
+ return this;
66
+ }
67
+ addNotify(notify) {
68
+ this.config.notify = notify;
69
+ return this;
70
+ }
71
+ addMiddlewares(middlewares) {
72
+ this.config.middlewares = merge(this.config.middlewares, middlewares);
73
+ return this;
74
+ }
75
+ addFilters(filters) {
76
+ this.config.filters = merge(this.config.filters, filters);
77
+ return this;
78
+ }
79
+ addMaxBodySize(maxBodySize) {
80
+ this.config.max_body_size = maxBodySize;
81
+ return this;
82
+ }
83
+ addUserRateLimit(rateLimit) {
84
+ this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);
85
+ return this;
86
+ }
87
+ addUrlPrefix(urlPrefix) {
88
+ this.config.url_prefix = urlPrefix;
89
+ return this;
90
+ }
91
+ addI18n(i18n) {
92
+ this.config.i18n = i18n;
93
+ return this;
94
+ }
95
+ addUserAgent(userAgent) {
96
+ this.config.user_agent = userAgent;
97
+ return this;
98
+ }
99
+ addHttpProxy(httpProxy) {
100
+ this.config.http_proxy = httpProxy;
101
+ return this;
102
+ }
103
+ addHttpsProxy(httpsProxy) {
104
+ this.config.https_proxy = httpsProxy;
105
+ return this;
106
+ }
107
+ addNoProxy(noProxy) {
108
+ this.config.no_proxy = noProxy;
109
+ return this;
110
+ }
111
+ addPlugins(plugins) {
112
+ this.config.plugins = plugins;
113
+ return this;
114
+ }
115
+ addNotifications(notifications) {
116
+ this.config.notifications = notifications;
117
+ return this;
118
+ }
119
+ getConfig() {
120
+ return this.config;
121
+ }
122
+ getAsYaml() {
123
+ return fromJStoYAML(this.config);
124
+ }
125
+ };
126
+ //#endregion
127
+ export { ConfigBuilder as default };
128
+
129
+ //# sourceMappingURL=builder.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.mjs","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import _ from 'lodash';\n\nconst { merge } = _;\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n UpLinkConf,\n WebConf,\n} from '@verdaccio/types';\n\nimport { fromJStoYAML } from '.';\n\n/**\n * Helper configuration builder constructor, used to build the configuration for testing or\n * programatically creating a configuration.\n */\nexport default class ConfigBuilder {\n private config: ConfigYaml;\n\n public constructor(config?: Partial<ConfigYaml>) {\n this.config = merge({ uplinks: {}, packages: {}, security: {} }, config);\n }\n\n public static build(config?: Partial<ConfigYaml>): ConfigBuilder {\n return new ConfigBuilder(config);\n }\n\n public addPackageAccess(pattern: string, pkgAccess: PackageAccessYaml) {\n // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[pattern] = pkgAccess;\n return this;\n }\n\n public addUplink(id: string, uplink: UpLinkConf) {\n this.config.uplinks[id] = uplink;\n return this;\n }\n\n public addSecurity(security: Partial<Security>) {\n this.config.security = merge(this.config.security, security);\n return this;\n }\n\n public addAuth(auth: Partial<AuthConf>) {\n this.config.auth = merge(this.config.auth, auth);\n return this;\n }\n\n public addLogger(log: LoggerConfigItem) {\n this.config.log = log;\n return this;\n }\n\n public addStorage(storage: string | object) {\n if (typeof storage === 'string') {\n this.config.storage = storage;\n } else {\n this.config.store = storage;\n }\n return this;\n }\n\n public addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\n return this;\n }\n\n public getConfig(): ConfigYaml {\n return this.config;\n }\n\n public getAsYaml(): string {\n return fromJStoYAML(this.config) as string;\n }\n}\n"],"mappings":";;;;AAEA,IAAM,EAAE,UAAU;;;;;AAwBlB,IAAqB,gBAArB,MAAqB,cAAc;CACjC;CAEA,YAAmB,QAA8B;EAC/C,KAAK,SAAS,MAAM;GAAE,SAAS,CAAC;GAAG,UAAU,CAAC;GAAG,UAAU,CAAC;EAAE,GAAG,MAAM;CACzE;CAEA,OAAc,MAAM,QAA6C;E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AAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,iBAAwB,WAAsB;EAC5C,KAAK,OAAO,gBAAgB,MAAM,KAAK,OAAO,eAAe,SAAS;EACtE,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,QAAe,MAA0B;EACvC,KAAK,OAAO,OAAO;EACnB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,cAAqB,YAAoB;EACvC,KAAK,OAAO,cAAc;EAC1B,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,WAAW;EACvB,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,UAAU;EACtB,OAAO;CACT;CAEA,iBAAwB,eAA8B;EACpD,KAAK,OAAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,YAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,YAA2B;EACzB,OAAO,aAAa,KAAK,MAAM;CACjC;AACF"}
@@ -1,13 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getDefaultConfig = getDefaultConfig;
7
- var _nodePath = require("node:path");
8
- var _parse = require("../parse");
9
- function getDefaultConfig(fileName = 'default.yaml') {
10
- const file = (0, _nodePath.join)(__dirname, `./${fileName}`);
11
- return (0, _parse.parseConfigFile)(file);
1
+ const require_parse = require("../parse.js");
2
+ let node_path = require("node:path");
3
+ let node_url = require("node:url");
4
+ //#region src/conf/index.ts
5
+ var currentDir = {}.url ? (0, node_path.dirname)((0, node_url.fileURLToPath)({}.url)) : __dirname;
6
+ function getDefaultConfig(fileName = "default.yaml") {
7
+ return require_parse.parseConfigFile((0, node_path.join)(currentDir, `./${fileName}`));
12
8
  }
9
+ //#endregion
10
+ exports.getDefaultConfig = getDefaultConfig;
11
+
13
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_nodePath","require","_parse","getDefaultConfig","fileName","file","join","__dirname","parseConfigFile"],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { parseConfigFile } from '../parse';\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(__dirname, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,gBAAgBA,CAACC,QAAgB,GAAG,cAAc,EAAE;EAClE,MAAMC,IAAI,GAAG,IAAAC,cAAI,EAACC,SAAS,EAAE,KAAKH,QAAQ,EAAE,CAAC;EAC7C,OAAO,IAAAI,sBAAe,EAACH,IAAI,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { parseConfigFile } from '../parse';\n\n// import.meta.url is only defined in the ESM build; the CJS build falls back to __dirname\nconst currentDir = import.meta.url ? dirname(fileURLToPath(import.meta.url)) : __dirname;\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(currentDir, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":";;;;AAMA,IAAM,aAAA,CAAA,EAAyB,OAAA,GAAA,UAAA,UAAA,GAAA,SAAA,eAAA,CAAA,EAAwC,GAAG,CAAC,IAAI;AAE/E,SAAgB,iBAAiB,WAAmB,gBAAgB;CAElE,OAAO,cAAA,iBAAA,GAAA,UAAA,MADW,YAAY,KAAK,UACZ,CAAI;AAC7B"}
@@ -0,0 +1,12 @@
1
+ import { parseConfigFile } from "../parse.mjs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ //#region src/conf/index.ts
5
+ var currentDir = import.meta.url ? dirname(fileURLToPath(import.meta.url)) : __dirname;
6
+ function getDefaultConfig(fileName = "default.yaml") {
7
+ return parseConfigFile(join(currentDir, `./${fileName}`));
8
+ }
9
+ //#endregion
10
+ export { getDefaultConfig };
11
+
12
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { parseConfigFile } from '../parse';\n\n// import.meta.url is only defined in the ESM build; the CJS build falls back to __dirname\nconst currentDir = import.meta.url ? dirname(fileURLToPath(import.meta.url)) : __dirname;\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(currentDir, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":";;;;AAMA,IAAM,aAAa,OAAO,KAAK,MAAM,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC,IAAI;AAE/E,SAAgB,iBAAiB,WAAmB,gBAAgB;CAElE,OAAO,gBADM,KAAK,YAAY,KAAK,UACZ,CAAI;AAC7B"}