mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
29
src/bootstrap.js
vendored
29
src/bootstrap.js
vendored
@@ -13,7 +13,6 @@ Error.stackTraceLimit = 100;
|
||||
|
||||
// Workaround for Electron not installing a handler to ignore SIGPIPE
|
||||
// (https://github.com/electron/electron/issues/13254)
|
||||
// @ts-ignore
|
||||
process.on('SIGPIPE', () => {
|
||||
console.error(new Error('Unexpected SIGPIPE'));
|
||||
});
|
||||
@@ -27,7 +26,6 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
|
||||
throw new Error('Missing injectPath');
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
const Module = require('module');
|
||||
const path = require('path');
|
||||
|
||||
@@ -51,12 +49,12 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
|
||||
return paths;
|
||||
};
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Remove global paths from the node lookup paths
|
||||
|
||||
exports.removeGlobalNodeModuleLookupPaths = function() {
|
||||
// @ts-ignore
|
||||
exports.removeGlobalNodeModuleLookupPaths = function () {
|
||||
const Module = require('module');
|
||||
// @ts-ignore
|
||||
const globalPaths = Module.globalPaths;
|
||||
@@ -74,15 +72,15 @@ exports.removeGlobalNodeModuleLookupPaths = function() {
|
||||
return paths.slice(0, paths.length - commonSuffixLength);
|
||||
};
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Add support for using node_modules.asar
|
||||
|
||||
/**
|
||||
* @param {string=} nodeModulesPath
|
||||
*/
|
||||
exports.enableASARSupport = function (nodeModulesPath) {
|
||||
|
||||
// @ts-ignore
|
||||
const Module = require('module');
|
||||
const path = require('path');
|
||||
|
||||
@@ -111,9 +109,11 @@ exports.enableASARSupport = function (nodeModulesPath) {
|
||||
return paths;
|
||||
};
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region URI helpers
|
||||
|
||||
/**
|
||||
* @param {string} _path
|
||||
* @returns {string}
|
||||
@@ -136,9 +136,11 @@ exports.uriFromPath = function (_path) {
|
||||
|
||||
return uri.replace(/#/g, '%23');
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region FS helpers
|
||||
|
||||
/**
|
||||
* @param {string} file
|
||||
* @returns {Promise<string>}
|
||||
@@ -185,9 +187,11 @@ exports.mkdirp = function mkdirp(dir) {
|
||||
|
||||
return new Promise((c, e) => fs.mkdir(dir, { recursive: true }, err => (err && err.code !== 'EEXIST') ? e(err) : c(dir)));
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region NLS helpers
|
||||
|
||||
/**
|
||||
* @returns {{locale?: string, availableLanguages: {[lang: string]: string;}, pseudo?: boolean }}
|
||||
*/
|
||||
@@ -235,14 +239,15 @@ exports.setupNLS = function () {
|
||||
|
||||
return nlsConfig;
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Portable helpers
|
||||
|
||||
/**
|
||||
* @returns {{ portableDataPath: string, isPortable: boolean }}
|
||||
*/
|
||||
exports.configurePortable = function () {
|
||||
// @ts-ignore
|
||||
const product = require('../product.json');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
@@ -270,6 +275,7 @@ exports.configurePortable = function () {
|
||||
return path.join(getApplicationPath(), 'data');
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
const portableDataName = product.portable || `${product.applicationName}-portable-data`;
|
||||
return path.join(path.dirname(getApplicationPath()), portableDataName);
|
||||
}
|
||||
@@ -299,16 +305,17 @@ exports.configurePortable = function () {
|
||||
isPortable
|
||||
};
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region ApplicationInsights
|
||||
/**
|
||||
* Prevents appinsights from monkey patching modules.
|
||||
* This should be called before importing the applicationinsights module
|
||||
*/
|
||||
|
||||
// Prevents appinsights from monkey patching modules.
|
||||
// This should be called before importing the applicationinsights module
|
||||
exports.avoidMonkeyPatchFromAppInsights = function () {
|
||||
// @ts-ignore
|
||||
process.env['APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL'] = true; // Skip monkey patching of 3rd party modules by appinsights
|
||||
global['diagnosticsSource'] = {}; // Prevents diagnostic channel (which patches "require") from initializing entirely
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user