Skip to content

Commit 192c67d

Browse files
committed
Always use app root for resource URIs (avoid usage of require)
1 parent 57f489b commit 192c67d

File tree

41 files changed

+112
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+112
-97
lines changed

src/vs/base/common/network.ts

+24-8
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,22 @@ class RemoteAuthoritiesImpl {
170170

171171
export const RemoteAuthorities = new RemoteAuthoritiesImpl();
172172

173+
/**
174+
* A string pointing to a path inside the app. It should not begin with ./ or ../
175+
*/
176+
export type AppResourcePath = (
177+
`a${string}` | `b${string}` | `c${string}` | `d${string}` | `e${string}` | `f${string}`
178+
| `g${string}` | `h${string}` | `i${string}` | `j${string}` | `k${string}` | `l${string}`
179+
| `m${string}` | `n${string}` | `o${string}` | `p${string}` | `q${string}` | `r${string}`
180+
| `s${string}` | `t${string}` | `u${string}` | `v${string}` | `w${string}` | `x${string}`
181+
| `y${string}` | `z${string}`
182+
);
183+
184+
export const builtinExtensionsPath: AppResourcePath = 'vs/../../extensions';
185+
export const nodeModulesPath: AppResourcePath = 'vs/../../node_modules';
186+
export const nodeModulesAsarPath: AppResourcePath = 'vs/../../node_modules.asar';
187+
export const nodeModulesAsarUnpackedPath: AppResourcePath = 'vs/../../node_modules.asar.unpacked';
188+
173189
class FileAccessImpl {
174190

175191
private static readonly FALLBACK_AUTHORITY = 'vscode-app';
@@ -181,9 +197,9 @@ class FileAccessImpl {
181197
* **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.
182198
*/
183199
asBrowserUri(uri: URI): URI;
184-
asBrowserUri(moduleId: string, moduleIdToUrl: { toUrl(moduleId: string): string }): URI;
185-
asBrowserUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI {
186-
const uri = this.toUri(uriOrModule, moduleIdToUrl);
200+
asBrowserUri(moduleId: AppResourcePath | ''): URI;
201+
asBrowserUri(uriOrModule: URI | AppResourcePath | ''): URI {
202+
const uri = this.toUri(uriOrModule);
187203

188204
// Handle remote URIs via `RemoteAuthorities`
189205
if (uri.scheme === Schemas.vscodeRemote) {
@@ -221,9 +237,9 @@ class FileAccessImpl {
221237
* is responsible for loading.
222238
*/
223239
asFileUri(uri: URI): URI;
224-
asFileUri(moduleId: string, moduleIdToUrl: { toUrl(moduleId: string): string }): URI;
225-
asFileUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI {
226-
const uri = this.toUri(uriOrModule, moduleIdToUrl);
240+
asFileUri(moduleId: AppResourcePath | ''): URI;
241+
asFileUri(uriOrModule: URI | AppResourcePath | ''): URI {
242+
const uri = this.toUri(uriOrModule);
227243

228244
// Only convert the URI if it is `vscode-file:` scheme
229245
if (uri.scheme === Schemas.vscodeFileResource) {
@@ -241,12 +257,12 @@ class FileAccessImpl {
241257
return uri;
242258
}
243259

244-
private toUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI {
260+
private toUri(uriOrModule: URI | string): URI {
245261
if (URI.isUri(uriOrModule)) {
246262
return uriOrModule;
247263
}
248264

249-
return URI.parse(moduleIdToUrl!.toUrl(uriOrModule));
265+
return URI.parse(require.toUrl(uriOrModule));
250266
}
251267
}
252268

src/vs/base/node/ps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
198198
// The cpu usage value reported on Linux is the average over the process lifetime,
199199
// recalculate the usage over a one second interval
200200
// JSON.stringify is needed to escape spaces, https://github.com/nodejs/node/issues/6803
201-
let cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/cpuUsage.sh', require).fsPath);
201+
let cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/cpuUsage.sh').fsPath);
202202
cmd += ' ' + pids.join(' ');
203203

204204
exec(cmd, {}, (err, stdout, stderr) => {
@@ -226,7 +226,7 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
226226
if (process.platform !== 'linux') {
227227
reject(err || new Error(stderr.toString()));
228228
} else {
229-
const cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/ps.sh', require).fsPath);
229+
const cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/ps.sh').fsPath);
230230
exec(cmd, {}, (err, stdout, stderr) => {
231231
if (err || stderr) {
232232
reject(err || new Error(stderr.toString()));

src/vs/base/test/common/network.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ suite('network', () => {
3030
});
3131

3232
(isWeb ? test.skip : test)('FileAccess: moduleId (native)', () => {
33-
const browserUri = FileAccess.asBrowserUri('vs/base/test/node/network.test', require);
33+
const browserUri = FileAccess.asBrowserUri('vs/base/test/node/network.test');
3434
assert.strictEqual(browserUri.scheme, Schemas.vscodeFileResource);
3535

36-
const fileUri = FileAccess.asFileUri('vs/base/test/node/network.test', require);
36+
const fileUri = FileAccess.asFileUri('vs/base/test/node/network.test');
3737
assert.strictEqual(fileUri.scheme, Schemas.file);
3838
});
3939

src/vs/code/node/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ export async function main(argv: string[]): Promise<any> {
496496
}
497497

498498
function getAppRoot() {
499-
return dirname(FileAccess.asFileUri('', require).fsPath);
499+
return dirname(FileAccess.asFileUri('').fsPath);
500500
}
501501

502502
function eventuallyExit(code: number): void {

src/vs/platform/environment/common/environmentService.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export abstract class AbstractNativeEnvironmentService implements INativeEnviron
4444
declare readonly _serviceBrand: undefined;
4545

4646
@memoize
47-
get appRoot(): string { return dirname(FileAccess.asFileUri('', require).fsPath); }
47+
get appRoot(): string { return dirname(FileAccess.asFileUri('').fsPath); }
4848

4949
@memoize
5050
get userHome(): URI { return URI.file(this.paths.homeDir); }
@@ -129,7 +129,7 @@ export abstract class AbstractNativeEnvironmentService implements INativeEnviron
129129
return resolve(cliBuiltinExtensionsDir);
130130
}
131131

132-
return normalize(join(FileAccess.asFileUri('', require).fsPath, '..', 'extensions'));
132+
return normalize(join(FileAccess.asFileUri('').fsPath, '..', 'extensions'));
133133
}
134134

135135
get extensionsDownloadLocation(): URI {

src/vs/platform/extensionManagement/common/extensionsScannerService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
355355
this.logService.trace('Started scanning dev system extensions');
356356
const builtinExtensionControl = checkControlFile ? await this.getBuiltInExtensionControl() : {};
357357
const devSystemExtensionsLocations: URI[] = [];
358-
const devSystemExtensionsLocation = URI.file(path.normalize(path.join(FileAccess.asFileUri('', require).fsPath, '..', '.build', 'builtInExtensions')));
358+
const devSystemExtensionsLocation = URI.file(path.normalize(path.join(FileAccess.asFileUri('').fsPath, '..', '.build', 'builtInExtensions')));
359359
for (const extension of devSystemExtensionsList) {
360360
const controlState = builtinExtensionControl[extension.name] || 'marketplace';
361361
switch (controlState) {

src/vs/platform/extensions/electron-main/extensionHostStarter.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class ExtensionHostProcess extends Disposable {
309309
}
310310
const sw = StopWatch.create(false);
311311
this._process = fork(
312-
FileAccess.asFileUri('bootstrap-fork', require).fsPath,
312+
FileAccess.asFileUri('bootstrap-fork').fsPath,
313313
['--type=extensionHost', '--skipWorkspaceStorageLock'],
314314
mixin({ cwd: cwd() }, opts),
315315
);
@@ -434,7 +434,7 @@ class UtilityExtensionHostProcess extends Disposable {
434434
}
435435

436436
const serviceName = `extensionHost${this.id}`;
437-
const modulePath = FileAccess.asFileUri('bootstrap-fork.js', require).fsPath;
437+
const modulePath = FileAccess.asFileUri('bootstrap-fork.js').fsPath;
438438
const args: string[] = ['--type=extensionHost', '--skipWorkspaceStorageLock'];
439439
const execArgv: string[] = opts.execArgv || [];
440440
const env: { [key: string]: any } = { ...opts.env };

src/vs/platform/externalTerminal/node/externalTerminalService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class MacExternalTerminalService extends ExternalTerminalService implemen
133133
// and then launches the program inside that window.
134134

135135
const script = terminalApp === DEFAULT_TERMINAL_OSX ? 'TerminalHelper' : 'iTermHelper';
136-
const scriptpath = FileAccess.asFileUri(`vs/workbench/contrib/externalTerminal/node/${script}.scpt`, require).fsPath;
136+
const scriptpath = FileAccess.asFileUri(`vs/workbench/contrib/externalTerminal/node/${script}.scpt`).fsPath;
137137

138138
const osaArgs = [
139139
scriptpath,

src/vs/platform/files/node/watcher/watcherClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class UniversalWatcherClient extends AbstractUniversalWatcherClient {
2626
// Fork the universal file watcher and build a client around
2727
// its server for passing over requests and receiving events.
2828
const client = disposables.add(new Client(
29-
FileAccess.asFileUri('bootstrap-fork', require).fsPath,
29+
FileAccess.asFileUri('bootstrap-fork').fsPath,
3030
{
3131
serverName: 'File Watcher',
3232
args: ['--type=fileWatcher'],

src/vs/platform/issue/electron-main/issueMainService.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export class IssueMainService implements IIssueMainService {
228228
});
229229

230230
this.issueReporterWindow.loadURL(
231-
FileAccess.asBrowserUri(`vs/code/electron-sandbox/issue/issueReporter${this.environmentMainService.isBuilt ? '' : '-dev'}.html`, require).toString(true)
231+
FileAccess.asBrowserUri(`vs/code/electron-sandbox/issue/issueReporter${this.environmentMainService.isBuilt ? '' : '-dev'}.html`).toString(true)
232232
);
233233

234234
this.issueReporterWindow.on('close', () => {
@@ -279,7 +279,7 @@ export class IssueMainService implements IIssueMainService {
279279
});
280280

281281
this.processExplorerWindow.loadURL(
282-
FileAccess.asBrowserUri(`vs/code/electron-sandbox/processExplorer/processExplorer${this.environmentMainService.isBuilt ? '' : '-dev'}.html`, require).toString(true)
282+
FileAccess.asBrowserUri(`vs/code/electron-sandbox/processExplorer/processExplorer${this.environmentMainService.isBuilt ? '' : '-dev'}.html`).toString(true)
283283
);
284284

285285
this.processExplorerWindow.on('close', () => {
@@ -325,7 +325,7 @@ export class IssueMainService implements IIssueMainService {
325325
title: options.title,
326326
backgroundColor: options.backgroundColor || IssueMainService.DEFAULT_BACKGROUND_COLOR,
327327
webPreferences: {
328-
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
328+
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js').fsPath,
329329
additionalArguments: [`--vscode-window-config=${ipcObjectUrl.resource.toString()}`, `--vscode-window-kind=${windowKind}`],
330330
v8CacheOptions: this.environmentMainService.useCodeCache ? 'bypassHeatCheck' : 'none',
331331
enableWebSQL: false,

src/vs/platform/product/common/product.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (typeof globals.vscode !== 'undefined' && typeof globals.vscode.context !== '
2929
else if (typeof require?.__$__nodeRequire === 'function') {
3030

3131
// Obtain values from product.json and package.json
32-
const rootPath = dirname(FileAccess.asFileUri('', require));
32+
const rootPath = dirname(FileAccess.asFileUri(''));
3333

3434
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
3535

src/vs/platform/sharedProcess/electron-browser/sharedProcessWorkerService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class SharedProcessWebWorker extends Disposable {
281281
id: SharedProcessWorkerMessages.Spawn,
282282
configuration,
283283
environment: {
284-
bootstrapPath: FileAccess.asFileUri('bootstrap-fork', require).fsPath
284+
bootstrapPath: FileAccess.asFileUri('bootstrap-fork').fsPath
285285
}
286286
};
287287

src/vs/platform/sharedProcess/electron-main/sharedProcess.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export class SharedProcess extends Disposable implements ISharedProcess {
222222
show: false,
223223
backgroundColor: this.themeMainService.getBackgroundColor(),
224224
webPreferences: {
225-
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
225+
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js').fsPath,
226226
additionalArguments: [`--vscode-window-config=${configObjectUrl.resource.toString()}`, '--vscode-window-kind=shared-process'],
227227
v8CacheOptions: this.environmentMainService.useCodeCache ? 'bypassHeatCheck' : 'none',
228228
nodeIntegration: true,
@@ -250,7 +250,7 @@ export class SharedProcess extends Disposable implements ISharedProcess {
250250
});
251251

252252
// Load with config
253-
this.window.loadURL(FileAccess.asBrowserUri(`vs/code/electron-browser/sharedProcess/sharedProcess${this.environmentMainService.isBuilt ? '' : '-dev'}.html`, require).toString(true));
253+
this.window.loadURL(FileAccess.asBrowserUri(`vs/code/electron-browser/sharedProcess/sharedProcess${this.environmentMainService.isBuilt ? '' : '-dev'}.html`).toString(true));
254254
}
255255

256256
private registerWindowListeners(): void {

src/vs/platform/telemetry/node/customEndpointTelemetryService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class CustomEndpointTelemetryService implements ICustomEndpointTelemetryS
3434
telemetryInfo['common.vscodesessionid'] = sessionId;
3535
const args = [endpoint.id, JSON.stringify(telemetryInfo), endpoint.aiKey];
3636
const client = new TelemetryClient(
37-
FileAccess.asFileUri('bootstrap-fork', require).fsPath,
37+
FileAccess.asFileUri('bootstrap-fork').fsPath,
3838
{
3939
serverName: 'Debug Telemetry',
4040
timeout: 1000 * 60 * 5,

src/vs/platform/terminal/node/ptyHostService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class PtyHostService extends Disposable implements IPtyService {
155155
}
156156
}
157157

158-
const client = new Client(FileAccess.asFileUri('bootstrap-fork', require).fsPath, opts);
158+
const client = new Client(FileAccess.asFileUri('bootstrap-fork').fsPath, opts);
159159
this._onPtyHostStart.fire();
160160

161161
// Setup heartbeat service and trigger a heartbeat immediately to reset the timeouts

src/vs/platform/terminal/node/terminalEnvironment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function getShellIntegrationInjection(
119119

120120
const originalArgs = shellLaunchConfig.args;
121121
const shell = process.platform === 'win32' ? path.basename(shellLaunchConfig.executable).toLowerCase() : path.basename(shellLaunchConfig.executable);
122-
const appRoot = path.dirname(FileAccess.asFileUri('', require).fsPath);
122+
const appRoot = path.dirname(FileAccess.asFileUri('').fsPath);
123123
let newArgs: string[] | undefined;
124124
const envMixin: IProcessEnvironment = {
125125
'VSCODE_INJECTION': '1'

src/vs/platform/webview/electron-main/webviewProtocolProvider.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { protocol } from 'electron';
77
import { Disposable } from 'vs/base/common/lifecycle';
8-
import { COI, FileAccess, Schemas } from 'vs/base/common/network';
8+
import { AppResourcePath, COI, FileAccess, Schemas } from 'vs/base/common/network';
99
import { URI } from 'vs/base/common/uri';
1010

1111

@@ -33,8 +33,8 @@ export class WebviewProtocolProvider extends Disposable {
3333
const uri = URI.parse(request.url);
3434
const entry = WebviewProtocolProvider.validWebviewFilePaths.get(uri.path);
3535
if (typeof entry === 'string') {
36-
const relativeResourcePath = `vs/workbench/contrib/webview/browser/pre/${entry}`;
37-
const url = FileAccess.asFileUri(relativeResourcePath, require);
36+
const relativeResourcePath: AppResourcePath = `vs/workbench/contrib/webview/browser/pre/${entry}`;
37+
const url = FileAccess.asFileUri(relativeResourcePath);
3838
return callback({
3939
path: decodeURIComponent(url.fsPath),
4040
headers: {

src/vs/platform/windows/electron-main/windowImpl.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
215215
show: !isFullscreenOrMaximized, // reduce flicker by showing later
216216
title: this.productService.nameLong,
217217
webPreferences: {
218-
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
218+
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js').fsPath,
219219
additionalArguments: [`--vscode-window-config=${this.configObjectUrl.resource.toString()}`],
220220
v8CacheOptions: this.environmentMainService.useCodeCache ? 'bypassHeatCheck' : 'none',
221221
enableWebSQL: false,
@@ -878,7 +878,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
878878
this.readyState = ReadyState.NAVIGATING;
879879

880880
// Load URL
881-
this._win.loadURL(FileAccess.asBrowserUri(`vs/code/electron-sandbox/workbench/workbench${this.environmentMainService.isBuilt ? '' : '-dev'}.html`, require).toString(true));
881+
this._win.loadURL(FileAccess.asBrowserUri(`vs/code/electron-sandbox/workbench/workbench${this.environmentMainService.isBuilt ? '' : '-dev'}.html`).toString(true));
882882

883883
// Remember that we did load
884884
const wasLoaded = this.wasLoaded;

src/vs/server/node/extensionHostConnection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class ExtensionHostConnection {
257257
const args = ['--type=extensionHost', `--transformURIs`];
258258
const useHostProxy = this._environmentService.args['use-host-proxy'];
259259
args.push(`--useHostProxy=${useHostProxy ? 'true' : 'false'}`);
260-
this._extensionHostProcess = cp.fork(FileAccess.asFileUri('bootstrap-fork', require).fsPath, args, opts);
260+
this._extensionHostProcess = cp.fork(FileAccess.asFileUri('bootstrap-fork').fsPath, args, opts);
261261
const pid = this._extensionHostProcess.pid;
262262
this._log(`<${pid}> Launched Extension Host Process.`);
263263

src/vs/server/node/remoteExtensionHostAgentServer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ export async function createServer(address: string | net.AddressInfo | null, arg
724724

725725
const vsdaMod = instantiationService.invokeFunction((accessor) => {
726726
const logService = accessor.get(ILogService);
727-
const hasVSDA = fs.existsSync(join(FileAccess.asFileUri('', require).fsPath, '../node_modules/vsda'));
727+
const hasVSDA = fs.existsSync(join(FileAccess.asFileUri('').fsPath, '../node_modules/vsda'));
728728
if (hasVSDA) {
729729
try {
730730
return <typeof vsda>require.__$__nodeRequire('vsda');
@@ -735,7 +735,7 @@ export async function createServer(address: string | net.AddressInfo | null, arg
735735
return null;
736736
});
737737

738-
const hasWebClient = fs.existsSync(FileAccess.asFileUri('vs/code/browser/workbench/workbench.html', require).fsPath);
738+
const hasWebClient = fs.existsSync(FileAccess.asFileUri('vs/code/browser/workbench/workbench.html').fsPath);
739739

740740
if (hasWebClient && address && typeof address !== 'string') {
741741
// ships the web ui!

src/vs/server/node/remoteLanguagePacks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as path from 'vs/base/common/path';
1010
import * as lp from 'vs/base/node/languagePacks';
1111
import product from 'vs/platform/product/common/product';
1212

13-
const metaData = path.join(FileAccess.asFileUri('', require).fsPath, 'nls.metadata.json');
13+
const metaData = path.join(FileAccess.asFileUri('').fsPath, 'nls.metadata.json');
1414
const _cache: Map<string, Promise<lp.NLSConfiguration>> = new Map();
1515

1616
function exists(file: string) {

src/vs/server/node/server.main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage');
4343
const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
4444
const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
4545
args['user-data-dir'] = USER_DATA_PATH;
46-
const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath);
46+
const APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);
4747
const BUILTIN_EXTENSIONS_FOLDER_PATH = join(APP_ROOT, 'extensions');
4848
args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
4949
args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');

src/vs/server/node/webClientServer.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export async function serveFile(filePath: string, cacheControl: CacheControl, lo
9090
}
9191
}
9292

93-
const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath);
93+
const APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);
9494

9595
export class WebClientServer {
9696

@@ -290,7 +290,7 @@ export class WebClientServer {
290290

291291
const resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(path.resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority });
292292

293-
const filePath = FileAccess.asFileUri(this._environmentService.isBuilt ? 'vs/code/browser/workbench/workbench.html' : 'vs/code/browser/workbench/workbench-dev.html', require).fsPath;
293+
const filePath = FileAccess.asFileUri(this._environmentService.isBuilt ? 'vs/code/browser/workbench/workbench.html' : 'vs/code/browser/workbench/workbench-dev.html').fsPath;
294294
const authSessionInfo = !this._environmentService.isBuilt && this._environmentService.args['github-auth'] ? {
295295
id: generateUuid(),
296296
providerId: 'github',
@@ -398,7 +398,7 @@ export class WebClientServer {
398398
* Handle HTTP requests for /callback
399399
*/
400400
private async _handleCallback(res: http.ServerResponse): Promise<void> {
401-
const filePath = FileAccess.asFileUri('vs/code/browser/workbench/callback.html', require).fsPath;
401+
const filePath = FileAccess.asFileUri('vs/code/browser/workbench/callback.html').fsPath;
402402
const data = (await fsp.readFile(filePath)).toString();
403403
const cspDirectives = [
404404
'default-src \'self\';',

src/vs/workbench/browser/parts/editor/editor.contribution.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ registerEditorCommands();
304304
// macOS: Touchbar
305305
if (isMacintosh) {
306306
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
307-
command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: { dark: FileAccess.asFileUri('vs/workbench/browser/parts/editor/media/back-tb.png', require) } },
307+
command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: { dark: FileAccess.asFileUri('vs/workbench/browser/parts/editor/media/back-tb.png') } },
308308
group: 'navigation',
309309
order: 0
310310
});
311311

312312
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
313-
command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: { dark: FileAccess.asFileUri('vs/workbench/browser/parts/editor/media/forward-tb.png', require) } },
313+
command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: { dark: FileAccess.asFileUri('vs/workbench/browser/parts/editor/media/forward-tb.png') } },
314314
group: 'navigation',
315315
order: 1
316316
});

0 commit comments

Comments
 (0)