mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
Remove top-level global for base directory (#7674)
This PR removes the top-level global variable for the base directory and replaces it with a module-level variable managed through a setter function. Key changes include removing the global declaration in lib/global.ts, introducing a local ce_base_directory variable and setBaseDirectory function in lib/assert.ts, and updating app.ts to use the new setter. --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
5
app.ts
5
app.ts
@@ -52,7 +52,7 @@ import systemdSocket from 'systemd-socket';
|
||||
import _ from 'underscore';
|
||||
import urljoin from 'url-join';
|
||||
|
||||
import {unwrap} from './lib/assert.js';
|
||||
import {setBaseDirectory, unwrap} from './lib/assert.js';
|
||||
import * as aws from './lib/aws.js';
|
||||
import * as normalizer from './lib/clientstate-normalizer.js';
|
||||
import {GoldenLayoutRootStruct} from './lib/clientstate-normalizer.js';
|
||||
@@ -89,8 +89,7 @@ import {ElementType} from './shared/common-utils.js';
|
||||
import {CompilerInfo} from './types/compiler.interfaces.js';
|
||||
import type {Language, LanguageKey} from './types/languages.interfaces.js';
|
||||
|
||||
// Used by assert.ts
|
||||
global.ce_base_directory = new URL('.', import.meta.url);
|
||||
setBaseDirectory(new URL('.', import.meta.url));
|
||||
|
||||
(nopt as any).invalidHandler = (key: string, val: unknown, types: unknown[]) => {
|
||||
logger.error(
|
||||
|
||||
Reference in New Issue
Block a user