@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.
- package/build/_virtual/_rolldown/runtime.js +23 -0
- package/build/address.js +80 -102
- package/build/address.js.map +1 -1
- package/build/address.mjs +86 -0
- package/build/address.mjs.map +1 -0
- package/build/agent.js +11 -16
- package/build/agent.js.map +1 -1
- package/build/agent.mjs +12 -0
- package/build/agent.mjs.map +1 -0
- package/build/builder.js +128 -131
- package/build/builder.js.map +1 -1
- package/build/builder.mjs +129 -0
- package/build/builder.mjs.map +1 -0
- package/build/conf/index.js +10 -11
- package/build/conf/index.js.map +1 -1
- package/build/conf/index.mjs +12 -0
- package/build/conf/index.mjs.map +1 -0
- package/build/config-path.js +154 -163
- package/build/config-path.js.map +1 -1
- package/build/config-path.mjs +171 -0
- package/build/config-path.mjs.map +1 -0
- package/build/config-utils.js +37 -41
- package/build/config-utils.js.map +1 -1
- package/build/config-utils.mjs +40 -0
- package/build/config-utils.mjs.map +1 -0
- package/build/config.js +154 -203
- package/build/config.js.map +1 -1
- package/build/config.mjs +153 -0
- package/build/config.mjs.map +1 -0
- package/build/index.js +52 -167
- package/build/index.mjs +14 -0
- package/build/package-access.js +52 -68
- package/build/package-access.js.map +1 -1
- package/build/package-access.mjs +52 -0
- package/build/package-access.mjs.map +1 -0
- package/build/parse.js +83 -100
- package/build/parse.js.map +1 -1
- package/build/parse.mjs +85 -0
- package/build/parse.mjs.map +1 -0
- package/build/security.js +15 -22
- package/build/security.js.map +1 -1
- package/build/security.mjs +16 -0
- package/build/security.mjs.map +1 -0
- package/build/serverSettings.js +10 -15
- package/build/serverSettings.js.map +1 -1
- package/build/serverSettings.mjs +12 -0
- package/build/serverSettings.mjs.map +1 -0
- package/build/token.js +10 -13
- package/build/token.js.map +1 -1
- package/build/token.mjs +13 -0
- package/build/token.mjs.map +1 -0
- package/build/uplinks.js +47 -55
- package/build/uplinks.js.map +1 -1
- package/build/uplinks.mjs +50 -0
- package/build/uplinks.mjs.map +1 -0
- package/build/user.js +42 -37
- package/build/user.js.map +1 -1
- package/build/user.mjs +48 -0
- package/build/user.mjs.map +1 -0
- package/package.json +43 -30
- package/build/index.js.map +0 -1
package/build/builder.js
CHANGED
|
@@ -1,134 +1,131 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ConfigBuilder {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
package/build/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","names":[
|
|
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,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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,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;EAC/D,OAAO,IAAI,cAAc,MAAM;CACjC;CAEA,iBAAwB,SAAiB,WAA8B;EAGrE,KAAM,OAAO,SAA+C,WAAW;EACvE,OAAO;CACT;CAEA,UAAiB,IAAY,Q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AAoB,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"}
|
package/build/conf/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
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
|
package/build/conf/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
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"}
|