esm - more cleanup

This commit is contained in:
Benjamin Pasero
2024-09-27 08:05:01 +02:00
parent b544846460
commit fbd082776d
9 changed files with 7 additions and 18 deletions

View File

@@ -158,7 +158,7 @@ module.exports.load = function (esModule, onLoad, onError) {
setupNLS().then(() => {
performance.mark(`code/fork/willLoadCode`);
import([`./${esModule}.js`].join('/') /* TODO@esm workaround to prevent esbuild from inlining this */).then(onLoad, onError);
import([`./${esModule}.js`].join('/') /* workaround to prevent esbuild from inlining this */).then(onLoad, onError);
});
};

View File

@@ -10,7 +10,6 @@
const module = { exports: {} };
(function () {
const isESM = true;
function factory() {
// First group matches a double quoted string

View File

@@ -10,7 +10,6 @@
const module = { exports: {} };
(function () {
const isESM = true;
/**
* @returns {{mark(name:string):void, getMarks():{name:string, startTime:number}[]}}
@@ -82,7 +81,7 @@ const module = { exports: {} };
} else if (typeof process === 'object') {
// node.js: use the normal polyfill but add the timeOrigin
// from the node perf_hooks API as very first mark
const timeOrigin = performance?.timeOrigin;// ?? Math.round((require.__$__nodeRequire ?? require /* TODO@esm this is fishy */)('perf_hooks').performance.timeOrigin);
const timeOrigin = performance?.timeOrigin;
return _definePolyfillMarks(timeOrigin);
} else {
@@ -115,10 +114,7 @@ const module = { exports: {} };
sharedObj = {};
}
if (!isESM && typeof define === 'function') {
// amd
define([], function () { return _factory(sharedObj); });
} else if (typeof module === 'object' && typeof module.exports === 'object') {
if (typeof module === 'object' && typeof module.exports === 'object') {
// commonjs
module.exports = _factory(sharedObj);
} else {

View File

@@ -19,7 +19,6 @@ import * as perf from '../common/performance.js';
const module = { exports: {} };
(function () {
const isESM = true;
/**
* @param {typeof import('path')} path

View File

@@ -10,7 +10,6 @@
const module = { exports: {} };
(function () {
const isESM = true;
function factory() {
@@ -141,10 +140,7 @@ const module = { exports: {} };
};
}
if (!isESM && typeof define === 'function') {
// amd
define([], function () { return factory(); });
} else if (typeof module === 'object' && typeof module.exports === 'object') {
if (typeof module === 'object' && typeof module.exports === 'object') {
// commonjs
module.exports = factory();
} else {

View File

@@ -117,7 +117,7 @@ export async function main(argv: string[]): Promise<any> {
// Extensions Management
else if (shouldSpawnCliProcess(args)) {
const cli = await import(['./cliProcessMain.js'].join('/') /* TODO@esm workaround to prevent esbuild from inlining this */);
const cli = await import(['./cliProcessMain.js'].join('/') /* workaround to prevent esbuild from inlining this */);
await cli.main(args);
return;

View File

@@ -13,7 +13,6 @@ import * as path from 'path';
const module = { exports: {} };
(function () {
const isESM = true;
/**
* @import { NativeParsedArgs } from '../../environment/common/argv'

View File

@@ -569,7 +569,7 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
}
return [
dirname(FileAccess.asFileUri('vs/loader.js')), // TODO@esm this file will not exist in the future
dirname(FileAccess.asFileUri('vs/nls.js')),
];
}

View File

@@ -71,7 +71,7 @@ export class LanguageDetectionService extends Disposable implements ILanguageDet
modelService,
languageService,
telemetryService,
// TODO@esm: See if it's possible to bundle vscode-languagedetection
// TODO See if it's possible to bundle vscode-languagedetection
useAsar
? FileAccess.asBrowserUri(`${moduleLocationAsar}/dist/lib/index.js`).toString(true)
: FileAccess.asBrowserUri(`${moduleLocation}/dist/lib/index.js`).toString(true),