mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
esm - more cleanup
This commit is contained in:
2
src/bootstrap-esm.js
vendored
2
src/bootstrap-esm.js
vendored
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
const module = { exports: {} };
|
||||
|
||||
(function () {
|
||||
const isESM = true;
|
||||
|
||||
function factory() {
|
||||
// First group matches a double quoted string
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -19,7 +19,6 @@ import * as perf from '../common/performance.js';
|
||||
const module = { exports: {} };
|
||||
|
||||
(function () {
|
||||
const isESM = true;
|
||||
|
||||
/**
|
||||
* @param {typeof import('path')} path
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -13,7 +13,6 @@ import * as path from 'path';
|
||||
const module = { exports: {} };
|
||||
|
||||
(function () {
|
||||
const isESM = true;
|
||||
|
||||
/**
|
||||
* @import { NativeParsedArgs } from '../../environment/common/argv'
|
||||
|
||||
@@ -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')),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user