esm - cleanup editor worker build descriptors

This commit is contained in:
Benjamin Pasero 2024-09-27 08:04:34 +02:00
parent 6849275026
commit c1952297c5
No known key found for this signature in database
GPG Key ID: E6380CC4C8219E65
9 changed files with 13 additions and 43 deletions

View File

@ -16,7 +16,7 @@ function createModuleDescription(name, exclude) {
}
return {
name: name,
name,
include: [],
exclude: excludes
};
@ -26,40 +26,13 @@ function createModuleDescription(name, exclude) {
* @param {string} name
*/
function createEditorWorkerModuleDescription(name) {
const amdVariant = createModuleDescription(name, ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']);
amdVariant.target = 'amd';
const description = createModuleDescription(name, ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']);
description.name = `${description.name}.esm`;
const esmVariant = { ...amdVariant, dest: undefined };
esmVariant.target = 'esm';
esmVariant.name = `${esmVariant.name}.esm`;
return [amdVariant, esmVariant];
return description;
}
// TODO@esm take the editor simple worker top level and rename away from "base"
exports.base = [
{
name: 'vs/editor/common/services/editorSimpleWorker',
include: ['vs/base/common/worker/simpleWorker'],
exclude: [],
prepend: [
{ path: 'vs/loader.js' },
{ path: 'vs/base/worker/workerMain.js' }
],
dest: 'vs/base/worker/workerMain.js',
target: 'amd'
},
{
name: 'vs/editor/common/services/editorSimpleWorker.esm',
target: 'esm'
},
{
name: 'vs/base/common/worker/simpleWorker',
exclude: [],
target: 'amd'
}
];
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');
@ -93,8 +66,6 @@ exports.code = [
createModuleDescription('vs/code/electron-sandbox/processExplorer/processExplorerMain')
];
exports.codeWeb = [
createModuleDescription('vs/code/browser/workbench/workbench')
];
exports.codeWeb = createModuleDescription('vs/code/browser/workbench/workbench');
exports.entrypoint = createModuleDescription;

View File

@ -128,7 +128,7 @@ const serverEntryPoints = [
];
const webEntryPoints = [
buildfile.base,
buildfile.workerEditor,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workerLanguageDetection,

View File

@ -38,7 +38,7 @@ const rcedit = promisify(require('rcedit'));
// Build
const vscodeEntryPoints = [
buildfile.base,
buildfile.workerEditor,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workerLanguageDetection,

View File

@ -73,7 +73,7 @@ const vscodeWebResources = [
const buildfile = require('./buildfile');
const vscodeWebEntryPoints = [
buildfile.base,
buildfile.workerEditor,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workerLanguageDetection,

View File

@ -53,7 +53,6 @@ export interface IEntryPoint {
exclude?: string[];
prepend?: IExtraFile[];
dest?: string;
target?: 'amd' | 'esm';
}
interface IEntryPointMap {

View File

@ -264,7 +264,7 @@ const skippedExportMangledFiles = [
// entry points
...[
buildfile.entrypoint('vs/server/node/server.main'),
buildfile.base,
buildfile.workerEditor,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workerLanguageDetection,

View File

@ -300,7 +300,7 @@ const skippedExportMangledFiles = [
// entry points
...[
buildfile.entrypoint('vs/server/node/server.main'),
buildfile.base,
buildfile.workerEditor,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workerLanguageDetection,

View File

@ -105,7 +105,7 @@ const DEFAULT_FILE_HEADER = [
function optimizeESMTask(opts, cjsOpts) {
const resourcesStream = es.through(); // this stream will contain the resources
const bundlesStream = es.through(); // this stream will contain the bundled files
const entryPoints = opts.entryPoints.filter(d => d.target !== 'amd');
const entryPoints = opts.entryPoints;
if (cjsOpts) {
cjsOpts.entryPoints.forEach(entryPoint => entryPoints.push({ name: path.parse(entryPoint).name }));
}

View File

@ -163,7 +163,7 @@ function optimizeESMTask(opts: IOptimizeAMDTaskOpts, cjsOpts?: IOptimizeCommonJS
const resourcesStream = es.through(); // this stream will contain the resources
const bundlesStream = es.through(); // this stream will contain the bundled files
const entryPoints = opts.entryPoints.filter(d => d.target !== 'amd');
const entryPoints = opts.entryPoints;
if (cjsOpts) {
cjsOpts.entryPoints.forEach(entryPoint => entryPoints.push({ name: path.parse(entryPoint).name }));
}