@@ -84,11 +84,9 @@ export type LoadRstackConfigOptions = {
8484 /**
8585 * The path to the Rstack config file, can be a relative or absolute path.
8686 * A relative path is resolved from `cwd`.
87- * If `configFilePath` is omitted, the config path set by the CLI is used.
88- * If neither path is provided, the function will search for the config file in `cwd`.
89- * Pass `null` to search `cwd` and ignore the CLI config path.
87+ * If omitted, the function searches for the config file in `cwd`.
9088 */
91- configFilePath ?: string | null ;
89+ configFilePath ?: string ;
9290 /**
9391 * The directory the config file is searched in and relative config paths are resolved from.
9492 * Defaults to the current working directory.
@@ -102,21 +100,10 @@ type ConfigSession = {
102100 active : boolean ;
103101} ;
104102
105- type ConfigState = {
106- /**
107- * Config file path from the global `--config` flag. Always absolute: the CLI
108- * resolves it at parse time so it stays independent of later cwd choices
109- * (`loadRstackConfig` may be called with an LSP workspace root as `cwd`).
110- */
111- configPath ?: string ;
112- } ;
113-
114103declare global {
115104 // rslint-disable-next-line no-var
116105 var __rstackConfigSessionStorage :
117106 AsyncLocalStorage < ConfigSession > | undefined ;
118- // rslint-disable-next-line no-var
119- var __rstackCliState : ConfigState | undefined ;
120107}
121108
122109const getConfigSessionStorage = ( ) : AsyncLocalStorage < ConfigSession > => {
@@ -131,23 +118,6 @@ const getConfigSessionStorage = (): AsyncLocalStorage<ConfigSession> => {
131118 return globalThis . __rstackConfigSessionStorage ;
132119} ;
133120
134- export const getConfigState = ( ) : ConfigState => {
135- // The CLI and its internal tool config can also be loaded as separate module
136- // instances. Keep only the CLI config path in its own global state.
137- if ( ! globalThis . __rstackCliState ) {
138- globalThis . __rstackCliState = { } ;
139- }
140-
141- return globalThis . __rstackCliState ;
142- } ;
143-
144- /**
145- * Passes the `--config` path to Rslint's JS plugin workers, which import the
146- * internal lint config in a fresh realm without the CLI state above. Only that
147- * config reads it.
148- */
149- export const CLI_CONFIG_PATH_ENV = 'RSTACK_CLI_CONFIG_PATH' ;
150-
151121type Define = {
152122 /**
153123 * Inherits shared configs from left to right, followed by the project's own
@@ -269,9 +239,6 @@ export const loadRstackConfig = async ({
269239 configFilePath,
270240 cwd,
271241} : LoadRstackConfigOptions = { } ) : Promise < LoadedRstackConfig > => {
272- const state = getConfigState ( ) ;
273- const configPath =
274- configFilePath === null ? undefined : ( configFilePath ?? state . configPath ) ;
275242 const session : ConfigSession = {
276243 configs : { } ,
277244 active : true ,
@@ -284,8 +251,8 @@ export const loadRstackConfig = async ({
284251 exportName : false ,
285252 fresh : true ,
286253 cwd,
287- ...( configPath !== undefined
288- ? { path : configPath }
254+ ...( configFilePath !== undefined
255+ ? { path : configFilePath }
289256 : {
290257 configFileNames : [
291258 'rstack.config.ts' ,
0 commit comments