mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
@@ -17,6 +17,7 @@ const minimatch = require('minimatch');
|
||||
const coverage = require('../coverage');
|
||||
const minimist = require('minimist');
|
||||
const { takeSnapshotAndCountClasses } = require('../analyzeSnapshot');
|
||||
const bootstrapNode = require('../../../src/bootstrap-node');
|
||||
|
||||
/**
|
||||
* @type {{ build: boolean; run: string; runGlob: string; coverage: boolean; help: boolean; coverageFormats: string | string[]; coveragePath: string; }}
|
||||
@@ -88,7 +89,6 @@ function main() {
|
||||
// when running from `out-build`, ensure to load the default
|
||||
// messages file, because all `nls.localize` calls have their
|
||||
// english values removed and replaced by an index.
|
||||
// VSCODE_GLOBALS: NLS
|
||||
globalThis._VSCODE_NLS_MESSAGES = require(`../../../${out}/nls.messages.json`);
|
||||
}
|
||||
|
||||
@@ -106,41 +106,9 @@ function main() {
|
||||
console.error(e.stack || e);
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @param {{ isWindows?: boolean, scheme?: string, fallbackAuthority?: string }} config
|
||||
* @returns {string}
|
||||
*/
|
||||
function fileUriFromPath(path, config) {
|
||||
|
||||
// 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) !== '/') {
|
||||
pathName = `/${pathName}`;
|
||||
}
|
||||
|
||||
/** @type {string} */
|
||||
let uri;
|
||||
|
||||
// Windows: in order to support UNC paths (which start with '//')
|
||||
// that have their own authority, we do not use the provided authority
|
||||
// but rather preserve it.
|
||||
if (config.isWindows && pathName.startsWith('//')) {
|
||||
uri = encodeURI(`${config.scheme || 'file'}:${pathName}`);
|
||||
}
|
||||
|
||||
// Otherwise we optionally add the provided authority if specified
|
||||
else {
|
||||
uri = encodeURI(`${config.scheme || 'file'}://${config.fallbackAuthority || ''}${pathName}`);
|
||||
}
|
||||
|
||||
return uri.replace(/#/g, '%23');
|
||||
}
|
||||
|
||||
const loaderConfig = {
|
||||
nodeRequire: require,
|
||||
baseUrl: fileUriFromPath(src, { isWindows: process.platform === 'win32' }),
|
||||
baseUrl: bootstrapNode.fileUriFromPath(src, { isWindows: process.platform === 'win32' }),
|
||||
catchError: true
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user