-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5096 from Tyriar/tyriar/esbuild4
Integrate base/ platform from VS Code and adopt scroll bar
- Loading branch information
Showing
97 changed files
with
19,838 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// @ts-check | ||
|
||
const { dirname } = require("path"); | ||
const ts = require("typescript"); | ||
const fs = require("fs"); | ||
|
||
function findUnusedSymbols( | ||
/** @type string */ tsconfigPath | ||
) { | ||
// Initialize a program using the project's tsconfig.json | ||
const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); | ||
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname(tsconfigPath)); | ||
|
||
// Initialize a program with the parsed configuration | ||
const program = ts.createProgram(parsedConfig.fileNames, { | ||
...parsedConfig.options, | ||
noUnusedLocals: true | ||
}); | ||
const sourceFiles = program.getSourceFiles(); | ||
const usedBaseSourceFiles = sourceFiles.filter(e => e.fileName.includes('src/vs/base/')); | ||
const usedFilesInBase = usedBaseSourceFiles.map(e => e.fileName.replace(/^.+\/src\//, 'src/')).sort((a, b) => a.localeCompare(b)); | ||
// console.log('Source files used in src/vs/base/:', used); | ||
|
||
// Get an array of all files that exist in src/vs/base/ | ||
const allFilesInBase = ( | ||
fs.readdirSync('src/vs/base', { recursive: true, withFileTypes: true }) | ||
.filter(e => e.isFile()) | ||
// @ts-ignore HACK: This is only available in Node 20 | ||
.map(e => `${e.parentPath}/${e.name}`.replace(/\\/g, '/')) | ||
); | ||
const unusedFilesInBase = allFilesInBase.filter(e => !usedFilesInBase.includes(e)); | ||
|
||
console.log({ | ||
allFilesInBase, | ||
usedFilesInBase, | ||
unusedFilesInBase | ||
}); | ||
} | ||
|
||
// Example usage | ||
findUnusedSymbols("./src/browser/tsconfig.json"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Get latest vscode repo | ||
if (Test-Path -Path "src/vs/temp") { | ||
Write-Host "`e[32m> Fetching latest`e[0m" | ||
git -C src/vs/temp checkout | ||
git -C src/vs/temp pull | ||
} else { | ||
Write-Host "`e[32m> Cloning microsoft/vscode`e[0m" | ||
$null = New-Item -ItemType Directory -Path "src/vs/temp" -Force | ||
git clone https://github.com/microsoft/vscode src/vs/temp | ||
} | ||
|
||
# Delete old base | ||
Write-Host "`e[32m> Deleting old base`e[0m" | ||
$null = Remove-Item -Recurse -Force "src/vs/base" | ||
|
||
# Copy base | ||
Write-Host "`e[32m> Copying base`e[0m" | ||
Copy-Item -Path "src/vs/temp/src/vs/base" -Destination "src/vs/base" -Recurse | ||
|
||
# Comment out any CSS imports | ||
Write-Host "`e[32m> Commenting out CSS imports" -NoNewline | ||
$baseFiles = Get-ChildItem -Path "src/vs/base" -Recurse -File | ||
$count = 0 | ||
foreach ($file in $baseFiles) { | ||
$content = Get-Content -Path $file.FullName | ||
$updatedContent = $content | ForEach-Object { | ||
if ($_ -match "^import 'vs/css!") { | ||
Write-Host "`e[32m." -NoNewline | ||
$count++ | ||
"// $_" | ||
} else { | ||
$_ | ||
} | ||
} | ||
$updatedContent | Set-Content -Path $file.FullName | ||
} | ||
Write-Host " $count files patched`e[0m" | ||
|
||
# Replace `monaco-*` with `xterm-*`, this will help avoid any styling conflicts when monaco and | ||
# xterm.js are used in the same project. | ||
Write-Host "`e[32m> Replacing monaco-* class names with xterm-* `e[0m" -NoNewline | ||
$baseFiles = Get-ChildItem -Path "src/vs/base" -Recurse -File | ||
$count = 0 | ||
foreach ($file in $baseFiles) { | ||
$content = Get-Content -Path $file.FullName | ||
if ($content -match "monaco-([a-zA-Z\-]+)") { | ||
$updatedContent = $content -replace "monaco-([a-zA-Z\-]+)", 'xterm-$1' | ||
Write-Host "`e[32m." -NoNewline | ||
$count++ | ||
$updatedContent | Set-Content -Path $file.FullName | ||
} | ||
} | ||
Write-Host " $count files patched`e[0m" | ||
|
||
# Copy typings | ||
Write-Host "`e[32m> Copying typings`e[0m" | ||
Copy-Item -Path "src/vs/temp/src/typings" -Destination "src/vs" -Recurse -Force | ||
|
||
# Deleting unwanted typings | ||
Write-Host "`e[32m> Deleting unwanted typings`e[0m" | ||
$null = Remove-Item -Path "src/vs/typings/vscode-globals-modules.d.ts" -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.