esm - more cleanup of rules and files (#230083)

This commit is contained in:
Benjamin Pasero
2024-09-30 11:20:59 +02:00
committed by GitHub
parent 4a8c46ede0
commit 84c18c543e
33 changed files with 142 additions and 161 deletions
+11 -1
View File
@@ -1133,8 +1133,18 @@
"restrictions": []
},
{
"target": "src/{bootstrap-cli.ts,bootstrap-esm.ts,bootstrap-fork.ts,bootstrap-node.ts,bootstrap-import.ts,bootstrap-meta.ts,bootstrap-window.ts,cli.ts,main.ts,server-cli.ts,server-main.ts,bootstrap-server.ts}",
"target": "src/bootstrap-window.ts",
"restrictions": []
},
{
"target": "src/{bootstrap-cli.ts,bootstrap-esm.ts,bootstrap-fork.ts,bootstrap-import.ts,bootstrap-meta.ts,bootstrap-node.ts,bootstrap-server.ts,cli.ts,main.ts,server-cli.ts,server-main.ts}",
"restrictions": [
"vs/**/common/*",
"vs/**/node/*",
"vs/nls.js",
"src/*.js",
"*" // node.js
]
}
]
}
+9 -12
View File
@@ -26,20 +26,17 @@ function createModuleDescription(name, exclude) {
* @param {string} name
*/
function createEditorWorkerModuleDescription(name) {
const description = createModuleDescription(name, ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']);
description.name = `${description.name}.esm`;
return description;
return createModuleDescription(name, ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']);
}
exports.workerEditor = createEditorWorkerModuleDescription('vs/editor/common/services/editorSimpleWorker');
exports.workerExtensionHost = createEditorWorkerModuleDescription('vs/workbench/api/worker/extensionHostWorker');
exports.workerNotebook = createEditorWorkerModuleDescription('vs/workbench/contrib/notebook/common/services/notebookSimpleWorker');
exports.workerLanguageDetection = createEditorWorkerModuleDescription('vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorker');
exports.workerLocalFileSearch = createEditorWorkerModuleDescription('vs/workbench/services/search/worker/localFileSearch');
exports.workerProfileAnalysis = createEditorWorkerModuleDescription('vs/platform/profiling/electron-sandbox/profileAnalysisWorker');
exports.workerOutputLinks = createEditorWorkerModuleDescription('vs/workbench/contrib/output/common/outputLinkComputer');
exports.workerBackgroundTokenization = createEditorWorkerModuleDescription('vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.worker');
exports.workerEditor = createEditorWorkerModuleDescription('vs/editor/common/services/editorSimpleWorkerMain');
exports.workerExtensionHost = createEditorWorkerModuleDescription('vs/workbench/api/worker/extensionHostWorkerMain');
exports.workerNotebook = createEditorWorkerModuleDescription('vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain');
exports.workerLanguageDetection = createEditorWorkerModuleDescription('vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorkerMain');
exports.workerLocalFileSearch = createEditorWorkerModuleDescription('vs/workbench/services/search/worker/localFileSearchMain');
exports.workerProfileAnalysis = createEditorWorkerModuleDescription('vs/platform/profiling/electron-sandbox/profileAnalysisWorkerMain');
exports.workerOutputLinks = createEditorWorkerModuleDescription('vs/workbench/contrib/output/common/outputLinkComputerMain');
exports.workerBackgroundTokenization = createEditorWorkerModuleDescription('vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain');
exports.workbenchDesktop = [
createModuleDescription('vs/workbench/contrib/debug/node/telemetryApp'),
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as path from 'path';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as performance from './vs/base/common/performance.js';
import { removeGlobalNodeJsModuleLookupPaths, devInjectNodeModuleLookupPath } from './bootstrap-node.js';
import { load } from './bootstrap-esm.js';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
// *********************************************************************
// * *
// * We need this to redirect to node_modules from the remote-folder. *
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import { createRequire } from 'node:module';
import type { IProductConfiguration } from './vs/base/common/product.js';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as path from 'path';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
+18 -21
View File
@@ -8,32 +8,27 @@
(function () {
type ISandboxConfiguration = import('vs/base/parts/sandbox/common/sandboxTypes.js').ISandboxConfiguration;
type ILoadResult<M, T extends ISandboxConfiguration> = import('vs/platform/window/electron-sandbox/window.js').ILoadResult<M, T>;
type ILoadOptions<T extends ISandboxConfiguration> = import('vs/platform/window/electron-sandbox/window.js').ILoadOptions<T>;
type IMainWindowSandboxGlobals = import('./vs/base/parts/sandbox/electron-sandbox/globals.js').IMainWindowSandboxGlobals;
const preloadGlobals: IMainWindowSandboxGlobals = (window as any).vscode; // defined by preload.ts
const safeProcess = preloadGlobals.process;
// increase number of stack frames(from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
Error.stackTraceLimit = 100;
async function load<T extends ISandboxConfiguration>(esModule: string, resultCallback: (result: any, configuration: T) => Promise<unknown> | undefined, options: ILoadOptions<T>): Promise<void> {
async function load<M, T extends ISandboxConfiguration>(esModule: string, options: ILoadOptions<T>): Promise<ILoadResult<M, T>> {
// Window Configuration from Preload Script
const configuration = await resolveWindowConfiguration<T>();
// Signal can modify DOM
options?.canModifyDOM?.(configuration);
// Signal before import()
options?.beforeImport?.(configuration);
// Developer settings
const { enableDeveloperKeybindings, removeDeveloperKeybindingsAfterLoad, developerDeveloperKeybindingsDisposable } = setupDeveloperKeybindings(configuration, options);
const { enableDeveloperKeybindings, removeDeveloperKeybindingsAfterLoad, developerDeveloperKeybindingsDisposable, forceDisableShowDevtoolsOnError } = setupDeveloperKeybindings(configuration, options);
// NLS
setupNLS<T>(configuration);
// Signal before import()
options?.beforeImport?.(configuration);
// Compute base URL and set as global
const baseUrl = new URL(`${fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out/`);
globalThis._VSCODE_FILE_ROOT = baseUrl.toString();
@@ -45,16 +40,15 @@
try {
const result = await import(new URL(`${esModule}.js`, baseUrl).href);
const callbackResult = resultCallback(result, configuration);
if (callbackResult instanceof Promise) {
await callbackResult;
if (developerDeveloperKeybindingsDisposable && removeDeveloperKeybindingsAfterLoad) {
developerDeveloperKeybindingsDisposable();
}
if (developerDeveloperKeybindingsDisposable && removeDeveloperKeybindingsAfterLoad) {
developerDeveloperKeybindingsDisposable();
}
return { result, configuration };
} catch (error) {
onUnexpectedError(error, enableDeveloperKeybindings);
onUnexpectedError(error, enableDeveloperKeybindings && !forceDisableShowDevtoolsOnError);
throw error;
}
}
@@ -74,11 +68,13 @@
const {
forceEnableDeveloperKeybindings,
disallowReloadKeybinding,
removeDeveloperKeybindingsAfterLoad
removeDeveloperKeybindingsAfterLoad,
forceDisableShowDevtoolsOnError
} = typeof options?.configureDeveloperSettings === 'function' ? options.configureDeveloperSettings(configuration) : {
forceEnableDeveloperKeybindings: false,
disallowReloadKeybinding: false,
removeDeveloperKeybindingsAfterLoad: false
removeDeveloperKeybindingsAfterLoad: false,
forceDisableShowDevtoolsOnError: false
};
const isDev = !!safeProcess.env['VSCODE_DEV'];
@@ -91,7 +87,8 @@
return {
enableDeveloperKeybindings,
removeDeveloperKeybindingsAfterLoad,
developerDeveloperKeybindingsDisposable
developerDeveloperKeybindingsDisposable,
forceDisableShowDevtoolsOnError
};
}
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import './bootstrap-cli.js'; // this MUST come before other imports as it changes global state
import * as path from 'path';
import { fileURLToPath } from 'url';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as path from 'path';
import * as fs from 'original-fs';
import * as os from 'os';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import './bootstrap-server.js'; // this MUST come before other imports as it changes global state
import * as path from 'path';
import { fileURLToPath } from 'url';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import './bootstrap-server.js'; // this MUST come before other imports as it changes global state
import * as path from 'path';
import * as http from 'http';
+3 -24
View File
@@ -26,31 +26,10 @@
]
},
"include": [
"./bootstrap-esm.ts",
"./bootstrap-cli.ts",
"./bootstrap-fork.ts",
"./bootstrap-import.ts",
"./bootstrap-meta.ts",
"./bootstrap-node.ts",
"./bootstrap-server.ts",
"./bootstrap-window.ts",
"./cli.ts",
"./main.ts",
"./server-main.ts",
"./server-cli.ts",
"./vs/base/common/jsonc.ts",
"./vs/base/common/performance.ts",
"./vs/base/node/unc.ts",
"./vs/base/node/nls.ts",
"./vs/platform/environment/node/userDataPath.ts",
"./vs/base/parts/sandbox/electron-sandbox/preload-aux.ts",
"./vs/base/parts/sandbox/electron-sandbox/preload.ts",
"./vs/code/electron-sandbox/processExplorer/processExplorer.ts",
"./vs/code/electron-sandbox/workbench/workbench.ts",
"./vs/workbench/contrib/issue/electron-sandbox/issueReporter.ts",
"./*.ts",
"./typings",
"./vs/**/*.ts",
"vscode-dts/vscode.proposed.*.d.ts",
"vscode-dts/vscode.d.ts"
"./vscode-dts/vscode.proposed.*.d.ts",
"./vscode-dts/vscode.d.ts"
]
}
+6 -6
View File
@@ -119,7 +119,7 @@ class WebWorker extends Disposable implements IWorker {
private readonly label: string;
private worker: Promise<Worker> | null;
constructor(esmWorkerLocation: URI | undefined, amdModuleId: string, id: number, label: string, onMessageCallback: IWorkerCallback, onErrorCallback: (err: any) => void) {
constructor(esmWorkerLocation: URI | undefined, moduleId: string, id: number, label: string, onMessageCallback: IWorkerCallback, onErrorCallback: (err: any) => void) {
super();
this.id = id;
this.label = label;
@@ -129,7 +129,7 @@ class WebWorker extends Disposable implements IWorker {
} else {
this.worker = Promise.resolve(workerOrPromise);
}
this.postMessage(amdModuleId, []);
this.postMessage(moduleId, []);
this.worker.then((w) => {
w.onmessage = function (ev) {
onMessageCallback(ev.data);
@@ -171,10 +171,10 @@ export class WorkerDescriptor implements IWorkerDescriptor {
public readonly esmModuleLocation: URI | undefined;
constructor(
public readonly amdModuleId: string,
public readonly moduleId: string,
readonly label: string | undefined,
) {
this.esmModuleLocation = FileAccess.asBrowserUri(`${amdModuleId}.esm.js` as AppResourcePath);
this.esmModuleLocation = FileAccess.asBrowserUri(`${moduleId}Main.js` as AppResourcePath);
}
}
@@ -194,7 +194,7 @@ class DefaultWorkerFactory implements IWorkerFactory {
throw this._webWorkerFailedBeforeError;
}
return new WebWorker(desc.esmModuleLocation, desc.amdModuleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => {
return new WebWorker(desc.esmModuleLocation, desc.moduleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => {
logOnceWebWorkerWarning(err);
this._webWorkerFailedBeforeError = err;
onErrorCallback(err);
@@ -202,7 +202,7 @@ class DefaultWorkerFactory implements IWorkerFactory {
}
}
export function createWebWorker<T extends object>(amdModuleId: string, label: string | undefined): IWorkerClient<T>;
export function createWebWorker<T extends object>(moduleId: string, label: string | undefined): IWorkerClient<T>;
export function createWebWorker<T extends object>(workerDescriptor: IWorkerDescriptor): IWorkerClient<T>;
export function createWebWorker<T extends object>(arg0: string | IWorkerDescriptor, arg1?: string | undefined): IWorkerClient<T> {
const workerDescriptor = (typeof arg0 === 'string' ? new WorkerDescriptor(arg0, arg1) : arg0);
+4 -4
View File
@@ -29,7 +29,7 @@ export interface IWorkerFactory {
}
export interface IWorkerDescriptor {
readonly amdModuleId: string;
readonly moduleId: string;
readonly esmModuleLocation: URI | undefined;
readonly label: string | undefined;
}
@@ -332,7 +332,7 @@ export class SimpleWorkerClient<W extends object> extends Disposable implements
this._worker = this._register(workerFactory.create(
{
amdModuleId: 'vs/base/common/worker/simpleWorker',
moduleId: 'vs/base/common/worker/simpleWorker',
esmModuleLocation: workerDescriptor.esmModuleLocation,
label: workerDescriptor.label
},
@@ -375,12 +375,12 @@ export class SimpleWorkerClient<W extends object> extends Disposable implements
this._onModuleLoaded = this._protocol.sendMessage(DEFAULT_CHANNEL, INITIALIZE, [
this._worker.getId(),
JSON.parse(JSON.stringify(loaderConfiguration)),
workerDescriptor.amdModuleId,
workerDescriptor.moduleId,
]);
this.proxy = this._protocol.createProxyToRemoteChannel(DEFAULT_CHANNEL, async () => { await this._onModuleLoaded; });
this._onModuleLoaded.catch((e) => {
this._onError('Worker failed to load ' + workerDescriptor.amdModuleId, e);
this._onError('Worker failed to load ' + workerDescriptor.moduleId, e);
});
}
@@ -5,18 +5,21 @@
/* eslint-disable no-restricted-globals */
(function () {
(async function () {
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IProcessExplorerMain = import('vs/code/electron-sandbox/processExplorer/processExplorerMain.js').IProcessExplorerMain;
type ProcessExplorerWindowConfiguration = import('vs/platform/issue/common/issue.js').ProcessExplorerWindowConfiguration;
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
bootstrapWindow.load('vs/code/electron-sandbox/processExplorer/processExplorerMain', function (processExplorer, configuration) {
return processExplorer.startup(configuration);
}, {
const { result, configuration } = await bootstrapWindow.load<IProcessExplorerMain, ProcessExplorerWindowConfiguration>('vs/code/electron-sandbox/processExplorer/processExplorerMain', {
configureDeveloperSettings: function () {
return {
forceEnableDeveloperKeybindings: true
};
},
});
result.startup(configuration);
}());
@@ -591,6 +591,10 @@ function createCodiconStyleSheet() {
delayer.schedule();
}
export interface IProcessExplorerMain {
startup(configuration: ProcessExplorerWindowConfiguration): void;
}
export function startup(configuration: ProcessExplorerWindowConfiguration): void {
const platformClass = configuration.data.platform === 'win32' ? 'windows' : configuration.data.platform === 'linux' ? 'linux' : 'mac';
mainWindow.document.body.classList.add(platformClass); // used by our fonts
@@ -5,72 +5,22 @@
/* eslint-disable no-restricted-globals */
(function () {
type INativeWindowConfiguration = import('vs/platform/window/common/window.ts').INativeWindowConfiguration;
type NativeParsedArgs = import('vs/platform/environment/common/argv.js').NativeParsedArgs;
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IMainWindowSandboxGlobals = import('vs/base/parts/sandbox/electron-sandbox/globals.js').IMainWindowSandboxGlobals;
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
const preloadGlobals: IMainWindowSandboxGlobals = (window as any).vscode; // defined by preload.ts
(async function () {
// Add a perf entry right from the top
performance.mark('code/didStartRenderer');
// Load workbench main JS and CSS all in parallel. This is an
// optimization to prevent a waterfall of loading to happen, because
// we know for a fact that workbench.desktop.main will depend on
// the related CSS counterpart.
bootstrapWindow.load<INativeWindowConfiguration>('vs/workbench/workbench.desktop.main',
function (desktopMain, configuration) {
type INativeWindowConfiguration = import('vs/platform/window/common/window.ts').INativeWindowConfiguration;
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IMainWindowSandboxGlobals = import('vs/base/parts/sandbox/electron-sandbox/globals.js').IMainWindowSandboxGlobals;
type IDesktopMain = import('vs/workbench/electron-sandbox/desktop.main.js').IDesktopMain;
// Mark start of workbench
performance.mark('code/didLoadWorkbenchMain');
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
const preloadGlobals: IMainWindowSandboxGlobals = (window as any).vscode; // defined by preload.ts
return desktopMain.main(configuration);
},
{
configureDeveloperSettings: function (windowConfig) {
return {
// disable automated devtools opening on error when running extension tests
// as this can lead to nondeterministic test execution (devtools steals focus)
forceDisableShowDevtoolsOnError: typeof windowConfig.extensionTestsPath === 'string' || windowConfig['enable-smoke-test-driver'] === true,
// enable devtools keybindings in extension development window
forceEnableDeveloperKeybindings: Array.isArray(windowConfig.extensionDevelopmentPath) && windowConfig.extensionDevelopmentPath.length > 0,
removeDeveloperKeybindingsAfterLoad: true
};
},
canModifyDOM: function (windowConfig) {
showSplash(windowConfig);
},
beforeImport: function (windowConfig) {
performance.mark('code/willLoadWorkbenchMain');
//#region Splash Screen Helpers
// Code windows have a `vscodeWindowId` property to identify them
Object.defineProperty(window, 'vscodeWindowId', {
get: () => windowConfig.windowId
});
// It looks like browsers only lazily enable
// the <canvas> element when needed. Since we
// leverage canvas elements in our code in many
// locations, we try to help the browser to
// initialize canvas when it is idle, right
// before we wait for the scripts to be loaded.
window.requestIdleCallback(() => {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context?.clearRect(0, 0, canvas.width, canvas.height);
canvas.remove();
}, { timeout: 50 });
}
}
);
//#region Helpers
function showSplash(configuration: INativeWindowConfiguration & NativeParsedArgs) {
function showSplash(configuration: INativeWindowConfiguration) {
performance.mark('code/willShowPartsSplash');
let data = configuration.partsSplash;
@@ -275,4 +225,50 @@
}
//#endregion
const { result, configuration } = await bootstrapWindow.load<IDesktopMain, INativeWindowConfiguration>('vs/workbench/workbench.desktop.main',
{
configureDeveloperSettings: function (windowConfig) {
return {
// disable automated devtools opening on error when running extension tests
// as this can lead to nondeterministic test execution (devtools steals focus)
forceDisableShowDevtoolsOnError: typeof windowConfig.extensionTestsPath === 'string' || windowConfig['enable-smoke-test-driver'] === true,
// enable devtools keybindings in extension development window
removeDeveloperKeybindingsAfterLoad: true
};
},
beforeImport: function (windowConfig) {
// Show our splash as early as possible
showSplash(windowConfig);
// Code windows have a `vscodeWindowId` property to identify them
Object.defineProperty(window, 'vscodeWindowId', {
get: () => windowConfig.windowId
});
// It looks like browsers only lazily enable
// the <canvas> element when needed. Since we
// leverage canvas elements in our code in many
// locations, we try to help the browser to
// initialize canvas when it is idle, right
// before we wait for the scripts to be loaded.
window.requestIdleCallback(() => {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context?.clearRect(0, 0, canvas.width, canvas.height);
canvas.remove();
}, { timeout: 50 });
// Track import() perf
performance.mark('code/willLoadWorkbenchMain');
}
}
);
// Mark start of workbench
performance.mark('code/didLoadWorkbenchMain');
// Load workbench
result.main(configuration);
}());
@@ -1077,7 +1077,7 @@ class StandaloneContextMenuService extends ContextMenuService {
}
export const standaloneEditorWorkerDescriptor: IWorkerDescriptor = {
amdModuleId: 'vs/editor/common/services/editorSimpleWorker',
moduleId: 'vs/editor/common/services/editorSimpleWorker',
esmModuleLocation: undefined,
label: 'editorWorkerService'
};
@@ -71,7 +71,7 @@ class MonacoWebWorkerImpl<T extends object> extends EditorWorkerClient implement
constructor(modelService: IModelService, opts: IWebWorkerOptions) {
const workerDescriptor: IWorkerDescriptor = {
amdModuleId: standaloneEditorWorkerDescriptor.amdModuleId,
moduleId: standaloneEditorWorkerDescriptor.moduleId,
esmModuleLocation: standaloneEditorWorkerDescriptor.esmModuleLocation,
label: opts.label,
};
@@ -73,16 +73,19 @@ export interface ILoadOptions<T extends ISandboxConfiguration = ISandboxConfigur
disallowReloadKeybinding?: boolean;
removeDeveloperKeybindingsAfterLoad?: boolean;
};
canModifyDOM?: (config: T) => void;
beforeImport?: (config: T) => void;
}
export interface ILoadResult<M, T> {
readonly result: M;
readonly configuration: T;
}
export interface IBootstrapWindow {
load<T extends ISandboxConfiguration = ISandboxConfiguration>(
load<M, T extends ISandboxConfiguration = ISandboxConfiguration>(
esModule: string,
resultCallback: (result: any, configuration: T) => Promise<unknown> | undefined,
options: ILoadOptions<T>
): Promise<void>;
): Promise<ILoadResult<M, T>>;
}
//#endregion
@@ -5,14 +5,15 @@
/* eslint-disable no-restricted-globals */
(function () {
(async function () {
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IIssueReporterMain = import('vs/workbench/contrib/issue/electron-sandbox/issueReporterMain').IIssueReporterMain;
type OldIssueReporterWindowConfiguration = import('vs/platform/issue/common/issue.js').OldIssueReporterWindowConfiguration;
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
bootstrapWindow.load('vs/workbench/contrib/issue/electron-sandbox/issueReporterMain', function (issueReporter, configuration) {
return issueReporter.startup(configuration);
}, {
const { result, configuration } = await bootstrapWindow.load<IIssueReporterMain, OldIssueReporterWindowConfiguration>('vs/workbench/contrib/issue/electron-sandbox/issueReporterMain', {
configureDeveloperSettings: function () {
return {
forceEnableDeveloperKeybindings: true,
@@ -20,4 +21,6 @@
};
}
});
result.startup(configuration);
}());
@@ -21,8 +21,11 @@ import BaseHtml from '../browser/issueReporterPage.js';
import { IProcessMainService, IIssueMainService, OldIssueReporterWindowConfiguration } from '../../../../platform/issue/common/issue.js';
import { IssueReporter } from './issueReporterService.js';
export interface IIssueReporterMain {
startup(configuration: OldIssueReporterWindowConfiguration): void;
}
export function startup(configuration: OldIssueReporterWindowConfiguration) {
export function startup(configuration: OldIssueReporterWindowConfiguration): void {
const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac';
mainWindow.document.body.classList.add(platformClass); // used by our fonts
@@ -397,6 +397,10 @@ export class DesktopMain extends Disposable {
}
}
export interface IDesktopMain {
main(configuration: INativeWindowConfiguration): Promise<void>;
}
export function main(configuration: INativeWindowConfiguration): Promise<void> {
const workbench = new DesktopMain(configuration);
@@ -186,7 +186,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
iframe.contentWindow!.postMessage({
type: event.data.type,
data: {
workerUrl: FileAccess.asBrowserUri('vs/workbench/api/worker/extensionHostWorker.esm.js').toString(true),
workerUrl: FileAccess.asBrowserUri('vs/workbench/api/worker/extensionHostWorkerMain.js').toString(true),
fileRoot: globalThis._VSCODE_FILE_ROOT,
nls: {
messages: getNLSMessages(),