Skip to content

Commit 293e725

Browse files
committed
esm - some 💄
1 parent 7bf2f5e commit 293e725

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/bootstrap-cli.ts

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
/* eslint-disable local/code-import-patterns */
7-
86
// Delete `VSCODE_CWD` very early. We have seen
97
// reports where `code .` would use the wrong
108
// current working directory due to our variable

src/bootstrap-esm.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,15 @@ if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
3636
register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url);
3737
}
3838

39+
// Prepare globals that are needed for running
3940
globalThis._VSCODE_PRODUCT_JSON = { ...product };
4041
if (process.env['VSCODE_DEV']) {
41-
// Patch product overrides when running out of sources
4242
try {
4343
const overrides = require('../product.overrides.json');
4444
globalThis._VSCODE_PRODUCT_JSON = Object.assign(globalThis._VSCODE_PRODUCT_JSON, overrides);
4545
} catch (error) { /* ignore */ }
4646
}
4747
globalThis._VSCODE_PACKAGE_JSON = { ...pkg };
48-
4948
globalThis._VSCODE_FILE_ROOT = __dirname;
5049

5150
//#region NLS helpers

src/bootstrap-meta.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* eslint-disable local/code-import-patterns */
77

88
import { createRequire } from 'node:module';
9-
import { IProductConfiguration } from './vs/base/common/product.js';
9+
import type { IProductConfiguration } from './vs/base/common/product.js';
1010

1111
const require = createRequire(import.meta.url);
1212

src/bootstrap-node.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as path from 'path';
99
import * as fs from 'fs';
1010
import { fileURLToPath } from 'url';
1111
import { createRequire } from 'node:module';
12-
import { IProductConfiguration } from './vs/base/common/product';
12+
import type { IProductConfiguration } from './vs/base/common/product';
1313

1414
const require = createRequire(import.meta.url);
1515
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -93,8 +93,10 @@ export function removeGlobalNodeJsModuleLookupPaths(): void {
9393
while (commonSuffixLength < paths.length && paths[paths.length - 1 - commonSuffixLength] === globalPaths[globalPaths.length - 1 - commonSuffixLength]) {
9494
commonSuffixLength++;
9595
}
96+
9697
return paths.slice(0, paths.length - commonSuffixLength);
9798
}
99+
98100
return paths;
99101
};
100102
}
@@ -105,7 +107,7 @@ export function removeGlobalNodeJsModuleLookupPaths(): void {
105107
export function configurePortable(product: Partial<IProductConfiguration>): { portableDataPath: string; isPortable: boolean } {
106108
const appRoot = path.dirname(__dirname);
107109

108-
function getApplicationPath() {
110+
function getApplicationPath(): string {
109111
if (process.env['VSCODE_DEV']) {
110112
return appRoot;
111113
}
@@ -117,7 +119,7 @@ export function configurePortable(product: Partial<IProductConfiguration>): { po
117119
return path.dirname(path.dirname(appRoot));
118120
}
119121

120-
function getPortableDataPath() {
122+
function getPortableDataPath(): string {
121123
if (process.env['VSCODE_PORTABLE']) {
122124
return process.env['VSCODE_PORTABLE'];
123125
}

src/main.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import * as path from 'path';
99
import * as fs from 'original-fs';
1010
import * as os from 'os';
11-
import * as bootstrapNode from './bootstrap-node.js';
12-
import * as bootstrapESM from './bootstrap-esm.js';
11+
import { configurePortable } from './bootstrap-node.js';
12+
import { load } from './bootstrap-esm.js';
1313
import { fileURLToPath } from 'url';
1414
import { app, protocol, crashReporter, Menu, contentTracing } from 'electron';
1515
import minimist from 'minimist';
@@ -27,7 +27,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
2727
perf.mark('code/didStartMain');
2828

2929
// Enable portable support
30-
const portable = bootstrapNode.configurePortable(product);
30+
const portable = configurePortable(product);
3131

3232
const args = parseCLIArgs();
3333
// Configure static command line arguments
@@ -176,7 +176,7 @@ function startup(codeCachePath: string | undefined, nlsConfig: INLSConfiguration
176176
process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || '';
177177

178178
perf.mark('code/willLoadMainBundle');
179-
bootstrapESM.load('vs/code/electron-main/main', () => {
179+
load('vs/code/electron-main/main', () => {
180180
perf.mark('code/didLoadMainBundle');
181181
});
182182
}
@@ -232,7 +232,7 @@ function configureCommandlineSwitchesSync(cliArgs: NativeParsedArgs) {
232232
} else {
233233
app.commandLine.appendSwitch(argvKey);
234234
}
235-
} else if (typeof argvValue === 'string') {
235+
} else if (typeof argvValue === 'string' && argvValue) {
236236
if (argvKey === 'password-store') {
237237
// Password store
238238
// TODO@TylerLeonhardt: Remove this migration in 3 months

src/server-main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function loadCode(nlsConfiguration: INLSConfiguration): Promise<typeof import('.
257257
});
258258
}
259259

260-
function hasStdinWithoutTty() {
260+
function hasStdinWithoutTty(): boolean {
261261
try {
262262
return !process.stdin.isTTY; // Via https://twitter.com/MylesBorins/status/782009479382626304
263263
} catch (error) {

src/vs/base/node/nls.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as path from 'path';
77
import * as fs from 'fs';
88
import * as perf from '../common/performance.js';
9-
import { ILanguagePacks, INLSConfiguration } from '../../nls.js';
9+
import type { ILanguagePacks, INLSConfiguration } from '../../nls.js';
1010

1111
export interface IResolveNLSConfigurationContext {
1212

@@ -226,6 +226,7 @@ async function exists(path: string): Promise<boolean> {
226226

227227
function touch(path: string): Promise<void> {
228228
const date = new Date();
229+
229230
return fs.promises.utimes(path, date, date);
230231
}
231232

0 commit comments

Comments
 (0)