File tree 3 files changed +13
-0
lines changed
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -900,9 +900,16 @@ module Settings = {
900
900
901
901
let onResetClick = evt => {
902
902
ReactEvent .Mouse .preventDefault (evt )
903
+
904
+ let open_modules =
905
+ readyState .selected .libraries -> Belt .Array .some (el => el === "@rescript/core" )
906
+ ? Some (["RescriptCore" ])
907
+ : None
908
+
903
909
let defaultConfig = {
904
910
Api .Config .module_system : "nodejs" ,
905
911
warn_flags : "+a-4-9-20-40-41-42-50-61-102-109" ,
912
+ ?open_modules ,
906
913
}
907
914
setConfig (defaultConfig )
908
915
}
Original file line number Diff line number Diff line change @@ -348,6 +348,7 @@ module Config = {
348
348
module_system : string ,
349
349
warn_flags : string ,
350
350
uncurried ?: bool ,
351
+ open_modules ?: array <string >,
351
352
}
352
353
}
353
354
@@ -423,6 +424,8 @@ module Compiler = {
423
424
424
425
@send external setWarnFlags : (t , string ) => bool = "setWarnFlags"
425
426
427
+ @send external setOpenModules : (t , array <string >) => bool = "setOpenModules"
428
+
426
429
let setConfig = (t : t , config : Config .t ): unit => {
427
430
let moduleSystem = switch config .module_system {
428
431
| "nodejs" => #nodejs -> Some
@@ -431,6 +434,7 @@ module Compiler = {
431
434
}
432
435
433
436
Belt .Option .forEach (moduleSystem , moduleSystem => t -> setModuleSystem (moduleSystem )-> ignore )
437
+ Belt .Option .forEach (config .open_modules , modules => t -> setOpenModules (modules )-> ignore )
434
438
435
439
t -> setWarnFlags (config .warn_flags )-> ignore
436
440
}
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ module Config: {
159
159
warn_flags: string,
160
160
/** Only available in apiVersion > 3 (= ReScript 11+) */
161
161
uncurried?: bool,
162
+ open_modules?: array<string>,
162
163
}
163
164
}
164
165
@@ -197,6 +198,7 @@ module Compiler: {
197
198
let setModuleSystem: (t, [#es6 | #nodejs]) => bool
198
199
199
200
let setWarnFlags: (t, string) => bool
201
+ let setOpenModules: (t, array<string>) => bool
200
202
let setConfig: (t, Config.t) => unit
201
203
202
204
// General format function
You can’t perform that action at this time.
0 commit comments