@openfin/core 33.76.16 → 33.76.18
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.
|
Binary file
|
package/package.json
CHANGED
package/src/util/http.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchJson = exports.downloadFile = exports.fetch = exports.getRequestOptions = exports.getProxy = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_url_1 = require("node:url"); // This must explicitly use node builtin to avoid accidentally bundling npm:url.
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const getProxyVar = () => {
|
|
7
7
|
return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
|
|
8
8
|
};
|
|
9
9
|
const getProxy = () => {
|
|
10
|
-
const parsedUrl = new
|
|
10
|
+
const parsedUrl = new node_url_1.URL(getProxyVar());
|
|
11
11
|
return {
|
|
12
12
|
port: parsedUrl.port,
|
|
13
13
|
host: parsedUrl.hostname,
|
|
@@ -17,7 +17,7 @@ const getProxy = () => {
|
|
|
17
17
|
};
|
|
18
18
|
exports.getProxy = getProxy;
|
|
19
19
|
const getRequestOptions = (url) => {
|
|
20
|
-
const parsedUrl = new
|
|
20
|
+
const parsedUrl = new node_url_1.URL(url);
|
|
21
21
|
let options;
|
|
22
22
|
if (getProxyVar() && parsedUrl.hostname !== 'localhost' && parsedUrl.hostname.substring(0, 3) !== '127') {
|
|
23
23
|
options = {};
|
|
@@ -40,7 +40,7 @@ exports.getRequestOptions = getRequestOptions;
|
|
|
40
40
|
const fetch = async (url) => {
|
|
41
41
|
var _a;
|
|
42
42
|
const requestUrl = getProxyVar() ? getProxyVar() : url;
|
|
43
|
-
const proto = (0,
|
|
43
|
+
const proto = (0, node_url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
|
|
44
44
|
const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
|
|
45
45
|
return new Promise((resolve, reject) => {
|
|
46
46
|
const options = (0, exports.getRequestOptions)(url);
|
|
@@ -63,7 +63,7 @@ exports.fetch = fetch;
|
|
|
63
63
|
const downloadFile = async (url, writeLocation) => {
|
|
64
64
|
var _a;
|
|
65
65
|
const requestUrl = getProxyVar() ? getProxyVar() : url;
|
|
66
|
-
const proto = (0,
|
|
66
|
+
const proto = (0, node_url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
|
|
67
67
|
const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
|
|
68
68
|
return new Promise((resolve, reject) => {
|
|
69
69
|
try {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateConfig = exports.normalizeConfig = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
|
-
const
|
|
5
|
+
const node_url_1 = require("node:url"); // This must explicitly use node builtin to avoid accidentally bundling npm:url
|
|
6
6
|
const wire_1 = require("../transport/wire");
|
|
7
7
|
const promises_1 = require("./promises");
|
|
8
8
|
const http_1 = require("./http");
|
|
9
9
|
async function readLocalConfig(location) {
|
|
10
10
|
let pathToFile = location;
|
|
11
11
|
if (location.startsWith('file')) {
|
|
12
|
-
pathToFile = (0,
|
|
12
|
+
pathToFile = (0, node_url_1.fileURLToPath)(location);
|
|
13
13
|
}
|
|
14
14
|
const txt = await (0, promises_1.promisify)(fs.readFile)(pathToFile);
|
|
15
15
|
return JSON.parse(txt.toString());
|
|
Binary file
|