mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-16 02:56:37 +01:00
esm - remove loader.js dependency fully (#226414)
* esm - remove `loader.js` dependency fully * .
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
} 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 drop the first */)('perf_hooks').performance.timeOrigin);
|
||||
const timeOrigin = performance?.timeOrigin;// ?? Math.round((require.__$__nodeRequire ?? require /* TODO@esm this is fishy */)('perf_hooks').performance.timeOrigin);
|
||||
return _definePolyfillMarks(timeOrigin);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path="../../../typings/require.d.ts" />
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script src="../../../../vs/loader.js"></script>
|
||||
<script src="../../../../bootstrap-window.js"></script>
|
||||
<script src="./processExplorer.js"></script>
|
||||
</html>
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script src="../../../../vs/loader.js"></script>
|
||||
<script src="../../../../bootstrap-window.js"></script>
|
||||
<script src="./processExplorer.js"></script>
|
||||
</html>
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script src="../../../../vs/loader.js"></script>
|
||||
<script src="../../../../bootstrap-window.js"></script>
|
||||
<script src="./workbench.js"></script>
|
||||
</html>
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path="../../../../typings/require.d.ts" />
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script src="../../../../../vs/loader.js"></script>
|
||||
<script src="../../../../../bootstrap-window.js"></script>
|
||||
<script src="./issueReporter.js"></script>
|
||||
</html>
|
||||
|
||||
@@ -569,7 +569,7 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
|
||||
}
|
||||
|
||||
return [
|
||||
dirname(FileAccess.asFileUri('vs/loader.js')),
|
||||
dirname(FileAccess.asFileUri('vs/loader.js')), // TODO@esm this file will not exist in the future
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -200,13 +200,13 @@ class PerfModelContentProvider implements ITextModelContentProvider {
|
||||
const table: Array<Array<string | number | undefined>> = [];
|
||||
table.push(['start => app.isReady', metrics.timers.ellapsedAppReady, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['nls:start => nls:end', metrics.timers.ellapsedNlsGeneration, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['require(main.bundle.js)', metrics.timers.ellapsedLoadMainBundle, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['import(main.bundle.js)', metrics.timers.ellapsedLoadMainBundle, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['start crash reporter', metrics.timers.ellapsedCrashReporter, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['serve main IPC handle', metrics.timers.ellapsedMainServer, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['create window', metrics.timers.ellapsedWindowCreate, '[main]', `initial startup: ${metrics.initialStartup}, ${metrics.initialStartup ? `state: ${metrics.timers.ellapsedWindowRestoreState}ms, widget: ${metrics.timers.ellapsedBrowserWindowCreate}ms, show: ${metrics.timers.ellapsedWindowMaximize}ms` : ''}`]);
|
||||
table.push(['app.isReady => window.loadUrl()', metrics.timers.ellapsedWindowLoad, '[main]', `initial startup: ${metrics.initialStartup}`]);
|
||||
table.push(['window.loadUrl() => begin to require(workbench.desktop.main.js)', metrics.timers.ellapsedWindowLoadToRequire, '[main->renderer]', StartupKindToString(metrics.windowKind)]);
|
||||
table.push(['require(workbench.desktop.main.js)', metrics.timers.ellapsedRequire, '[renderer]', `cached data: ${(metrics.didUseCachedData ? 'YES' : 'NO')}${stats ? `, node_modules took ${stats.nodeRequireTotal}ms` : ''}`]);
|
||||
table.push(['window.loadUrl() => begin to import(workbench.desktop.main.js)', metrics.timers.ellapsedWindowLoadToRequire, '[main->renderer]', StartupKindToString(metrics.windowKind)]);
|
||||
table.push(['import(workbench.desktop.main.js)', metrics.timers.ellapsedRequire, '[renderer]', `cached data: ${(metrics.didUseCachedData ? 'YES' : 'NO')}${stats ? `, node_modules took ${stats.nodeRequireTotal}ms` : ''}`]);
|
||||
table.push(['wait for window config', metrics.timers.ellapsedWaitForWindowConfig, '[renderer]', undefined]);
|
||||
table.push(['init storage (global & workspace)', metrics.timers.ellapsedStorageInit, '[renderer]', undefined]);
|
||||
table.push(['init workspace service', metrics.timers.ellapsedWorkspaceServiceInit, '[renderer]', undefined]);
|
||||
@@ -332,7 +332,7 @@ class PerfModelContentProvider implements ITextModelContentProvider {
|
||||
map.set(LoaderEventType.CachedDataFound, []);
|
||||
map.set(LoaderEventType.CachedDataMissed, []);
|
||||
map.set(LoaderEventType.CachedDataRejected, []);
|
||||
if (typeof require.getStats === 'function') {
|
||||
if (!isESM && typeof require.getStats === 'function') {
|
||||
for (const stat of require.getStats()) {
|
||||
if (map.has(stat.type)) {
|
||||
map.get(stat.type)!.push(stat.detail);
|
||||
|
||||
@@ -80,6 +80,7 @@ import { ThemeIcon } from 'vs/base/common/themables';
|
||||
import { getWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { DynamicWorkbenchSecurityConfiguration } from 'vs/workbench/common/configuration';
|
||||
import { nativeHoverDelegate } from 'vs/platform/hover/browser/hover';
|
||||
import { isESM } from 'vs/base/common/amd';
|
||||
|
||||
export class NativeWindow extends BaseWindow {
|
||||
|
||||
@@ -708,7 +709,7 @@ export class NativeWindow extends BaseWindow {
|
||||
private async handleWarnings(): Promise<void> {
|
||||
|
||||
// Check for cyclic dependencies
|
||||
if (typeof require.hasDependencyCycle === 'function' && require.hasDependencyCycle()) {
|
||||
if (!isESM && typeof require.hasDependencyCycle === 'function' && require.hasDependencyCycle()) {
|
||||
if (isCI) {
|
||||
this.logService.error('Error: There is a dependency cycle in the AMD modules that needs to be resolved!');
|
||||
this.nativeHostService.exit(37); // running on a build machine, just exit without showing a dialog
|
||||
|
||||
Reference in New Issue
Block a user