@@ -16,7 +16,7 @@ import { normalizePath } from "../path-utils";
1616type CssModules = Map < string , string > ;
1717type TsModules = Map < string , string > ;
1818
19- export type TsConfig = {
19+ export type TsJsConfig = {
2020 compilerOptions : {
2121 baseUrl ?: string ;
2222 paths ?: {
@@ -26,7 +26,7 @@ export type TsConfig = {
2626 baseDir : string ;
2727} ;
2828
29- export type TsConfigMap = Map < string , TsConfig > ;
29+ export type TsJsConfigMap = Map < string , TsJsConfig > ;
3030
3131export type IgnoreDiagnostis = Map <
3232 string , // Selector
@@ -41,7 +41,7 @@ export class Store {
4141 languages . createDiagnosticCollection ( "react-ts-css" ) ;
4242 protected diagnosticsProvider : DiagnosticsProvider | undefined ;
4343 public ignoredDiagnostics : IgnoreDiagnostis = new Map ( ) ;
44- public tsConfig : TsConfigMap = new Map ( ) ;
44+ public tsJsConfig : TsJsConfigMap = new Map ( ) ;
4545 public tsModules : TsModules = new Map ( ) ;
4646 public parser : Parser | undefined ;
4747
@@ -123,7 +123,7 @@ export class Store {
123123 }
124124 }
125125
126- private async saveTsConfigAutomatically ( ) {
126+ private async saveTsJsConfig ( ) {
127127 try {
128128 const configs = await fsg (
129129 [
@@ -151,12 +151,12 @@ export class Store {
151151 const _path = path . resolve ( this . workSpaceRoot ?? "" , config ) ;
152152 const contents = ( await fs_promises . readFile ( _path ) ) . toString ( ) ;
153153 try {
154- this . tsConfig . set ( _path , {
154+ this . tsJsConfig . set ( _path , {
155155 ...JSON . parse ( contents ) ,
156156 baseDir : normalizePath (
157157 path . join ( this . workSpaceRoot ?? "" , path . dirname ( config ) )
158158 ) ,
159- } as TsConfig ) ;
159+ } as TsJsConfig ) ;
160160 } catch ( e ) {
161161 console . error ( e ) ;
162162 }
@@ -188,7 +188,7 @@ export class Store {
188188 const activeFileDir = normalizePath (
189189 path . dirname ( this . getActiveTextDocument ( ) . fileName )
190190 ) ;
191- for ( const [ , config ] of this . tsConfig ) {
191+ for ( const [ , config ] of this . tsJsConfig ) {
192192 if ( activeFileDir . includes ( config . baseDir ) ) {
193193 const alias = normalizePath ( path . dirname ( source ) ) ;
194194 const module_name = path . basename ( source ) ;
@@ -208,10 +208,10 @@ export class Store {
208208 }
209209
210210 for ( const [ _path , values ] of Object . entries ( paths ?? { } ) ) {
211- const tsconfig_alias_path_dir = normalizePath ( path . dirname ( _path ) ) ;
211+ const alias_dir_path = normalizePath ( path . dirname ( _path ) ) ;
212212 let final_path = "" ;
213213 const alias_value = values [ 0 ] . replace ( "*" , "" ) ;
214- if ( alias === tsconfig_alias_path_dir ) {
214+ if ( alias === alias_dir_path ) {
215215 final_path = normalizePath (
216216 path . join (
217217 config . baseDir ,
@@ -220,12 +220,12 @@ export class Store {
220220 module_name
221221 )
222222 ) ;
223- } else if ( alias . indexOf ( tsconfig_alias_path_dir ) === 0 ) {
223+ } else if ( alias . indexOf ( alias_dir_path ) === 0 ) {
224224 final_path = normalizePath (
225225 path . join (
226226 config . baseDir ,
227227 alias_value ,
228- alias . replace ( tsconfig_alias_path_dir , "" ) ,
228+ alias . replace ( alias_dir_path , "" ) ,
229229 module_name
230230 )
231231 ) ;
@@ -262,12 +262,12 @@ export class Store {
262262 await this . experimental_setTsModules ( ) ;
263263 }
264264
265- await this . saveTsConfigAutomatically ( ) ;
265+ await this . saveTsJsConfig ( ) ;
266266
267267 if ( ! this . parser ) {
268268 this . parser = new Parser ( {
269269 workspaceRoot : this . workSpaceRoot ,
270- tsConfig : this . tsConfig ,
270+ tsConfig : this . tsJsConfig ,
271271 baseDir : Settings . baseDir ,
272272 } ) ;
273273 }
@@ -289,7 +289,7 @@ export class Store {
289289 */
290290 public flushStorage ( ) {
291291 this . workSpaceRoot = undefined ;
292- this . tsConfig = new Map ( ) ;
292+ this . tsJsConfig = new Map ( ) ;
293293 this . cssModules = new Map ( ) ;
294294 }
295295
0 commit comments