@verdaccio/proxy 9.0.0-next-9.3 → 9.0.0-next-9.5
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/agent.d.ts +2 -2
- package/build/agent.js +34 -61
- package/build/agent.js.map +1 -1
- package/build/agent.mjs +35 -0
- package/build/agent.mjs.map +1 -0
- package/build/index.js +11 -27
- package/build/index.mjs +3 -0
- package/build/proxy-utils.js +29 -38
- package/build/proxy-utils.js.map +1 -1
- package/build/proxy-utils.mjs +35 -0
- package/build/proxy-utils.mjs.map +1 -0
- package/build/proxy.d.ts +4 -6
- package/build/proxy.js +405 -593
- package/build/proxy.js.map +1 -1
- package/build/proxy.mjs +406 -0
- package/build/proxy.mjs.map +1 -0
- package/build/uplink-util.d.ts +2 -2
- package/build/uplink-util.js +20 -37
- package/build/uplink-util.js.map +1 -1
- package/build/uplink-util.mjs +25 -0
- package/build/uplink-util.mjs.map +1 -0
- package/package.json +22 -11
- package/build/index.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
package/build/agent.d.ts
CHANGED
package/build/agent.js
CHANGED
|
@@ -1,63 +1,36 @@
|
|
|
1
|
-
"
|
|
1
|
+
require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
let node_url = require("node:url");
|
|
3
|
+
let hpagent = require("hpagent");
|
|
4
|
+
let node_http = require("node:http");
|
|
5
|
+
let node_https = require("node:https");
|
|
6
|
+
//#region src/agent.ts
|
|
7
|
+
var CustomAgents = class {
|
|
8
|
+
url;
|
|
9
|
+
proxy;
|
|
10
|
+
agentOptions;
|
|
11
|
+
agent;
|
|
12
|
+
constructor(url, proxy, agentOptions) {
|
|
13
|
+
this.proxy = proxy;
|
|
14
|
+
this.url = url;
|
|
15
|
+
this.agentOptions = agentOptions;
|
|
16
|
+
const { protocol } = new node_url.URL(this.url);
|
|
17
|
+
this.agent = this.getAgent(protocol);
|
|
18
|
+
}
|
|
19
|
+
get() {
|
|
20
|
+
return this.agent;
|
|
21
|
+
}
|
|
22
|
+
getAgent(protocol) {
|
|
23
|
+
const isHTTPS = protocol === "https:";
|
|
24
|
+
if (this.proxy) {
|
|
25
|
+
const options = {
|
|
26
|
+
proxy: this.proxy,
|
|
27
|
+
...this.agentOptions
|
|
28
|
+
};
|
|
29
|
+
return isHTTPS ? { https: new hpagent.HttpsProxyAgent(options) } : { http: new hpagent.HttpProxyAgent(options) };
|
|
30
|
+
} else return isHTTPS ? { https: new node_https.Agent(this.agentOptions) } : { http: new node_http.Agent(this.agentOptions) };
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.default = CustomAgents;
|
|
2
35
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _hpagent = require("hpagent");
|
|
8
|
-
var _nodeHttp = require("node:http");
|
|
9
|
-
var _nodeHttps = require("node:https");
|
|
10
|
-
var _nodeUrl = require("node:url");
|
|
11
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
17
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
-
var CustomAgents = /*#__PURE__*/function () {
|
|
21
|
-
function CustomAgents(url, proxy, agentOptions) {
|
|
22
|
-
_classCallCheck(this, CustomAgents);
|
|
23
|
-
this.proxy = proxy;
|
|
24
|
-
this.url = url;
|
|
25
|
-
this.agentOptions = agentOptions;
|
|
26
|
-
// Type of agent depends on the protocol of the server URL (no on the proxy)
|
|
27
|
-
// See https://www.npmjs.com/package/hpagent
|
|
28
|
-
var _URL = new _nodeUrl.URL(this.url),
|
|
29
|
-
protocol = _URL.protocol;
|
|
30
|
-
this.agent = this.getAgent(protocol);
|
|
31
|
-
}
|
|
32
|
-
return _createClass(CustomAgents, [{
|
|
33
|
-
key: "get",
|
|
34
|
-
value: function get() {
|
|
35
|
-
return this.agent;
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
key: "getAgent",
|
|
39
|
-
value: function getAgent(protocol) {
|
|
40
|
-
var isHTTPS = protocol === 'https:';
|
|
41
|
-
if (this.proxy) {
|
|
42
|
-
var options = _objectSpread({
|
|
43
|
-
proxy: this.proxy
|
|
44
|
-
}, this.agentOptions);
|
|
45
|
-
// use hpagent
|
|
46
|
-
return isHTTPS ? {
|
|
47
|
-
https: new _hpagent.HttpsProxyAgent(options)
|
|
48
|
-
} : {
|
|
49
|
-
http: new _hpagent.HttpProxyAgent(options)
|
|
50
|
-
};
|
|
51
|
-
} else {
|
|
52
|
-
// use native http/https agent
|
|
53
|
-
return isHTTPS ? {
|
|
54
|
-
https: new _nodeHttps.Agent(this.agentOptions)
|
|
55
|
-
} : {
|
|
56
|
-
http: new _nodeHttp.Agent(this.agentOptions)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}]);
|
|
61
|
-
}();
|
|
62
|
-
var _default = exports["default"] = CustomAgents;
|
|
63
36
|
//# sourceMappingURL=agent.js.map
|
package/build/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","names":[
|
|
1
|
+
{"version":3,"file":"agent.js","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import type { Agents } from 'got-cjs';\nimport { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';\nimport { Agent as HttpAgent } from 'node:http';\nimport { Agent as HttpsAgent } from 'node:https';\nimport { URL } from 'node:url';\n\nimport type { AgentOptionsConf } from '@verdaccio/types';\n\nclass CustomAgents {\n private url: string;\n private proxy: string | undefined;\n private agentOptions: AgentOptionsConf;\n private agent: Agents;\n public constructor(url: string, proxy: string | undefined, agentOptions: AgentOptionsConf) {\n this.proxy = proxy;\n this.url = url;\n this.agentOptions = agentOptions;\n // Type of agent depends on the protocol of the server URL (no on the proxy)\n // See https://www.npmjs.com/package/hpagent\n const { protocol } = new URL(this.url);\n this.agent = this.getAgent(protocol);\n }\n\n public get() {\n return this.agent;\n }\n\n private getAgent(protocol: string): Agents {\n const isHTTPS = protocol === 'https:';\n if (this.proxy) {\n const options = {\n proxy: this.proxy,\n ...this.agentOptions,\n };\n // use hpagent\n return isHTTPS\n ? { https: new HttpsProxyAgent(options) }\n : { http: new HttpProxyAgent(options) };\n } else {\n // use native http/https agent\n return isHTTPS\n ? { https: new HttpsAgent(this.agentOptions) }\n : { http: new HttpAgent(this.agentOptions) };\n }\n }\n}\n\nexport default CustomAgents;\n"],"mappings":";;;;;;AAQA,IAAM,eAAN,MAAmB;CACjB;CACA;CACA;CACA;CACA,YAAmB,KAAa,OAA2B,cAAgC;AACzF,OAAK,QAAQ;AACb,OAAK,MAAM;AACX,OAAK,eAAe;EAGpB,MAAM,EAAE,aAAa,IAAI,SAAA,IAAI,KAAK,IAAI;AACtC,OAAK,QAAQ,KAAK,SAAS,SAAS;;CAGtC,MAAa;AACX,SAAO,KAAK;;CAGd,SAAiB,UAA0B;EACzC,MAAM,UAAU,aAAa;AAC7B,MAAI,KAAK,OAAO;GACd,MAAM,UAAU;IACd,OAAO,KAAK;IACZ,GAAG,KAAK;IACT;AAED,UAAO,UACH,EAAE,OAAO,IAAI,QAAA,gBAAgB,QAAQ,EAAE,GACvC,EAAE,MAAM,IAAI,QAAA,eAAe,QAAQ,EAAE;QAGzC,QAAO,UACH,EAAE,OAAO,IAAI,WAAA,MAAW,KAAK,aAAa,EAAE,GAC5C,EAAE,MAAM,IAAI,UAAA,MAAU,KAAK,aAAa,EAAE"}
|
package/build/agent.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { URL } from "node:url";
|
|
2
|
+
import { HttpProxyAgent, HttpsProxyAgent } from "hpagent";
|
|
3
|
+
import { Agent } from "node:http";
|
|
4
|
+
import { Agent as Agent$1 } from "node:https";
|
|
5
|
+
//#region src/agent.ts
|
|
6
|
+
var CustomAgents = class {
|
|
7
|
+
url;
|
|
8
|
+
proxy;
|
|
9
|
+
agentOptions;
|
|
10
|
+
agent;
|
|
11
|
+
constructor(url, proxy, agentOptions) {
|
|
12
|
+
this.proxy = proxy;
|
|
13
|
+
this.url = url;
|
|
14
|
+
this.agentOptions = agentOptions;
|
|
15
|
+
const { protocol } = new URL(this.url);
|
|
16
|
+
this.agent = this.getAgent(protocol);
|
|
17
|
+
}
|
|
18
|
+
get() {
|
|
19
|
+
return this.agent;
|
|
20
|
+
}
|
|
21
|
+
getAgent(protocol) {
|
|
22
|
+
const isHTTPS = protocol === "https:";
|
|
23
|
+
if (this.proxy) {
|
|
24
|
+
const options = {
|
|
25
|
+
proxy: this.proxy,
|
|
26
|
+
...this.agentOptions
|
|
27
|
+
};
|
|
28
|
+
return isHTTPS ? { https: new HttpsProxyAgent(options) } : { http: new HttpProxyAgent(options) };
|
|
29
|
+
} else return isHTTPS ? { https: new Agent$1(this.agentOptions) } : { http: new Agent(this.agentOptions) };
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CustomAgents as default };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=agent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import type { Agents } from 'got-cjs';\nimport { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';\nimport { Agent as HttpAgent } from 'node:http';\nimport { Agent as HttpsAgent } from 'node:https';\nimport { URL } from 'node:url';\n\nimport type { AgentOptionsConf } from '@verdaccio/types';\n\nclass CustomAgents {\n private url: string;\n private proxy: string | undefined;\n private agentOptions: AgentOptionsConf;\n private agent: Agents;\n public constructor(url: string, proxy: string | undefined, agentOptions: AgentOptionsConf) {\n this.proxy = proxy;\n this.url = url;\n this.agentOptions = agentOptions;\n // Type of agent depends on the protocol of the server URL (no on the proxy)\n // See https://www.npmjs.com/package/hpagent\n const { protocol } = new URL(this.url);\n this.agent = this.getAgent(protocol);\n }\n\n public get() {\n return this.agent;\n }\n\n private getAgent(protocol: string): Agents {\n const isHTTPS = protocol === 'https:';\n if (this.proxy) {\n const options = {\n proxy: this.proxy,\n ...this.agentOptions,\n };\n // use hpagent\n return isHTTPS\n ? { https: new HttpsProxyAgent(options) }\n : { http: new HttpProxyAgent(options) };\n } else {\n // use native http/https agent\n return isHTTPS\n ? { https: new HttpsAgent(this.agentOptions) }\n : { http: new HttpAgent(this.agentOptions) };\n }\n }\n}\n\nexport default CustomAgents;\n"],"mappings":";;;;;AAQA,IAAM,eAAN,MAAmB;CACjB;CACA;CACA;CACA;CACA,YAAmB,KAAa,OAA2B,cAAgC;AACzF,OAAK,QAAQ;AACb,OAAK,MAAM;AACX,OAAK,eAAe;EAGpB,MAAM,EAAE,aAAa,IAAI,IAAI,KAAK,IAAI;AACtC,OAAK,QAAQ,KAAK,SAAS,SAAS;;CAGtC,MAAa;AACX,SAAO,KAAK;;CAGd,SAAiB,UAA0B;EACzC,MAAM,UAAU,aAAa;AAC7B,MAAI,KAAK,OAAO;GACd,MAAM,UAAU;IACd,OAAO,KAAK;IACZ,GAAG,KAAK;IACT;AAED,UAAO,UACH,EAAE,OAAO,IAAI,gBAAgB,QAAQ,EAAE,GACvC,EAAE,MAAM,IAAI,eAAe,QAAQ,EAAE;QAGzC,QAAO,UACH,EAAE,OAAO,IAAI,QAAW,KAAK,aAAa,EAAE,GAC5C,EAAE,MAAM,IAAI,MAAU,KAAK,aAAa,EAAE"}
|
package/build/index.js
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _uplinkUtil = require("./uplink-util");
|
|
18
|
-
Object.keys(_uplinkUtil).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _uplinkUtil[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _uplinkUtil[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
5
|
+
require("./_virtual/_rolldown/runtime.js");
|
|
6
|
+
const require_proxy = require("./proxy.js");
|
|
7
|
+
const require_uplink_util = require("./uplink-util.js");
|
|
8
|
+
let got_cjs = require("got-cjs");
|
|
9
|
+
exports.FetchOptions = got_cjs.Options;
|
|
10
|
+
exports.ProxyStorage = require_proxy.ProxyStorage;
|
|
11
|
+
exports.setupUpLinks = require_uplink_util.setupUpLinks;
|
|
12
|
+
exports.updateVersionsHiddenUpLinkNext = require_uplink_util.updateVersionsHiddenUpLinkNext;
|
package/build/index.mjs
ADDED
package/build/proxy-utils.js
CHANGED
|
@@ -1,44 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.parseInterval = parseInterval;
|
|
1
|
+
//#region src/proxy-utils.ts
|
|
7
2
|
var parseIntervalTable = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
"": 1e3,
|
|
4
|
+
ms: 1,
|
|
5
|
+
s: 1e3,
|
|
6
|
+
m: 60 * 1e3,
|
|
7
|
+
h: 3600 * 1e3,
|
|
8
|
+
d: 864e5,
|
|
9
|
+
w: 7 * 864e5,
|
|
10
|
+
M: 30 * 864e5,
|
|
11
|
+
y: 365 * 864e5
|
|
17
12
|
};
|
|
18
|
-
|
|
19
13
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
* Parse an internal string to number
|
|
15
|
+
* @param {*} interval
|
|
16
|
+
* @return {Number}
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
25
19
|
function parseInterval(interval) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw Error('invalid interval: ' + interval);
|
|
38
|
-
}
|
|
39
|
-
last_suffix = parseIntervalTable[m[4]];
|
|
40
|
-
result += Number(m[1]) * parseIntervalTable[m[4]];
|
|
41
|
-
});
|
|
42
|
-
return result;
|
|
20
|
+
if (typeof interval === "number") return interval * 1e3;
|
|
21
|
+
let result = 0;
|
|
22
|
+
let last_suffix = Infinity;
|
|
23
|
+
interval.split(/\s+/).forEach(function(x) {
|
|
24
|
+
if (!x) return;
|
|
25
|
+
const m = x.match(/^((0|[1-9][0-9]*)(\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/);
|
|
26
|
+
if (!m || parseIntervalTable[m[4]] >= last_suffix || m[4] === "" && last_suffix !== Infinity) throw Error("invalid interval: " + interval);
|
|
27
|
+
last_suffix = parseIntervalTable[m[4]];
|
|
28
|
+
result += Number(m[1]) * parseIntervalTable[m[4]];
|
|
29
|
+
});
|
|
30
|
+
return result;
|
|
43
31
|
}
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.parseInterval = parseInterval;
|
|
34
|
+
|
|
44
35
|
//# sourceMappingURL=proxy-utils.js.map
|
package/build/proxy-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-utils.js","names":[
|
|
1
|
+
{"version":3,"file":"proxy-utils.js","names":[],"sources":["../src/proxy-utils.ts"],"sourcesContent":["const parseIntervalTable = {\n '': 1000,\n ms: 1,\n s: 1000,\n m: 60 * 1000,\n h: 60 * 60 * 1000,\n d: 86400000,\n w: 7 * 86400000,\n M: 30 * 86400000,\n y: 365 * 86400000,\n};\n\n/**\n * Parse an internal string to number\n * @param {*} interval\n * @return {Number}\n * @deprecated\n */\nexport function parseInterval(interval: any): number {\n if (typeof interval === 'number') {\n return interval * 1000;\n }\n let result = 0;\n let last_suffix = Infinity;\n interval.split(/\\s+/).forEach(function (x): void {\n if (!x) {\n return;\n }\n const m = x.match(/^((0|[1-9][0-9]*)(\\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/);\n if (\n !m ||\n parseIntervalTable[m[4]] >= last_suffix ||\n (m[4] === '' && last_suffix !== Infinity)\n ) {\n throw Error('invalid interval: ' + interval);\n }\n last_suffix = parseIntervalTable[m[4]];\n result += Number(m[1]) * parseIntervalTable[m[4]];\n });\n return result;\n}\n"],"mappings":";AAAA,IAAM,qBAAqB;CACzB,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG,KAAK;CACR,GAAG,OAAU;CACb,GAAG;CACH,GAAG,IAAI;CACP,GAAG,KAAK;CACR,GAAG,MAAM;CACV;;;;;;;AAQD,SAAgB,cAAc,UAAuB;AACnD,KAAI,OAAO,aAAa,SACtB,QAAO,WAAW;CAEpB,IAAI,SAAS;CACb,IAAI,cAAc;AAClB,UAAS,MAAM,MAAM,CAAC,QAAQ,SAAU,GAAS;AAC/C,MAAI,CAAC,EACH;EAEF,MAAM,IAAI,EAAE,MAAM,oDAAoD;AACtE,MACE,CAAC,KACD,mBAAmB,EAAE,OAAO,eAC3B,EAAE,OAAO,MAAM,gBAAgB,SAEhC,OAAM,MAAM,uBAAuB,SAAS;AAE9C,gBAAc,mBAAmB,EAAE;AACnC,YAAU,OAAO,EAAE,GAAG,GAAG,mBAAmB,EAAE;GAC9C;AACF,QAAO"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/proxy-utils.ts
|
|
2
|
+
var parseIntervalTable = {
|
|
3
|
+
"": 1e3,
|
|
4
|
+
ms: 1,
|
|
5
|
+
s: 1e3,
|
|
6
|
+
m: 60 * 1e3,
|
|
7
|
+
h: 3600 * 1e3,
|
|
8
|
+
d: 864e5,
|
|
9
|
+
w: 7 * 864e5,
|
|
10
|
+
M: 30 * 864e5,
|
|
11
|
+
y: 365 * 864e5
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Parse an internal string to number
|
|
15
|
+
* @param {*} interval
|
|
16
|
+
* @return {Number}
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
19
|
+
function parseInterval(interval) {
|
|
20
|
+
if (typeof interval === "number") return interval * 1e3;
|
|
21
|
+
let result = 0;
|
|
22
|
+
let last_suffix = Infinity;
|
|
23
|
+
interval.split(/\s+/).forEach(function(x) {
|
|
24
|
+
if (!x) return;
|
|
25
|
+
const m = x.match(/^((0|[1-9][0-9]*)(\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/);
|
|
26
|
+
if (!m || parseIntervalTable[m[4]] >= last_suffix || m[4] === "" && last_suffix !== Infinity) throw Error("invalid interval: " + interval);
|
|
27
|
+
last_suffix = parseIntervalTable[m[4]];
|
|
28
|
+
result += Number(m[1]) * parseIntervalTable[m[4]];
|
|
29
|
+
});
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { parseInterval };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=proxy-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-utils.mjs","names":[],"sources":["../src/proxy-utils.ts"],"sourcesContent":["const parseIntervalTable = {\n '': 1000,\n ms: 1,\n s: 1000,\n m: 60 * 1000,\n h: 60 * 60 * 1000,\n d: 86400000,\n w: 7 * 86400000,\n M: 30 * 86400000,\n y: 365 * 86400000,\n};\n\n/**\n * Parse an internal string to number\n * @param {*} interval\n * @return {Number}\n * @deprecated\n */\nexport function parseInterval(interval: any): number {\n if (typeof interval === 'number') {\n return interval * 1000;\n }\n let result = 0;\n let last_suffix = Infinity;\n interval.split(/\\s+/).forEach(function (x): void {\n if (!x) {\n return;\n }\n const m = x.match(/^((0|[1-9][0-9]*)(\\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/);\n if (\n !m ||\n parseIntervalTable[m[4]] >= last_suffix ||\n (m[4] === '' && last_suffix !== Infinity)\n ) {\n throw Error('invalid interval: ' + interval);\n }\n last_suffix = parseIntervalTable[m[4]];\n result += Number(m[1]) * parseIntervalTable[m[4]];\n });\n return result;\n}\n"],"mappings":";AAAA,IAAM,qBAAqB;CACzB,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG,KAAK;CACR,GAAG,OAAU;CACb,GAAG;CACH,GAAG,IAAI;CACP,GAAG,KAAK;CACR,GAAG,MAAM;CACV;;;;;;;AAQD,SAAgB,cAAc,UAAuB;AACnD,KAAI,OAAO,aAAa,SACtB,QAAO,WAAW;CAEpB,IAAI,SAAS;CACb,IAAI,cAAc;AAClB,UAAS,MAAM,MAAM,CAAC,QAAQ,SAAU,GAAS;AAC/C,MAAI,CAAC,EACH;EAEF,MAAM,IAAI,EAAE,MAAM,oDAAoD;AACtE,MACE,CAAC,KACD,mBAAmB,EAAE,OAAO,eAC3B,EAAE,OAAO,MAAM,gBAAgB,SAEhC,OAAM,MAAM,uBAAuB,SAAS;AAE9C,gBAAc,mBAAmB,EAAE;AACnC,YAAU,OAAO,EAAE,GAAG,GAAG,mBAAmB,EAAE;GAC9C;AACF,QAAO"}
|
package/build/proxy.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type Stream from 'node:stream';
|
|
4
|
-
import { PassThrough } from 'node:stream';
|
|
1
|
+
import { Agents, Delays, RetryOptions, Headers as gotHeaders, Options } from 'got-cjs';
|
|
2
|
+
import { default as Stream, PassThrough } from 'node:stream';
|
|
5
3
|
import { URL } from 'node:url';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import { searchUtils } from '@verdaccio/core';
|
|
5
|
+
import { AgentOptionsConf, Config, Logger, Manifest, UpLinkConf } from '@verdaccio/types';
|
|
8
6
|
export type UpLinkConfLocal = UpLinkConf & {
|
|
9
7
|
no_proxy?: string;
|
|
10
8
|
};
|