Merge from vscode merge-base (#22769)

* Merge from vscode merge-base

* Turn off basic checks

* Enable compilation, unit, and integration tests
This commit is contained in:
Lewis Sanchez
2023-04-18 18:28:58 -07:00
committed by GitHub
parent 6186358001
commit 6bd0a17d3c
2389 changed files with 92183 additions and 42601 deletions

View File

@@ -10,7 +10,7 @@ import * as tss from './treeshaking';
const REPO_ROOT = path.join(__dirname, '../../');
const SRC_DIR = path.join(REPO_ROOT, 'src');
let dirCache: { [dir: string]: boolean } = {};
const dirCache: { [dir: string]: boolean } = {};
function writeFile(filePath: string, contents: Buffer | string): void {
function ensureDirs(dirPath: string): void {
@@ -63,13 +63,13 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
});
}
let result = tss.shake(options);
for (let fileName in result) {
const result = tss.shake(options);
for (const fileName in result) {
if (result.hasOwnProperty(fileName)) {
writeFile(path.join(options.destRoot, fileName), result[fileName]);
}
}
let copied: { [fileName: string]: boolean } = {};
const copied: { [fileName: string]: boolean } = {};
const copyFile = (fileName: string) => {
if (copied[fileName]) {
return;
@@ -82,7 +82,7 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
const writeOutputFile = (fileName: string, contents: string | Buffer) => {
writeFile(path.join(options.destRoot, fileName), contents);
};
for (let fileName in result) {
for (const fileName in result) {
if (result.hasOwnProperty(fileName)) {
const fileContents = result[fileName];
const info = ts.preProcessFile(fileContents);
@@ -115,13 +115,12 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
[
'vs/css.build.js',
'vs/css.d.ts',
'vs/css.js',
'vs/css.build.ts',
'vs/css.ts',
'vs/loader.js',
'vs/nls.build.js',
'vs/nls.d.ts',
'vs/nls.js',
'vs/loader.d.ts',
'vs/nls.build.ts',
'vs/nls.ts',
'vs/nls.mock.ts',
].forEach(copyFile);
}
@@ -142,7 +141,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
const OUT_RESOURCES_FOLDER = path.join(REPO_ROOT, options.outResourcesFolder);
const getDestAbsoluteFilePath = (file: string): string => {
let dest = options.renames[file.replace(/\\/g, '/')] || file;
const dest = options.renames[file.replace(/\\/g, '/')] || file;
if (dest === 'tsconfig.json') {
return path.join(OUT_FOLDER, `tsconfig.json`);
}
@@ -229,7 +228,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
if (dir.charAt(dir.length - 1) !== '/' || dir.charAt(dir.length - 1) !== '\\') {
dir += '/';
}
let result: string[] = [];
const result: string[] = [];
_walkDirRecursive(dir, result, dir.length);
return result;
}
@@ -253,7 +252,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
writeFile(absoluteFilePath, contents);
function toggleComments(fileContents: string): string {
let lines = fileContents.split(/\r\n|\r|\n/);
const lines = fileContents.split(/\r\n|\r|\n/);
let mode = 0;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
@@ -325,14 +324,14 @@ function transportCSS(module: string, enqueue: (module: string) => void, write:
if (!forceBase64 && /\.svg$/.test(url)) {
// .svg => url encode as explained at https://codepen.io/tigt/post/optimizing-svgs-in-data-uris
let newText = fileContents.toString()
const newText = fileContents.toString()
.replace(/"/g, '\'')
.replace(/</g, '%3C')
.replace(/>/g, '%3E')
.replace(/&/g, '%26')
.replace(/#/g, '%23')
.replace(/\s+/g, ' ');
let encodedData = ',' + newText;
const encodedData = ',' + newText;
if (encodedData.length < DATA.length) {
DATA = encodedData;
}