Skip to content

Commit dd02131

Browse files
sdavidsintellij-monorepo-bot
authored andcommitted
[graphql] support mjs, cts, and mts config files
GitOrigin-RevId: c12390a66a0cd77375a6fc75f7b269a353c23126
1 parent 27faa27 commit dd02131

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,22 @@ The plugin supports multiple configuration file formats. Here is a list of all t
299299
- graphql.config.json
300300
- graphql.config.js
301301
- graphql.config.cjs
302+
- graphql.config.mjs
302303
- graphql.config.ts
304+
- graphql.config.cts
305+
- graphql.config.mts
303306
- graphql.config.yaml
304307
- graphql.config.yml
305308
- .graphqlrc (YAML and JSON)
306309
- .graphqlrc.json
307310
- .graphqlrc.yaml
308311
- .graphqlrc.yml
309312
- .graphqlrc.js
313+
- .graphqlrc.cjs
314+
- .graphqlrc.mjs
310315
- .graphqlrc.ts
316+
- .graphqlrc.cts
317+
- .graphqlrc.mts
311318

312319
### Yaml
313320

javascript/src/com/intellij/graphql/javascript/config/GraphQLJavaScriptConfigLoader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private const val TIMEOUT = 15000
3030

3131
private val LOG = logger<GraphQLJavaScriptConfigLoader>()
3232

33-
private val EXTENSIONS = setOf("js", "ts", "cjs")
33+
private val EXTENSIONS = setOf("js", "ts", "cjs", "mjs", "cts", "mts")
3434

3535
class GraphQLJavaScriptConfigLoader : GraphQLConfigCustomLoader {
3636

src/main/com/intellij/lang/jsgraphql/ide/config/GraphQLConfigConstants.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,23 @@ val LEGACY_CONFIG_NAMES: Set<String> = linkedSetOf(
2020
)
2121

2222
const val GRAPHQL_CONFIG_TS = "graphql.config.ts"
23+
const val GRAPHQL_CONFIG_CTS = "graphql.config.cts"
24+
const val GRAPHQL_CONFIG_MTS = "graphql.config.mts"
2325
const val GRAPHQL_CONFIG_JS = "graphql.config.js"
2426
const val GRAPHQL_CONFIG_CJS = "graphql.config.cjs"
27+
const val GRAPHQL_CONFIG_MJS = "graphql.config.mjs"
2528

2629
const val GRAPHQL_CONFIG_JSON = "graphql.config.json"
2730
const val GRAPHQL_CONFIG_YAML = "graphql.config.yaml"
2831
const val GRAPHQL_CONFIG_YML = "graphql.config.yml"
2932

3033
const val GRAPHQL_RC = ".graphqlrc"
3134
const val GRAPHQL_RC_TS = ".graphqlrc.ts"
35+
const val GRAPHQL_RC_CTS = ".graphqlrc.cts"
36+
const val GRAPHQL_RC_MTS = ".graphqlrc.mts"
3237
const val GRAPHQL_RC_JS = ".graphqlrc.js"
3338
const val GRAPHQL_RC_CJS = ".graphqlrc.cjs"
39+
const val GRAPHQL_RC_MJS = ".graphqlrc.mjs"
3440

3541
const val GRAPHQL_RC_JSON = ".graphqlrc.json"
3642
const val GRAPHQL_RC_YAML = ".graphqlrc.yaml"
@@ -39,16 +45,22 @@ const val GRAPHQL_RC_YML = ".graphqlrc.yml"
3945
@JvmField
4046
val MODERN_CONFIG_NAMES: Set<String> = linkedSetOf(
4147
GRAPHQL_CONFIG_TS,
48+
GRAPHQL_CONFIG_CTS,
49+
GRAPHQL_CONFIG_MTS,
4250
GRAPHQL_CONFIG_JS,
4351
GRAPHQL_CONFIG_CJS,
52+
GRAPHQL_CONFIG_MJS,
4453
GRAPHQL_CONFIG_JSON,
4554
GRAPHQL_CONFIG_YAML,
4655
GRAPHQL_CONFIG_YML,
4756
// "graphql.config.toml",
4857
GRAPHQL_RC,
4958
GRAPHQL_RC_TS,
59+
GRAPHQL_RC_CTS,
60+
GRAPHQL_RC_MTS,
5061
GRAPHQL_RC_JS,
5162
GRAPHQL_RC_CJS,
63+
GRAPHQL_RC_MJS,
5264
GRAPHQL_RC_JSON,
5365
GRAPHQL_RC_YAML,
5466
GRAPHQL_RC_YML,

src/main/com/intellij/lang/jsgraphql/ide/config/loader/GraphQLConfigLoader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class GraphQLConfigLoader(private val project: Project) {
127127
return when (file.extension) {
128128
"json" -> readJson(file)
129129
"yaml", "yml" -> readYml(file)
130-
"js", "cjs", "ts" -> readJs(file)
130+
"js", "cjs", "mjs", "ts", "cts", "mts" -> readJs(file)
131131
else -> when (file.name) {
132132
GRAPHQLCONFIG -> readJson(file)
133133
GRAPHQL_RC -> readContentDependent(file)

0 commit comments

Comments
 (0)