request-light
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -1,63 +0,1 @@ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
var __webpack_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). | ||
(() => { | ||
var exports = __webpack_exports__; | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
exports.getErrorStatusDescription = exports.xhr = exports.configure = void 0; | ||
const configure = (_proxyUrl, _strictSSL) => { }; | ||
exports.configure = configure; | ||
const xhr = async (options) => { | ||
const requestHeaders = new Headers(); | ||
if (options.headers) { | ||
for (const key in options.headers) { | ||
const value = options.headers[key]; | ||
if (Array.isArray(value)) { | ||
value.forEach(v => requestHeaders.set(key, v)); | ||
} | ||
else { | ||
requestHeaders.set(key, value); | ||
} | ||
} | ||
} | ||
if (options.user && options.password) { | ||
requestHeaders.set('Authorization', 'Basic ' + btoa(options.user + ":" + options.password)); | ||
} | ||
const requestInit = { | ||
method: options.type, | ||
redirect: options.followRedirects > 0 ? 'follow' : 'manual', | ||
mode: 'cors', | ||
headers: requestHeaders | ||
}; | ||
const requestInfo = new Request(options.url, requestInit); | ||
const response = await fetch(requestInfo); | ||
const resposeHeaders = {}; | ||
for (let name in response.headers) { | ||
resposeHeaders[name] = response.headers.get(name); | ||
} | ||
return { | ||
responseText: await response.text(), | ||
body: new Uint8Array(await response.arrayBuffer()), | ||
status: response.status, | ||
headers: resposeHeaders | ||
}; | ||
}; | ||
exports.xhr = xhr; | ||
function getErrorStatusDescription(status) { | ||
return String(status); | ||
} | ||
exports.getErrorStatusDescription = getErrorStatusDescription; | ||
})(); | ||
var __webpack_export_target__ = exports; | ||
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; | ||
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); | ||
/******/ })() | ||
; | ||
(()=>{"use strict";var e={};(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.getErrorStatusDescription=r.xhr=r.configure=void 0,r.configure=(e,r)=>{},r.xhr=async e=>{const r=new Headers;if(e.headers)for(const t in e.headers){const s=e.headers[t];Array.isArray(s)?s.forEach((e=>r.set(t,e))):r.set(t,s)}e.user&&e.password&&r.set("Authorization","Basic "+btoa(e.user+":"+e.password));const t={method:e.type,redirect:e.followRedirects>0?"follow":"manual",mode:"cors",headers:r},s=new Request(e.url,t),a=await fetch(s),o={};for(let e in a.headers)o[e]=a.headers.get(e);return{responseText:await a.text(),body:new Uint8Array(await a.arrayBuffer()),status:a.status,headers:o}},r.getErrorStatusDescription=function(e){return String(e)}})();var r=exports;for(var t in e)r[t]=e[t];e.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})(); |
@@ -1,702 +0,1 @@ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ var __webpack_modules__ = ([ | ||
/* 0 */ | ||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
exports.getErrorStatusDescription = exports.xhr = exports.configure = void 0; | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
var url_1 = __webpack_require__(1); | ||
var https = __webpack_require__(2); | ||
var http = __webpack_require__(3); | ||
var zlib = __webpack_require__(4); | ||
var nls = __webpack_require__(5); | ||
var createHttpsProxyAgent = __webpack_require__(10); | ||
var createHttpProxyAgent = __webpack_require__(20); | ||
if (process.env.VSCODE_NLS_CONFIG) { | ||
var VSCODE_NLS_CONFIG = process.env.VSCODE_NLS_CONFIG; | ||
nls.config(JSON.parse(VSCODE_NLS_CONFIG)); | ||
} | ||
var localize = nls.loadMessageBundle(); | ||
var proxyUrl = null; | ||
var strictSSL = true; | ||
var configure = function (_proxyUrl, _strictSSL) { | ||
proxyUrl = _proxyUrl; | ||
strictSSL = _strictSSL; | ||
}; | ||
exports.configure = configure; | ||
var xhr = function (options) { | ||
var agent = getProxyAgent(options.url, { proxyUrl: proxyUrl, strictSSL: strictSSL }); | ||
options = assign({}, options); | ||
options = assign(options, { agent: agent, strictSSL: strictSSL }); | ||
if (typeof options.followRedirects !== 'number') { | ||
options.followRedirects = 5; | ||
} | ||
return request(options).then(function (result) { return new Promise(function (c, e) { | ||
var res = result.res; | ||
var readable = res; | ||
var encoding = res.headers && res.headers['content-encoding']; | ||
var isCompleted = false; | ||
if (encoding === 'gzip') { | ||
var gunzip = zlib.createGunzip(); | ||
res.pipe(gunzip); | ||
readable = gunzip; | ||
} | ||
else if (encoding === 'deflate') { | ||
var inflate = zlib.createInflate(); | ||
res.pipe(inflate); | ||
readable = inflate; | ||
} | ||
var data = []; | ||
readable.on('data', function (c) { return data.push(c); }); | ||
readable.on('end', function () { | ||
if (isCompleted) { | ||
return; | ||
} | ||
isCompleted = true; | ||
if (options.followRedirects > 0 && (res.statusCode >= 300 && res.statusCode <= 303 || res.statusCode === 307)) { | ||
var location = res.headers['location']; | ||
if (location) { | ||
var newOptions = { | ||
type: options.type, url: location, user: options.user, password: options.password, headers: options.headers, | ||
timeout: options.timeout, followRedirects: options.followRedirects - 1, data: options.data | ||
}; | ||
exports.xhr(newOptions).then(c, e); | ||
return; | ||
} | ||
} | ||
var buffer = Buffer.concat(data); | ||
var response = { | ||
responseText: buffer.toString(), | ||
body: buffer, | ||
status: res.statusCode, | ||
headers: res.headers || {} | ||
}; | ||
if ((res.statusCode >= 200 && res.statusCode < 300) || res.statusCode === 1223) { | ||
c(response); | ||
} | ||
else { | ||
e(response); | ||
} | ||
}); | ||
readable.on('error', function (err) { | ||
var response = { | ||
responseText: localize('error', 'Unable to access {0}. Error: {1}', options.url, err.message), | ||
body: Buffer.concat(data), | ||
status: 500, | ||
headers: {} | ||
}; | ||
isCompleted = true; | ||
e(response); | ||
}); | ||
}); }, function (err) { | ||
var message; | ||
if (agent) { | ||
message = localize('error.cannot.connect.proxy', 'Unable to connect to {0} through a proxy . Error: {1}', options.url, err.message); | ||
} | ||
else { | ||
message = localize('error.cannot.connect', 'Unable to connect to {0}. Error: {1}', options.url, err.message); | ||
} | ||
return Promise.reject({ | ||
responseText: message, | ||
body: Buffer.concat([]), | ||
status: 404, | ||
headers: {} | ||
}); | ||
}); | ||
}; | ||
exports.xhr = xhr; | ||
function assign(destination) { | ||
var sources = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
sources[_i - 1] = arguments[_i]; | ||
} | ||
sources.forEach(function (source) { return Object.keys(source).forEach(function (key) { return destination[key] = source[key]; }); }); | ||
return destination; | ||
} | ||
function request(options) { | ||
var req; | ||
return new Promise(function (c, e) { | ||
var endpoint = url_1.parse(options.url); | ||
var opts = { | ||
hostname: endpoint.hostname, | ||
port: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80), | ||
path: endpoint.path, | ||
method: options.type || 'GET', | ||
headers: options.headers, | ||
rejectUnauthorized: (typeof options.strictSSL === 'boolean') ? options.strictSSL : true | ||
}; | ||
if (options.user && options.password) { | ||
opts.auth = options.user + ':' + options.password; | ||
} | ||
var handler = function (res) { | ||
if (res.statusCode >= 300 && res.statusCode < 400 && options.followRedirects && options.followRedirects > 0 && res.headers['location']) { | ||
c(request(assign({}, options, { | ||
url: res.headers['location'], | ||
followRedirects: options.followRedirects - 1 | ||
}))); | ||
} | ||
else { | ||
c({ req: req, res: res }); | ||
} | ||
}; | ||
if (endpoint.protocol === 'https:') { | ||
req = https.request(opts, handler); | ||
} | ||
else { | ||
req = http.request(opts, handler); | ||
} | ||
req.on('error', e); | ||
if (options.timeout) { | ||
req.setTimeout(options.timeout); | ||
} | ||
if (options.data) { | ||
req.write(options.data); | ||
} | ||
req.end(); | ||
}); | ||
} | ||
function getErrorStatusDescription(status) { | ||
if (status < 400) { | ||
return void 0; | ||
} | ||
switch (status) { | ||
case 400: return localize('status.400', 'Bad request. The request cannot be fulfilled due to bad syntax.'); | ||
case 401: return localize('status.401', 'Unauthorized. The server is refusing to respond.'); | ||
case 403: return localize('status.403', 'Forbidden. The server is refusing to respond.'); | ||
case 404: return localize('status.404', 'Not Found. The requested location could not be found.'); | ||
case 405: return localize('status.405', 'Method not allowed. A request was made using a request method not supported by that location.'); | ||
case 406: return localize('status.406', 'Not Acceptable. The server can only generate a response that is not accepted by the client.'); | ||
case 407: return localize('status.407', 'Proxy Authentication Required. The client must first authenticate itself with the proxy.'); | ||
case 408: return localize('status.408', 'Request Timeout. The server timed out waiting for the request.'); | ||
case 409: return localize('status.409', 'Conflict. The request could not be completed because of a conflict in the request.'); | ||
case 410: return localize('status.410', 'Gone. The requested page is no longer available.'); | ||
case 411: return localize('status.411', 'Length Required. The "Content-Length" is not defined.'); | ||
case 412: return localize('status.412', 'Precondition Failed. The precondition given in the request evaluated to false by the server.'); | ||
case 413: return localize('status.413', 'Request Entity Too Large. The server will not accept the request, because the request entity is too large.'); | ||
case 414: return localize('status.414', 'Request-URI Too Long. The server will not accept the request, because the URL is too long.'); | ||
case 415: return localize('status.415', 'Unsupported Media Type. The server will not accept the request, because the media type is not supported.'); | ||
case 500: return localize('status.500', 'Internal Server Error.'); | ||
case 501: return localize('status.501', 'Not Implemented. The server either does not recognize the request method, or it lacks the ability to fulfill the request.'); | ||
case 503: return localize('status.503', 'Service Unavailable. The server is currently unavailable (overloaded or down).'); | ||
default: return localize('status.416', 'HTTP status code {0}', status); | ||
} | ||
} | ||
exports.getErrorStatusDescription = getErrorStatusDescription; | ||
// proxy handling | ||
function getSystemProxyURI(requestURL) { | ||
if (requestURL.protocol === 'http:') { | ||
return process.env.HTTP_PROXY || process.env.http_proxy || null; | ||
} | ||
else if (requestURL.protocol === 'https:') { | ||
return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || null; | ||
} | ||
return null; | ||
} | ||
function getProxyAgent(rawRequestURL, options) { | ||
if (options === void 0) { options = {}; } | ||
var requestURL = url_1.parse(rawRequestURL); | ||
var proxyURL = options.proxyUrl || getSystemProxyURI(requestURL); | ||
if (!proxyURL) { | ||
return null; | ||
} | ||
var proxyEndpoint = url_1.parse(proxyURL); | ||
if (!/^https?:$/.test(proxyEndpoint.protocol)) { | ||
return null; | ||
} | ||
var opts = { | ||
host: proxyEndpoint.hostname, | ||
port: Number(proxyEndpoint.port), | ||
auth: proxyEndpoint.auth, | ||
rejectUnauthorized: (typeof options.strictSSL === 'boolean') ? options.strictSSL : true | ||
}; | ||
return requestURL.protocol === 'http:' ? createHttpProxyAgent(opts) : createHttpsProxyAgent(opts); | ||
} | ||
/***/ }), | ||
/* 1 */ | ||
/***/ ((module) => { | ||
"use strict"; | ||
module.exports = require("url"); | ||
/***/ }), | ||
/* 2 */ | ||
/***/ ((module) => { | ||
"use strict"; | ||
module.exports = require("https"); | ||
/***/ }), | ||
/* 3 */ | ||
/***/ ((module) => { | ||
"use strict"; | ||
module.exports = require("http"); | ||
/***/ }), | ||
/* 4 */ | ||
/***/ ((module) => { | ||
"use strict"; | ||
module.exports = require("zlib"); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { | ||
"use strict"; | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
Object.defineProperty(exports, "__esModule", ({ value: true })); | ||
exports.config = exports.loadMessageBundle = void 0; | ||
var path = __webpack_require__(6); | ||
var fs = __webpack_require__(7); | ||
var ral_1 = __webpack_require__(8); | ||
var common_1 = __webpack_require__(9); | ||
var common_2 = __webpack_require__(9); | ||
Object.defineProperty(exports, "MessageFormat", ({ enumerable: true, get: function () { return common_2.MessageFormat; } })); | ||
Object.defineProperty(exports, "BundleFormat", ({ enumerable: true, get: function () { return common_2.BundleFormat; } })); | ||
var toString = Object.prototype.toString; | ||
function isNumber(value) { | ||
return toString.call(value) === '[object Number]'; | ||
} | ||
function isString(value) { | ||
return toString.call(value) === '[object String]'; | ||
} | ||
function isBoolean(value) { | ||
return value === true || value === false; | ||
} | ||
function readJsonFileSync(filename) { | ||
return JSON.parse(fs.readFileSync(filename, 'utf8')); | ||
} | ||
var resolvedBundles; | ||
var options; | ||
function initializeSettings() { | ||
options = { locale: undefined, language: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: common_1.MessageFormat.bundle }; | ||
if (isString(process.env.VSCODE_NLS_CONFIG)) { | ||
try { | ||
var vscodeOptions_1 = JSON.parse(process.env.VSCODE_NLS_CONFIG); | ||
var language = void 0; | ||
if (vscodeOptions_1.availableLanguages) { | ||
var value = vscodeOptions_1.availableLanguages['*']; | ||
if (isString(value)) { | ||
language = value; | ||
} | ||
} | ||
if (isString(vscodeOptions_1.locale)) { | ||
options.locale = vscodeOptions_1.locale.toLowerCase(); | ||
} | ||
if (language === undefined) { | ||
options.language = options.locale; | ||
} | ||
else if (language !== 'en') { | ||
options.language = language; | ||
} | ||
if (isBoolean(vscodeOptions_1._languagePackSupport)) { | ||
options.languagePackSupport = vscodeOptions_1._languagePackSupport; | ||
} | ||
if (isString(vscodeOptions_1._cacheRoot)) { | ||
options.cacheRoot = vscodeOptions_1._cacheRoot; | ||
} | ||
if (isString(vscodeOptions_1._languagePackId)) { | ||
options.languagePackId = vscodeOptions_1._languagePackId; | ||
} | ||
if (isString(vscodeOptions_1._translationsConfigFile)) { | ||
options.translationsConfigFile = vscodeOptions_1._translationsConfigFile; | ||
try { | ||
options.translationsConfig = readJsonFileSync(options.translationsConfigFile); | ||
} | ||
catch (error) { | ||
// We can't read the translation config file. Mark the cache as corrupted. | ||
if (vscodeOptions_1._corruptedFile) { | ||
var dirname = path.dirname(vscodeOptions_1._corruptedFile); | ||
fs.exists(dirname, function (exists) { | ||
if (exists) { | ||
fs.writeFile(vscodeOptions_1._corruptedFile, 'corrupted', 'utf8', function (err) { | ||
console.error(err); | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
catch (_a) { | ||
// Do nothing. | ||
} | ||
} | ||
common_1.setPseudo(options.locale === 'pseudo'); | ||
resolvedBundles = Object.create(null); | ||
} | ||
initializeSettings(); | ||
function supportsLanguagePack() { | ||
return options.languagePackSupport === true && options.cacheRoot !== undefined && options.languagePackId !== undefined && options.translationsConfigFile !== undefined | ||
&& options.translationsConfig !== undefined; | ||
} | ||
function createScopedLocalizeFunction(messages) { | ||
return function (key, message) { | ||
var args = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
args[_i - 2] = arguments[_i]; | ||
} | ||
if (isNumber(key)) { | ||
if (key >= messages.length) { | ||
console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: " + new Error('').stack); | ||
return; | ||
} | ||
return common_1.format(messages[key], args); | ||
} | ||
else { | ||
if (isString(message)) { | ||
console.warn("Message " + message + " didn't get externalized correctly."); | ||
return common_1.format(message, args); | ||
} | ||
else { | ||
console.error("Broken localize call found. Stacktrace is\n: " + new Error('').stack); | ||
} | ||
} | ||
}; | ||
} | ||
function resolveLanguage(file) { | ||
var resolvedLanguage; | ||
if (options.cacheLanguageResolution && resolvedLanguage) { | ||
resolvedLanguage = resolvedLanguage; | ||
} | ||
else { | ||
if (common_1.isPseudo || !options.language) { | ||
resolvedLanguage = '.nls.json'; | ||
} | ||
else { | ||
var locale = options.language; | ||
while (locale) { | ||
var candidate = '.nls.' + locale + '.json'; | ||
if (fs.existsSync(file + candidate)) { | ||
resolvedLanguage = candidate; | ||
break; | ||
} | ||
else { | ||
var index = locale.lastIndexOf('-'); | ||
if (index > 0) { | ||
locale = locale.substring(0, index); | ||
} | ||
else { | ||
resolvedLanguage = '.nls.json'; | ||
locale = null; | ||
} | ||
} | ||
} | ||
} | ||
if (options.cacheLanguageResolution) { | ||
resolvedLanguage = resolvedLanguage; | ||
} | ||
} | ||
return file + resolvedLanguage; | ||
} | ||
function findInTheBoxBundle(root) { | ||
var language = options.language; | ||
while (language) { | ||
var candidate = path.join(root, "nls.bundle." + language + ".json"); | ||
if (fs.existsSync(candidate)) { | ||
return candidate; | ||
} | ||
else { | ||
var index = language.lastIndexOf('-'); | ||
if (index > 0) { | ||
language = language.substring(0, index); | ||
} | ||
else { | ||
language = undefined; | ||
} | ||
} | ||
} | ||
// Test if we can reslove the default bundle. | ||
if (language === undefined) { | ||
var candidate = path.join(root, 'nls.bundle.json'); | ||
if (fs.existsSync(candidate)) { | ||
return candidate; | ||
} | ||
} | ||
return undefined; | ||
} | ||
function mkdir(directory) { | ||
try { | ||
fs.mkdirSync(directory); | ||
} | ||
catch (err) { | ||
if (err.code === 'EEXIST') { | ||
return; | ||
} | ||
else if (err.code === 'ENOENT') { | ||
var parent = path.dirname(directory); | ||
if (parent !== directory) { | ||
mkdir(parent); | ||
fs.mkdirSync(directory); | ||
} | ||
} | ||
else { | ||
throw err; | ||
} | ||
} | ||
} | ||
function createDefaultNlsBundle(folder) { | ||
var metaData = readJsonFileSync(path.join(folder, 'nls.metadata.json')); | ||
var result = Object.create(null); | ||
for (var module_1 in metaData) { | ||
var entry = metaData[module_1]; | ||
result[module_1] = entry.messages; | ||
} | ||
return result; | ||
} | ||
function createNLSBundle(header, metaDataPath) { | ||
var languagePackLocation = options.translationsConfig[header.id]; | ||
if (!languagePackLocation) { | ||
return undefined; | ||
} | ||
var languagePack = readJsonFileSync(languagePackLocation).contents; | ||
var metaData = readJsonFileSync(path.join(metaDataPath, 'nls.metadata.json')); | ||
var result = Object.create(null); | ||
for (var module_2 in metaData) { | ||
var entry = metaData[module_2]; | ||
var translations = languagePack[header.outDir + "/" + module_2]; | ||
if (translations) { | ||
var resultMessages = []; | ||
for (var i = 0; i < entry.keys.length; i++) { | ||
var messageKey = entry.keys[i]; | ||
var key = isString(messageKey) ? messageKey : messageKey.key; | ||
var translatedMessage = translations[key]; | ||
if (translatedMessage === undefined) { | ||
translatedMessage = entry.messages[i]; | ||
} | ||
resultMessages.push(translatedMessage); | ||
} | ||
result[module_2] = resultMessages; | ||
} | ||
else { | ||
result[module_2] = entry.messages; | ||
} | ||
} | ||
return result; | ||
} | ||
function touch(file) { | ||
var d = new Date(); | ||
fs.utimes(file, d, d, function () { | ||
// Do nothing. Ignore | ||
}); | ||
} | ||
function cacheBundle(key, bundle) { | ||
resolvedBundles[key] = bundle; | ||
return bundle; | ||
} | ||
function loadNlsBundleOrCreateFromI18n(header, bundlePath) { | ||
var result; | ||
var bundle = path.join(options.cacheRoot, header.id + "-" + header.hash + ".json"); | ||
var useMemoryOnly = false; | ||
var writeBundle = false; | ||
try { | ||
result = JSON.parse(fs.readFileSync(bundle, { encoding: 'utf8', flag: 'r' })); | ||
touch(bundle); | ||
return result; | ||
} | ||
catch (err) { | ||
if (err.code === 'ENOENT') { | ||
writeBundle = true; | ||
} | ||
else if (err instanceof SyntaxError) { | ||
// We have a syntax error. So no valid JSON. Use | ||
console.log("Syntax error parsing message bundle: " + err.message + "."); | ||
fs.unlink(bundle, function (err) { | ||
if (err) { | ||
console.error("Deleting corrupted bundle " + bundle + " failed."); | ||
} | ||
}); | ||
useMemoryOnly = true; | ||
} | ||
else { | ||
throw err; | ||
} | ||
} | ||
result = createNLSBundle(header, bundlePath); | ||
if (!result || useMemoryOnly) { | ||
return result; | ||
} | ||
if (writeBundle) { | ||
try { | ||
fs.writeFileSync(bundle, JSON.stringify(result), { encoding: 'utf8', flag: 'wx' }); | ||
} | ||
catch (err) { | ||
if (err.code === 'EEXIST') { | ||
return result; | ||
} | ||
throw err; | ||
} | ||
} | ||
return result; | ||
} | ||
function loadDefaultNlsBundle(bundlePath) { | ||
try { | ||
return createDefaultNlsBundle(bundlePath); | ||
} | ||
catch (err) { | ||
console.log("Generating default bundle from meta data failed.", err); | ||
return undefined; | ||
} | ||
} | ||
function loadNlsBundle(header, bundlePath) { | ||
var result; | ||
// Core decided to use a language pack. Do the same in the extension | ||
if (supportsLanguagePack()) { | ||
try { | ||
result = loadNlsBundleOrCreateFromI18n(header, bundlePath); | ||
} | ||
catch (err) { | ||
console.log("Load or create bundle failed ", err); | ||
} | ||
} | ||
if (!result) { | ||
// No language pack found, but core is running in language pack mode | ||
// Don't try to use old in the box bundles since the might be stale | ||
// Fall right back to the default bundle. | ||
if (options.languagePackSupport) { | ||
return loadDefaultNlsBundle(bundlePath); | ||
} | ||
var candidate = findInTheBoxBundle(bundlePath); | ||
if (candidate) { | ||
try { | ||
return readJsonFileSync(candidate); | ||
} | ||
catch (err) { | ||
console.log("Loading in the box message bundle failed.", err); | ||
} | ||
} | ||
result = loadDefaultNlsBundle(bundlePath); | ||
} | ||
return result; | ||
} | ||
function tryFindMetaDataHeaderFile(file) { | ||
var result; | ||
var dirname = path.dirname(file); | ||
while (true) { | ||
result = path.join(dirname, 'nls.metadata.header.json'); | ||
if (fs.existsSync(result)) { | ||
break; | ||
} | ||
var parent = path.dirname(dirname); | ||
if (parent === dirname) { | ||
result = undefined; | ||
break; | ||
} | ||
else { | ||
dirname = parent; | ||
} | ||
} | ||
return result; | ||
} | ||
function loadMessageBundle(file) { | ||
if (!file) { | ||
// No file. We are in dev mode. Return the default | ||
// localize function. | ||
return common_1.localize; | ||
} | ||
// Remove extension since we load json files. | ||
var ext = path.extname(file); | ||
if (ext) { | ||
file = file.substr(0, file.length - ext.length); | ||
} | ||
if (options.messageFormat === common_1.MessageFormat.both || options.messageFormat === common_1.MessageFormat.bundle) { | ||
var headerFile = tryFindMetaDataHeaderFile(file); | ||
if (headerFile) { | ||
var bundlePath = path.dirname(headerFile); | ||
var bundle = resolvedBundles[bundlePath]; | ||
if (bundle === undefined) { | ||
try { | ||
var header = JSON.parse(fs.readFileSync(headerFile, 'utf8')); | ||
try { | ||
var nlsBundle = loadNlsBundle(header, bundlePath); | ||
bundle = cacheBundle(bundlePath, nlsBundle ? { header: header, nlsBundle: nlsBundle } : null); | ||
} | ||
catch (err) { | ||
console.error('Failed to load nls bundle', err); | ||
bundle = cacheBundle(bundlePath, null); | ||
} | ||
} | ||
catch (err) { | ||
console.error('Failed to read header file', err); | ||
bundle = cacheBundle(bundlePath, null); | ||
} | ||
} | ||
if (bundle) { | ||
var module_3 = file.substr(bundlePath.length + 1).replace(/\\/g, '/'); | ||
var messages = bundle.nlsBundle[module_3]; | ||
if (messages === undefined) { | ||
console.error("Messages for file " + file + " not found. See console for details."); | ||
return function () { | ||
return 'Messages not found.'; | ||
}; | ||
} | ||
return createScopedLocalizeFunction(messages); | ||
} | ||
} | ||
} | ||
if (options.messageFormat === common_1.MessageFormat.both || options.messageFormat === common_1.MessageFormat.file) { | ||
// Try to load a single file bundle | ||
try { | ||
var json = readJsonFileSync(resolveLanguage(file)); | ||
if (Array.isArray(json)) { | ||
return createScopedLocalizeFunction(json); | ||
} | ||
else { | ||
if (common_1.isDefined(json.messages) && common_1.isDefined(json.keys)) { | ||
return createScopedLocalizeFunction(json.messages); | ||
} | ||
else { | ||
console.error("String bundle '" + file + "' uses an unsupported format."); | ||
return function () { | ||
return 'File bundle has unsupported format. See console for details'; | ||
}; | ||
} | ||
} | ||
} | ||
catch (err) { | ||
if (err.code !== 'ENOENT') { | ||
console.error('Failed to load single file bundle', err); | ||
} | ||
} | ||
} | ||
console.error("Failed to load message bundle for file " + file); | ||
return function () { | ||
return 'Failed to load message bundle. See console for details.'; | ||
}; | ||
} | ||
exports.loadMessageBundle = loadMessageBundle; | ||
function config(opts) { | ||
if (opts) { | ||
if (isString(opts.locale)) { | ||
options.locale = opts.locale.toLowerCase(); | ||
options.language = options.locale; | ||
resolvedBundles = Object.create(null); | ||
} | ||
if (opts.messageFormat !== undefined) { | ||
options.messageFormat = opts.messageFormat; | ||
} | ||
if (opts.bundleFormat === common_1.BundleFormat.standalone && options.languagePackSupport === true) { | ||
options.languagePackSupport = false; | ||
} | ||
} | ||
common_1.setPseudo(options.locale === 'pseudo'); | ||
return loadMessageBundle; | ||
} | ||
exports.config = config; | ||
ral_1.default.install(Object.freeze({ | ||
loadMessageBundle: loadMessageBundle, | ||
config: config | ||
})); | ||
(()=>{var e={46:e=>{"use strict";function t(){}function r(e,t){const o=r.spread(e,t),n=o.then((e=>e[0]));return n.cancel=o.cancel,n}!function(e){e.spread=function(e,r){let o=null;const n=new Promise(((s,a)=>{function u(){e.removeListener(r,i),e.removeListener("error",c),n.cancel=t}function i(...e){u(),s(e)}function c(e){u(),a(e)}o=u,e.on(r,i),e.on("error",c)}));if(!o)throw new TypeError("Could not get `cancel()` function");return n.cancel=o,n}}(r||(r={})),e.exports=r},54:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const n=r(614),s=o(r(374)),a=o(r(304)),u=s.default("agent-base");function i(){const{stack:e}=new Error;return"string"==typeof e&&e.split("\n").some((e=>-1!==e.indexOf("(https.js:")||-1!==e.indexOf("node:https:")))}function c(e,t){return new c.Agent(e,t)}!function(e){class t extends n.EventEmitter{constructor(e,t){super();let r=t;"function"==typeof e?this.callback=e:e&&(r=e),this.timeout=null,r&&"number"==typeof r.timeout&&(this.timeout=r.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return"number"==typeof this.explicitDefaultPort?this.explicitDefaultPort:i()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){return"string"==typeof this.explicitProtocol?this.explicitProtocol:i()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,r){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const r=Object.assign({},t);"boolean"!=typeof r.secureEndpoint&&(r.secureEndpoint=i()),null==r.host&&(r.host="localhost"),null==r.port&&(r.port=r.secureEndpoint?443:80),null==r.protocol&&(r.protocol=r.secureEndpoint?"https:":"http:"),r.host&&r.path&&delete r.path,delete r.agent,delete r.hostname,delete r._defaultAgent,delete r.defaultPort,delete r.createConnection,e._last=!0,e.shouldKeepAlive=!1;let o=!1,n=null;const s=r.timeout||this.timeout,c=t=>{e._hadError||(e.emit("error",t),e._hadError=!0)},l=()=>{n=null,o=!0;const e=new Error(`A "socket" was not created for HTTP request before ${s}ms`);e.code="ETIMEOUT",c(e)},d=e=>{o||(null!==n&&(clearTimeout(n),n=null),c(e))},f=t=>{if(o)return;if(null!=n&&(clearTimeout(n),n=null),s=t,Boolean(s)&&"function"==typeof s.addRequest)return u("Callback returned another Agent instance %o",t.constructor.name),void t.addRequest(e,r);var s;if(t)return t.once("free",(()=>{this.freeSocket(t,r)})),void e.onSocket(t);const a=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);c(a)};if("function"==typeof this.callback){this.promisifiedCallback||(this.callback.length>=3?(u("Converting legacy callback function to promise"),this.promisifiedCallback=a.default(this.callback)):this.promisifiedCallback=this.callback),"number"==typeof s&&s>0&&(n=setTimeout(l,s)),"port"in r&&"number"!=typeof r.port&&(r.port=Number(r.port));try{u("Resolving socket for %o request: %o",r.protocol,`${e.method} ${e.path}`),Promise.resolve(this.promisifiedCallback(e,r)).then(f,d)}catch(e){Promise.reject(e).catch(d)}}else c(new Error("`callback` is not defined"))}freeSocket(e,t){u("Freeing socket %o %o",e.constructor.name,t),e.destroy()}destroy(){u("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype}(c||(c={})),e.exports=c},304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r){return new Promise(((o,n)=>{e.call(this,t,r,((e,t)=>{e?n(e):o(t)}))}))}}},370:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function a(e){try{i(o.next(e))}catch(e){s(e)}}function u(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}i((o=o.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(631)),a=n(r(16)),u=n(r(835)),i=n(r(374)),c=n(r(46)),l=r(54),d=i.default("http-proxy-agent");class f extends l.Agent{constructor(e){let t;if(t="string"==typeof e?u.default.parse(e):e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");d("Creating new HttpProxyAgent instance: %o",t),super(t);const r=Object.assign({},t);var o;this.secureProxy=t.secureProxy||"string"==typeof(o=r.protocol)&&/^https:?$/i.test(o),r.host=r.hostname||r.host,"string"==typeof r.port&&(r.port=parseInt(r.port,10)),!r.port&&r.host&&(r.port=this.secureProxy?443:80),r.host&&r.path&&(delete r.path,delete r.pathname),this.proxy=r}callback(e,t){return o(this,void 0,void 0,(function*(){const{proxy:r,secureProxy:o}=this,n=u.default.parse(e.path);let i;if(n.protocol||(n.protocol="http:"),n.hostname||(n.hostname=t.hostname||t.host||null),null==n.port&&(t.port,1)&&(n.port=String(t.port)),"80"===n.port&&delete n.port,e.path=u.default.format(n),r.auth&&e.setHeader("Proxy-Authorization",`Basic ${Buffer.from(r.auth).toString("base64")}`),o?(d("Creating `tls.Socket`: %o",r),i=a.default.connect(r)):(d("Creating `net.Socket`: %o",r),i=s.default.connect(r)),e._header){let t,r;d("Regenerating stored HTTP header string for request"),e._header=null,e._implicitHeader(),e.output&&e.output.length>0?(d("Patching connection write() output buffer with updated header"),t=e.output[0],r=t.indexOf("\r\n\r\n")+4,e.output[0]=e._header+t.substring(r),d("Output buffer: %o",e.output)):e.outputData&&e.outputData.length>0&&(d("Patching connection write() output buffer with updated header"),t=e.outputData[0].data,r=t.indexOf("\r\n\r\n")+4,e.outputData[0].data=e._header+t.substring(r),d("Output buffer: %o",e.outputData[0].data))}return yield c.default(i,"connect"),i}))}}t.default=f},201:function(e,t,r){"use strict";const o=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(370));function n(e){return new o.default(e)}!function(e){e.HttpProxyAgent=o.default,e.prototype=o.default.prototype}(n||(n={})),e.exports=n},146:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function a(e){try{i(o.next(e))}catch(e){s(e)}}function u(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}i((o=o.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(631)),a=n(r(16)),u=n(r(835)),i=n(r(357)),c=n(r(374)),l=r(54),d=n(r(829)),f=c.default("https-proxy-agent:agent");class p extends l.Agent{constructor(e){let t;if(t="string"==typeof e?u.default.parse(e):e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");f("creating new HttpsProxyAgent instance: %o",t),super(t);const r=Object.assign({},t);var o;this.secureProxy=t.secureProxy||"string"==typeof(o=r.protocol)&&/^https:?$/i.test(o),r.host=r.hostname||r.host,"string"==typeof r.port&&(r.port=parseInt(r.port,10)),!r.port&&r.host&&(r.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in r)&&(r.ALPNProtocols=["http 1.1"]),r.host&&r.path&&(delete r.path,delete r.pathname),this.proxy=r}callback(e,t){return o(this,void 0,void 0,(function*(){const{proxy:r,secureProxy:o}=this;let n;o?(f("Creating `tls.Socket`: %o",r),n=a.default.connect(r)):(f("Creating `net.Socket`: %o",r),n=s.default.connect(r));const u=Object.assign({},r.headers);let c=`CONNECT ${t.host}:${t.port} HTTP/1.1\r\n`;r.auth&&(u["Proxy-Authorization"]=`Basic ${Buffer.from(r.auth).toString("base64")}`);let{host:l,port:p,secureEndpoint:g}=t;(function(e,t){return Boolean(!t&&80===e||t&&443===e)})(p,g)||(l+=`:${p}`),u.Host=l,u.Connection="close";for(const e of Object.keys(u))c+=`${e}: ${u[e]}\r\n`;const v=d.default(n);n.write(`${c}\r\n`);const{statusCode:m,buffered:y}=yield v;if(200===m){if(e.once("socket",h),t.secureEndpoint){const e=t.servername||t.host;if(!e)throw new Error('Could not determine "servername"');return f("Upgrading socket connection to TLS"),a.default.connect(Object.assign(Object.assign({},function(e,...t){const r={};let o;for(o in e)t.includes(o)||(r[o]=e[o]);return r}(t,"host","hostname","path","port")),{socket:n,servername:e}))}return n}n.destroy();const b=new s.default.Socket;return b.readable=!0,e.once("socket",(e=>{f("replaying proxy buffer for failed request"),i.default(e.listenerCount("data")>0),e.push(y),e.push(null)})),b}))}}function h(e){e.resume()}t.default=p},18:function(e,t,r){"use strict";const o=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(146));function n(e){return new o.default(e)}!function(e){e.HttpsProxyAgent=o.default,e.prototype=o.default.prototype}(n||(n={})),e.exports=n},829:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=o(r(374)).default("https-proxy-agent:parse-proxy-response");t.default=function(e){return new Promise(((t,r)=>{let o=0;const s=[];function a(){const r=e.read();r?function(e){s.push(e),o+=e.length;const r=Buffer.concat(s,o);if(-1===r.indexOf("\r\n\r\n"))return n("have not received end of HTTP headers yet..."),void a();const u=r.toString("ascii",0,r.indexOf("\r\n")),i=+u.split(" ")[1];n("got proxy server response: %o",u),t({statusCode:i,buffered:r})}(r):e.once("readable",a)}function u(e){n("onclose had error %o",e)}function i(){n("onend")}e.on("error",(function t(o){e.removeListener("end",i),e.removeListener("error",t),e.removeListener("close",u),e.removeListener("readable",a),n("onerror %o",o),r(o)})),e.on("close",u),e.on("end",i),a()}))}},539:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorStatusDescription=t.xhr=t.configure=void 0;var o=r(835),n=r(211),s=r(605),a=r(761),u=r(472),i=r(18),c=r(201);if(process.env.VSCODE_NLS_CONFIG){var l=process.env.VSCODE_NLS_CONFIG;u.config(JSON.parse(l))}var d=u.loadMessageBundle(),f=null,p=!0;function h(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.forEach((function(t){return Object.keys(t).forEach((function(r){return e[r]=t[r]}))})),e}function g(e){var t;return new Promise((function(r,a){var u=o.parse(e.url),i={hostname:u.hostname,port:u.port?parseInt(u.port):"https:"===u.protocol?443:80,path:u.path,method:e.type||"GET",headers:e.headers,rejectUnauthorized:"boolean"!=typeof e.strictSSL||e.strictSSL};e.user&&e.password&&(i.auth=e.user+":"+e.password);var c=function(o){o.statusCode>=300&&o.statusCode<400&&e.followRedirects&&e.followRedirects>0&&o.headers.location?r(g(h({},e,{url:o.headers.location,followRedirects:e.followRedirects-1}))):r({req:t,res:o})};(t="https:"===u.protocol?n.request(i,c):s.request(i,c)).on("error",a),e.timeout&&t.setTimeout(e.timeout),e.data&&t.write(e.data),t.end()}))}t.configure=function(e,t){f=e,p=t},t.xhr=function(e){var r=function(e,t){void 0===t&&(t={});var r=o.parse(e),n=t.proxyUrl||function(e){return"http:"===e.protocol?process.env.HTTP_PROXY||process.env.http_proxy||null:"https:"===e.protocol&&(process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy)||null}(r);if(!n)return null;var s=o.parse(n);if(!/^https?:$/.test(s.protocol))return null;var a={host:s.hostname,port:Number(s.port),auth:s.auth,rejectUnauthorized:"boolean"!=typeof t.strictSSL||t.strictSSL};return"http:"===r.protocol?c(a):i(a)}(e.url,{proxyUrl:f,strictSSL:p});return e=h({},e),"number"!=typeof(e=h(e,{agent:r,strictSSL:p})).followRedirects&&(e.followRedirects=5),g(e).then((function(r){return new Promise((function(o,n){var s=r.res,u=s,i=s.headers&&s.headers["content-encoding"],c=!1;if("gzip"===i){var l=a.createGunzip();s.pipe(l),u=l}else if("deflate"===i){var f=a.createInflate();s.pipe(f),u=f}var p=[];u.on("data",(function(e){return p.push(e)})),u.on("end",(function(){if(!c){if(c=!0,e.followRedirects>0&&(s.statusCode>=300&&s.statusCode<=303||307===s.statusCode)){var r=s.headers.location;if(r){var a={type:e.type,url:r,user:e.user,password:e.password,headers:e.headers,timeout:e.timeout,followRedirects:e.followRedirects-1,data:e.data};return void t.xhr(a).then(o,n)}}var u=Buffer.concat(p),i={responseText:u.toString(),body:u,status:s.statusCode,headers:s.headers||{}};s.statusCode>=200&&s.statusCode<300||1223===s.statusCode?o(i):n(i)}})),u.on("error",(function(t){var r={responseText:d("error","Unable to access {0}. Error: {1}",e.url,t.message),body:Buffer.concat(p),status:500,headers:{}};c=!0,n(r)}))}))}),(function(t){var o;return o=r?d("error.cannot.connect.proxy","Unable to connect to {0} through a proxy . Error: {1}",e.url,t.message):d("error.cannot.connect","Unable to connect to {0}. Error: {1}",e.url,t.message),Promise.reject({responseText:o,body:Buffer.concat([]),status:404,headers:{}})}))},t.getErrorStatusDescription=function(e){if(!(e<400))switch(e){case 400:return d("status.400","Bad request. The request cannot be fulfilled due to bad syntax.");case 401:return d("status.401","Unauthorized. The server is refusing to respond.");case 403:return d("status.403","Forbidden. The server is refusing to respond.");case 404:return d("status.404","Not Found. The requested location could not be found.");case 405:return d("status.405","Method not allowed. A request was made using a request method not supported by that location.");case 406:return d("status.406","Not Acceptable. The server can only generate a response that is not accepted by the client.");case 407:return d("status.407","Proxy Authentication Required. The client must first authenticate itself with the proxy.");case 408:return d("status.408","Request Timeout. The server timed out waiting for the request.");case 409:return d("status.409","Conflict. The request could not be completed because of a conflict in the request.");case 410:return d("status.410","Gone. The requested page is no longer available.");case 411:return d("status.411",'Length Required. The "Content-Length" is not defined.');case 412:return d("status.412","Precondition Failed. The precondition given in the request evaluated to false by the server.");case 413:return d("status.413","Request Entity Too Large. The server will not accept the request, because the request entity is too large.");case 414:return d("status.414","Request-URI Too Long. The server will not accept the request, because the URL is too long.");case 415:return d("status.415","Unsupported Media Type. The server will not accept the request, because the media type is not supported.");case 500:return d("status.500","Internal Server Error.");case 501:return d("status.501","Not Implemented. The server either does not recognize the request method, or it lacks the ability to fulfill the request.");case 503:return d("status.503","Service Unavailable. The server is currently unavailable (overloaded or down).");default:return d("status.416","HTTP status code {0}",e)}}},800:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.localize=t.format=t.setPseudo=t.isPseudo=t.isDefined=t.BundleFormat=t.MessageFormat=void 0;var o,n,s,a=r(926);function u(e){return void 0!==e}function i(e,r){return t.isPseudo&&(e="["+e.replace(/[aouei]/g,"$&$&")+"]"),0===r.length?e:e.replace(/\{(\d+)\}/g,(function(e,t){var o=t[0],n=r[o],s=e;return"string"==typeof n?s=n:"number"!=typeof n&&"boolean"!=typeof n&&null!=n||(s=String(n)),s}))}(s=t.MessageFormat||(t.MessageFormat={})).file="file",s.bundle="bundle",s.both="both",(n=t.BundleFormat||(t.BundleFormat={})).standalone="standalone",n.languagePack="languagePack",function(e){e.is=function(e){var t=e;return t&&u(t.key)&&u(t.comment)}}(o||(o={})),t.isDefined=u,t.isPseudo=!1,t.setPseudo=function(e){t.isPseudo=e},t.format=i,t.localize=function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return i(t,r)},t.loadMessageBundle=function(e){return a.default().loadMessageBundle(e)},t.config=function(e){return a.default().config(e)}},926:(e,t)=>{"use strict";var r;function o(){if(void 0===r)throw new Error("No runtime abstraction layer installed");return r}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");r=e}}(o||(o={})),t.default=o},472:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=void 0;var o=r(622),n=r(747),s=r(926),a=r(800),u=r(800);Object.defineProperty(t,"MessageFormat",{enumerable:!0,get:function(){return u.MessageFormat}}),Object.defineProperty(t,"BundleFormat",{enumerable:!0,get:function(){return u.BundleFormat}});var i,c,l=Object.prototype.toString;function d(e){return"[object Number]"===l.call(e)}function f(e){return"[object String]"===l.call(e)}function p(e){return JSON.parse(n.readFileSync(e,"utf8"))}function h(e){return function(t,r){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];return d(t)?t>=e.length?void console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: "+new Error("").stack):a.format(e[t],o):f(r)?(console.warn("Message "+r+" didn't get externalized correctly."),a.format(r,o)):void console.error("Broken localize call found. Stacktrace is\n: "+new Error("").stack)}}function g(e,t){return i[e]=t,t}function v(e){try{return function(e){var t=p(o.join(e,"nls.metadata.json")),r=Object.create(null);for(var n in t){var s=t[n];r[n]=s.messages}return r}(e)}catch(e){return void console.log("Generating default bundle from meta data failed.",e)}}function m(e,t){var r;if(!0===c.languagePackSupport&&void 0!==c.cacheRoot&&void 0!==c.languagePackId&&void 0!==c.translationsConfigFile&&void 0!==c.translationsConfig)try{r=function(e,t){var r,s,a,u=o.join(c.cacheRoot,e.id+"-"+e.hash+".json"),i=!1,l=!1;try{return r=JSON.parse(n.readFileSync(u,{encoding:"utf8",flag:"r"})),s=u,a=new Date,n.utimes(s,a,a,(function(){})),r}catch(e){if("ENOENT"===e.code)l=!0;else{if(!(e instanceof SyntaxError))throw e;console.log("Syntax error parsing message bundle: "+e.message+"."),n.unlink(u,(function(e){e&&console.error("Deleting corrupted bundle "+u+" failed.")})),i=!0}}if(!(r=function(e,t){var r=c.translationsConfig[e.id];if(r){var n=p(r).contents,s=p(o.join(t,"nls.metadata.json")),a=Object.create(null);for(var u in s){var i=s[u],l=n[e.outDir+"/"+u];if(l){for(var d=[],h=0;h<i.keys.length;h++){var g=i.keys[h],v=l[f(g)?g:g.key];void 0===v&&(v=i.messages[h]),d.push(v)}a[u]=d}else a[u]=i.messages}return a}}(e,t))||i)return r;if(l)try{n.writeFileSync(u,JSON.stringify(r),{encoding:"utf8",flag:"wx"})}catch(e){if("EEXIST"===e.code)return r;throw e}return r}(e,t)}catch(e){console.log("Load or create bundle failed ",e)}if(!r){if(c.languagePackSupport)return v(t);var s=function(e){for(var t=c.language;t;){var r=o.join(e,"nls.bundle."+t+".json");if(n.existsSync(r))return r;var s=t.lastIndexOf("-");t=s>0?t.substring(0,s):void 0}if(void 0===t&&(r=o.join(e,"nls.bundle.json"),n.existsSync(r)))return r}(t);if(s)try{return p(s)}catch(e){console.log("Loading in the box message bundle failed.",e)}r=v(t)}return r}function y(e){if(!e)return a.localize;var t=o.extname(e);if(t&&(e=e.substr(0,e.length-t.length)),c.messageFormat===a.MessageFormat.both||c.messageFormat===a.MessageFormat.bundle){var r=function(e){for(var t,r=o.dirname(e);t=o.join(r,"nls.metadata.header.json"),!n.existsSync(t);){var s=o.dirname(r);if(s===r){t=void 0;break}r=s}return t}(e);if(r){var s=o.dirname(r),u=i[s];if(void 0===u)try{var l=JSON.parse(n.readFileSync(r,"utf8"));try{var d=m(l,s);u=g(s,d?{header:l,nlsBundle:d}:null)}catch(e){console.error("Failed to load nls bundle",e),u=g(s,null)}}catch(e){console.error("Failed to read header file",e),u=g(s,null)}if(u){var f=e.substr(s.length+1).replace(/\\/g,"/"),v=u.nlsBundle[f];return void 0===v?(console.error("Messages for file "+e+" not found. See console for details."),function(){return"Messages not found."}):h(v)}}}if(c.messageFormat===a.MessageFormat.both||c.messageFormat===a.MessageFormat.file)try{var y=p(function(e){var t;if(c.cacheLanguageResolution&&t)t=t;else{if(a.isPseudo||!c.language)t=".nls.json";else for(var r=c.language;r;){var o=".nls."+r+".json";if(n.existsSync(e+o)){t=o;break}var s=r.lastIndexOf("-");s>0?r=r.substring(0,s):(t=".nls.json",r=null)}c.cacheLanguageResolution&&(t=t)}return e+t}(e));return Array.isArray(y)?h(y):a.isDefined(y.messages)&&a.isDefined(y.keys)?h(y.messages):(console.error("String bundle '"+e+"' uses an unsupported format."),function(){return"File bundle has unsupported format. See console for details"})}catch(e){"ENOENT"!==e.code&&console.error("Failed to load single file bundle",e)}return console.error("Failed to load message bundle for file "+e),function(){return"Failed to load message bundle. See console for details."}}function b(e){return e&&(f(e.locale)&&(c.locale=e.locale.toLowerCase(),c.language=c.locale,i=Object.create(null)),void 0!==e.messageFormat&&(c.messageFormat=e.messageFormat),e.bundleFormat===a.BundleFormat.standalone&&!0===c.languagePackSupport&&(c.languagePackSupport=!1)),a.setPseudo("pseudo"===c.locale),y}!function(){if(c={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:a.MessageFormat.bundle},f(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0;if(e.availableLanguages){var r=e.availableLanguages["*"];f(r)&&(t=r)}if(f(e.locale)&&(c.locale=e.locale.toLowerCase()),void 0===t?c.language=c.locale:"en"!==t&&(c.language=t),function(e){return!0===e||!1===e}(e._languagePackSupport)&&(c.languagePackSupport=e._languagePackSupport),f(e._cacheRoot)&&(c.cacheRoot=e._cacheRoot),f(e._languagePackId)&&(c.languagePackId=e._languagePackId),f(e._translationsConfigFile)){c.translationsConfigFile=e._translationsConfigFile;try{c.translationsConfig=p(c.translationsConfigFile)}catch(t){if(e._corruptedFile){var s=o.dirname(e._corruptedFile);n.exists(s,(function(t){t&&n.writeFile(e._corruptedFile,"corrupted","utf8",(function(e){console.error(e)}))}))}}}}catch(e){}a.setPseudo("pseudo"===c.locale),i=Object.create(null)}(),t.loadMessageBundle=y,t.config=b,s.default.install(Object.freeze({loadMessageBundle:y,config:b}))},374:(e,t)=>{function r(){}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return r}},357:e=>{"use strict";e.exports=require("assert")},614:e=>{"use strict";e.exports=require("events")},747:e=>{"use strict";e.exports=require("fs")},605:e=>{"use strict";e.exports=require("http")},211:e=>{"use strict";e.exports=require("https")},631:e=>{"use strict";e.exports=require("net")},622:e=>{"use strict";e.exports=require("path")},16:e=>{"use strict";e.exports=require("tls")},835:e=>{"use strict";e.exports=require("url")},761:e=>{"use strict";e.exports=require("zlib")}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}(539),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); |
{ | ||
"name": "request-light", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Lightweight request library. Promise based, with proxy support.", | ||
@@ -36,5 +36,4 @@ "main": "./lib/node/main.js", | ||
"package": "webpack --mode production --devtool hidden-source-map", | ||
"prepublishOnly": "npm run clean && npm run compile && npm run remove-sourcemap-refs", | ||
"prepublishOnly": "npm run clean && npm run package && tsc -p ./src/test/ && ava ./lib/test/test.js", | ||
"clean": "rimraf lib", | ||
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js", | ||
"postversion": "git push && git push --tags", | ||
@@ -41,0 +40,0 @@ "test": "npm run compile && tsc -p ./src/test/ && ava ./lib/test/test.js" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
28224
30
3
11
6