mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-05 01:25:38 -05:00
VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)
* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9 * delete unused folders * distro * Bump build node version * update chokidar * FIx hygiene errors * distro * Fix extension lint issues * Remove strict-vscode * Add copyright header exemptions * Bump vscode-extension-telemetry to fix webpacking issue with zone.js * distro * Fix failing tests (revert marked.js back to current one until we decide to update) * Skip searchmodel test * Fix mac build * temp debug script loading * Try disabling coverage * log error too * Revert "log error too" This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f. * Revert "temp debug script loading" This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c. * Add comments explaining coverage disabling * Fix ansi_up loading issue * Merge latest from ads * Use newer option * Fix compile * add debug logging warn * Always log stack * log more * undo debug * Update to use correct base path (+cleanup) * distro * fix compile errors * Remove strict-vscode * Fix sql editors not showing * Show db dropdown input & fix styling * Fix more info in gallery * Fix gallery asset requests * Delete unused workflow * Fix tapable resolutions for smoke test compile error * Fix smoke compile * Disable crash reporting * Disable interactive Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
48
src/bootstrap.js
vendored
48
src/bootstrap.js
vendored
@@ -42,25 +42,42 @@
|
||||
//#region Add support for using node_modules.asar
|
||||
|
||||
/**
|
||||
* @param {string | undefined} appRoot
|
||||
* TODO@sandbox remove the support for passing in `appRoot` once
|
||||
* sandbox is fully enabled
|
||||
*
|
||||
* @param {string=} appRoot
|
||||
*/
|
||||
function enableASARSupport(appRoot) {
|
||||
if (!path || !Module || typeof process === 'undefined') {
|
||||
console.warn('enableASARSupport() is only available in node.js environments'); // TODO@sandbox ASAR is currently non-sandboxed only
|
||||
console.warn('enableASARSupport() is only available in node.js environments');
|
||||
return;
|
||||
}
|
||||
|
||||
let NODE_MODULES_PATH = appRoot ? path.join(appRoot, 'node_modules') : undefined;
|
||||
if (!NODE_MODULES_PATH) {
|
||||
NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
|
||||
} else {
|
||||
// use the drive letter casing of __dirname
|
||||
if (process.platform === 'win32') {
|
||||
NODE_MODULES_PATH = __dirname.substr(0, 1) + NODE_MODULES_PATH.substr(1);
|
||||
const NODE_MODULES_PATH = appRoot ? path.join(appRoot, 'node_modules') : path.join(__dirname, '../node_modules');
|
||||
|
||||
// Windows only:
|
||||
// use both lowercase and uppercase drive letter
|
||||
// as a way to ensure we do the right check on
|
||||
// the node modules path: node.js might internally
|
||||
// use a different case compared to what we have
|
||||
let NODE_MODULES_ALTERNATIVE_PATH;
|
||||
if (appRoot /* only used from renderer until `sandbox` enabled */ && process.platform === 'win32') {
|
||||
const driveLetter = appRoot.substr(0, 1);
|
||||
|
||||
let alternativeDriveLetter;
|
||||
if (driveLetter.toLowerCase() !== driveLetter) {
|
||||
alternativeDriveLetter = driveLetter.toLowerCase();
|
||||
} else {
|
||||
alternativeDriveLetter = driveLetter.toUpperCase();
|
||||
}
|
||||
|
||||
NODE_MODULES_ALTERNATIVE_PATH = alternativeDriveLetter + NODE_MODULES_PATH.substr(1);
|
||||
} else {
|
||||
NODE_MODULES_ALTERNATIVE_PATH = undefined;
|
||||
}
|
||||
|
||||
const NODE_MODULES_ASAR_PATH = `${NODE_MODULES_PATH}.asar`;
|
||||
const NODE_MODULES_ASAR_ALTERNATIVE_PATH = NODE_MODULES_ALTERNATIVE_PATH ? `${NODE_MODULES_ALTERNATIVE_PATH}.asar` : undefined;
|
||||
|
||||
// @ts-ignore
|
||||
const originalResolveLookupPaths = Module._resolveLookupPaths;
|
||||
@@ -69,12 +86,23 @@
|
||||
Module._resolveLookupPaths = function (request, parent) {
|
||||
const paths = originalResolveLookupPaths(request, parent);
|
||||
if (Array.isArray(paths)) {
|
||||
let asarPathAdded = false;
|
||||
for (let i = 0, len = paths.length; i < len; i++) {
|
||||
if (paths[i] === NODE_MODULES_PATH) {
|
||||
asarPathAdded = true;
|
||||
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
|
||||
break;
|
||||
} else if (paths[i] === NODE_MODULES_ALTERNATIVE_PATH) {
|
||||
asarPathAdded = true;
|
||||
paths.splice(i, 0, NODE_MODULES_ASAR_ALTERNATIVE_PATH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!asarPathAdded && appRoot) {
|
||||
// Assuming that adding just `NODE_MODULES_ASAR_PATH` is sufficient
|
||||
// because nodejs should find it even if it has a different driver letter case
|
||||
paths.push(NODE_MODULES_ASAR_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
@@ -93,7 +121,7 @@
|
||||
*/
|
||||
function fileUriFromPath(path, config) {
|
||||
|
||||
// Since we are building a URI, we normalize any backlsash
|
||||
// Since we are building a URI, we normalize any backslash
|
||||
// to slashes and we ensure that the path begins with a '/'.
|
||||
let pathName = path.replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
|
||||
Reference in New Issue
Block a user