debt - enlist most JS files in tsconfig.json (#216566)

This commit is contained in:
Benjamin Pasero 2024-06-19 08:35:55 +02:00 committed by GitHub
parent c2e20cb17f
commit 83f03bbb7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 38 additions and 109 deletions

View File

@ -68,7 +68,8 @@ const CORE_TYPES = [
'fetch',
'RequestInit',
'Headers',
'Response'
'Response',
'__global'
];
// Types that are defined in a common layer but are known to be only
// available in native environments should not be allowed in browser
@ -170,59 +171,17 @@ const RULES = [
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extHostTypes.ts
// Common: vs/base/parts/sandbox/electron-sandbox/preload.js
{
target: '**/vs/workbench/api/common/extHostTypes.ts',
target: '**/vs/base/parts/sandbox/electron-sandbox/preload.js',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
// Safe access to a very small subset of node.js
'process',
'NodeJS'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extHostChatAgents2.ts
{
target: '**/vs/workbench/api/common/extHostChatAgents2.ts',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extHostChatVariables.ts
{
target: '**/vs/workbench/api/common/extHostChatVariables.ts',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extensionHostMain.ts
{
target: '**/vs/workbench/api/common/extensionHostMain.ts',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},

View File

@ -69,7 +69,8 @@ const CORE_TYPES = [
'fetch',
'RequestInit',
'Headers',
'Response'
'Response',
'__global'
];
// Types that are defined in a common layer but are known to be only
@ -185,66 +186,18 @@ const RULES: IRule[] = [
]
},
// Common: vs/workbench/api/common/extHostTypes.ts
// Common: vs/base/parts/sandbox/electron-sandbox/preload.js
{
target: '**/vs/workbench/api/common/extHostTypes.ts',
target: '**/vs/base/parts/sandbox/electron-sandbox/preload.js',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
// Safe access to a very small subset of node.js
'process',
'NodeJS'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extHostChatAgents2.ts
{
target: '**/vs/workbench/api/common/extHostChatAgents2.ts',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extHostChatVariables.ts
{
target: '**/vs/workbench/api/common/extHostChatVariables.ts',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},
// Common: vs/workbench/api/common/extensionHostMain.ts
{
target: '**/vs/workbench/api/common/extensionHostMain.ts',
allowedTypes: [
...CORE_TYPES,
// Safe access to global
'__global'
],
disallowedTypes: NATIVE_TYPES,
disallowedDefinitions: [
'lib.dom.d.ts', // no DOM
'@types/node' // no node.js
]
},

View File

@ -34,6 +34,17 @@
"./main.js",
"./server-main.js",
"./server-cli.js",
"./vs/base/common/jsonc.js",
"./vs/base/common/performance.js",
"./vs/base/node/unc.js",
"./vs/base/node/languagePacks.js",
"./vs/platform/environment/node/userDataPath.js",
"./vs/base/parts/sandbox/electron-sandbox/preload-aux.js",
"./vs/base/parts/sandbox/electron-sandbox/preload.js",
"./vs/code/electron-sandbox/processExplorer/processExplorer.js",
"./vs/code/electron-sandbox/workbench/workbench.js",
"./vs/workbench/contrib/issue/electron-sandbox/issueReporter.js",
"./vs/workbench/contrib/webview/browser/pre/service-worker.js",
"./typings",
"./vs/**/*.ts",
"vscode-dts/vscode.proposed.*.d.ts",

View File

@ -10,6 +10,7 @@
]
},
"exclude": [
"./vs/workbench/contrib/webview/browser/pre/service-worker.js",
"*/test/*",
"**/*.test.ts"
]

View File

@ -26,7 +26,7 @@
* @returns {{
* load: (
* modules: string[],
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
* resultCallback: (result: any, configuration: ISandboxConfiguration) => unknown,
* options?: {
* configureDeveloperSettings?: (config: ISandboxConfiguration) => {
* forceEnableDeveloperKeybindings?: boolean,

View File

@ -45,6 +45,7 @@
showSplash(windowConfig);
},
beforeLoaderConfig: function (loaderConfig) {
// @ts-ignore
loaderConfig.recordStats = true;
},
beforeRequire: function (windowConfig) {
@ -81,7 +82,7 @@
* @returns {{
* load: (
* modules: string[],
* resultCallback: (result, configuration: INativeWindowConfiguration & NativeParsedArgs) => unknown,
* resultCallback: (result: any, configuration: INativeWindowConfiguration & NativeParsedArgs) => unknown,
* options?: {
* configureDeveloperSettings?: (config: INativeWindowConfiguration & NativeParsedArgs) => {
* forceDisableShowDevtoolsOnError?: boolean,
@ -129,7 +130,9 @@
}
// minimal color configuration (works with or without persisted data)
let baseTheme, shellBackground, shellForeground;
let baseTheme;
let shellBackground;
let shellForeground;
if (data) {
baseTheme = data.baseTheme;
shellBackground = data.colorInfo.editorBackground;
@ -162,7 +165,9 @@
style.textContent = `body { background-color: ${shellBackground}; color: ${shellForeground}; margin: 0; padding: 0; }`;
// set zoom level as soon as possible
// @ts-ignore
if (typeof data?.zoomLevel === 'number' && typeof globalThis.vscode?.webFrame?.setZoomLevel === 'function') {
// @ts-ignore
globalThis.vscode.webFrame.setZoomLevel(data.zoomLevel);
}
@ -172,9 +177,9 @@
const splash = document.createElement('div');
splash.id = 'monaco-parts-splash';
splash.className = baseTheme;
splash.className = baseTheme ?? 'vs-dark';
if (layoutInfo.windowBorder) {
if (layoutInfo.windowBorder && colorInfo.windowBorder) {
splash.style.position = 'relative';
splash.style.height = 'calc(100vh - 2px)';
splash.style.width = 'calc(100vw - 2px)';

View File

@ -29,7 +29,7 @@
* @returns {{
* load: (
* modules: string[],
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
* resultCallback: (result: any, configuration: ISandboxConfiguration) => unknown,
* options?: {
* configureDeveloperSettings?: (config: ISandboxConfiguration) => {
* forceEnableDeveloperKeybindings?: boolean,

View File

@ -168,7 +168,7 @@ sw.addEventListener('message', async (event) => {
sw.addEventListener('fetch', (event) => {
const requestUrl = new URL(event.request.url);
if (requestUrl.protocol === 'https:' && requestUrl.hostname.endsWith('.' + resourceBaseAuthority)) {
if (typeof resourceBaseAuthority === 'string' && requestUrl.protocol === 'https:' && requestUrl.hostname.endsWith('.' + resourceBaseAuthority)) {
switch (event.request.method) {
case 'GET':
case 'HEAD': {