Merge from vscode 0a7364f00514c46c9caceece15e1f82f82e3712f

This commit is contained in:
ADS Merger
2020-07-22 03:06:57 +00:00
parent 53ec7585a9
commit 1b7b54ce14
229 changed files with 5099 additions and 3188 deletions

37
src/bootstrap.js vendored
View File

@@ -16,7 +16,11 @@
// Browser
else {
globalThis.MonacoBootstrap = factory();
try {
globalThis.MonacoBootstrap = factory();
} catch (error) {
console.warn(error); // expected when e.g. running with sandbox: true (TODO@sandbox eventually consolidate this)
}
}
}(this, function () {
const Module = require('module');
@@ -40,10 +44,10 @@
//#region Add support for using node_modules.asar
/**
* @param {string=} nodeModulesPath
* @param {string} appRoot
*/
function enableASARSupport(nodeModulesPath) {
let NODE_MODULES_PATH = nodeModulesPath;
function enableASARSupport(appRoot) {
let NODE_MODULES_PATH = appRoot ? path.join(appRoot, 'node_modules') : undefined;
if (!NODE_MODULES_PATH) {
NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
} else {
@@ -83,7 +87,7 @@
* @param {string} _path
* @returns {string}
*/
function uriFromPath(_path) {
function fileUriFromPath(_path) {
let pathName = path.resolve(_path).replace(/\\/g, '/');
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
pathName = `/${pathName}`;
@@ -132,7 +136,7 @@
}
const bundleFile = path.join(nlsConfig._resolvedLanguagePackCoreLocation, `${bundle.replace(/\//g, '!')}.nls.json`);
readFile(bundleFile).then(function (content) {
fs.promises.readFile(bundleFile, 'utf8').then(function (content) {
const json = JSON.parse(content);
bundles[bundle] = json;
@@ -140,7 +144,7 @@
}).catch((error) => {
try {
if (nlsConfig._corruptedFile) {
writeFile(nlsConfig._corruptedFile, 'corrupted').catch(function (error) { console.error(error); });
fs.promises.writeFile(nlsConfig._corruptedFile, 'corrupted', 'utf8').catch(function (error) { console.error(error); });
}
} finally {
cb(error, undefined);
@@ -152,23 +156,6 @@
return nlsConfig;
}
/**
* @param {string} file
* @returns {Promise<string>}
*/
function readFile(file) {
return fs.promises.readFile(file, 'utf8');
}
/**
* @param {string} file
* @param {string} content
* @returns {Promise<void>}
*/
function writeFile(file, content) {
return fs.promises.writeFile(file, content, 'utf8');
}
//#endregion
@@ -254,6 +241,6 @@
avoidMonkeyPatchFromAppInsights,
configurePortable,
setupNLS,
uriFromPath
fileUriFromPath
};
}));