Skip to content

Commit 3aedb24

Browse files
authored
Remove more .re syntax leftovers (#5712)
1 parent e8ccf3c commit 3aedb24

23 files changed

+64
-99
lines changed

jscomp/bsb/bsb_file_groups.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type file_group = {
3838
is_dev : bool;
3939
generators : build_generator list;
4040
(* output of [generators] should be added to [sources],
41-
if it is [.ml,.mli,.re,.rei]
41+
if it is [.ml,.mli,.res,.resi]
4242
*)
4343
}
4444

jscomp/bsb/bsb_file_groups.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type file_group = {
3939
(* false means not in dev mode *)
4040
generators : build_generator list;
4141
(* output of [generators] should be added to [sources],
42-
if it is [.ml,.mli,.re,.rei]
42+
if it is [.ml,.mli,.res,.resi]
4343
*)
4444
}
4545

jscomp/gentype/EmitJs.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
229229
("In case of type error, check the type of '" ^ valueName
230230
^ "' in '"
231231
^ (fileName |> ModuleName.toString)
232-
^ ".re'" ^ " and '"
232+
^ ".res'" ^ " and '"
233233
^ (importPath |> ImportPath.emit)
234234
^ "'.")
235235
~early:true ~emitters ~name:valueNameTypeChecked ~type_

jscomp/gentype/GenTypeMain.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ let processCmtFile cmt =
104104
let isInterface = Filename.check_suffix cmtFile ".cmti" in
105105
let resolver =
106106
ModuleResolver.createLazyResolver ~config
107-
~extensions:[ ".re"; ".res"; EmitType.shimExtension ]
107+
~extensions:[ ".res"; EmitType.shimExtension ]
108108
~excludeFile:(fun fname ->
109-
fname = "React.re" || fname = "ReasonReact.re")
109+
fname = "React.res" || fname = "ReasonReact.res")
110110
in
111111
let inputCMT, hasGenTypeAnnotations =
112112
let inputCMT = readCmt cmtFile in

jscomp/gentype/ModuleResolver.ml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,28 +195,25 @@ let apply ~resolver ~useBsDependencies moduleName =
195195
moduleName |> Lazy.force resolver.lazyFind ~useBsDependencies
196196

197197
(** Resolve a reference to ModuleName, and produce a path suitable for require.
198-
E.g. require "../foo/bar/ModuleName.ext" where ext is ".re" or ".js". *)
198+
E.g. require "../foo/bar/ModuleName.ext" where ext is ".res" or ".js". *)
199199
let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
200200
~resolver ~useBsDependencies moduleName =
201201
let outputFileRelativeDir =
202-
(* e.g. src if we're generating src/File.re.js *)
202+
(* e.g. src if we're generating src/File.bs.js *)
203203
Filename.dirname outputFileRelative
204204
in
205205
let outputFileAbsoluteDir = config.projectRoot +++ outputFileRelativeDir in
206-
let moduleNameReFile =
207-
(* Check if the module is in the same directory as the file being generated.
208-
So if e.g. project_root/src/ModuleName.re exists. *)
209-
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".re")
210-
in
211206
let moduleNameResFile =
207+
(* Check if the module is in the same directory as the file being generated.
208+
So if e.g. project_root/src/ModuleName.res exists. *)
212209
outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".res")
213210
in
214211
let candidate =
215212
(* e.g. import "./Modulename.ext" *)
216213
moduleName
217214
|> ImportPath.fromModule ~dir:Filename.current_dir_name ~importExtension
218215
in
219-
if Sys.file_exists moduleNameReFile || Sys.file_exists moduleNameResFile then
216+
if Sys.file_exists moduleNameResFile then
220217
candidate
221218
else
222219
let rec pathToList path =
@@ -229,7 +226,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative
229226
match moduleName |> apply ~resolver ~useBsDependencies with
230227
| None -> candidate
231228
| Some (resolvedModuleDir, case, bsDependencies) ->
232-
(* e.g. "dst" in case of dst/ModuleName.re *)
229+
(* e.g. "dst" in case of dst/ModuleName.res *)
233230
let walkUpOutputDir =
234231
outputFileRelativeDir |> pathToList
235232
|> List.map (fun _ -> Filename.parent_dir_name)

jscomp/gentype/Paths.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let getBsConfigFile ~projectRoot =
6161
match bsconfig |> Sys.file_exists with true -> Some bsconfig | false -> None
6262

6363
(** Find the relative path from /.../bs/lib
64-
e.g. /foo/bar/bs/lib/src/Hello.re --> src/Hello.re *)
64+
e.g. /foo/bar/bs/lib/src/Hello.res --> src/Hello.res *)
6565
let relativePathFromBsLib fileName =
6666
if Filename.is_relative fileName then fileName
6767
else
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Use the annotations, and definitions, from the .re file
1+
// Use the annotations, and definitions, from the .res file
22
@@genType.ignoreInterface
33

44
@genType type t

jscomp/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {default as makeNotChecked} from './hookExample';
66

77
import {default as defaultNotChecked} from './hookExample';
88

9-
// In case of type error, check the type of 'make' in 'ImportHookDefault.re' and './hookExample'.
9+
// In case of type error, check the type of 'make' in 'ImportHookDefault.res' and './hookExample'.
1010
export const makeTypeChecked: React.ComponentType<{
1111
readonly person: person;
1212
readonly children: React.ReactNode;
@@ -20,7 +20,7 @@ export const make: unknown = makeTypeChecked as React.ComponentType<{
2020
readonly renderMe: ImportHooks_renderMe<string>
2121
}>;
2222

23-
// In case of type error, check the type of 'default' in 'ImportHookDefault.re' and './hookExample'.
23+
// In case of type error, check the type of 'default' in 'ImportHookDefault.res' and './hookExample'.
2424
export const defaultTypeChecked: React.ComponentType<{
2525
readonly person: person;
2626
readonly children: React.ReactNode;

jscomp/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {makeRenamed as makeRenamedNotChecked} from './hookExample';
66

77
import {foo as fooNotChecked} from './hookExample';
88

9-
// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.re' and './hookExample'.
9+
// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.res' and './hookExample'.
1010
export const makeRenamedTypeChecked: React.ComponentType<{
1111
readonly actions?: JSX.Element;
1212
readonly person: person;
@@ -22,7 +22,7 @@ export const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentTyp
2222
readonly renderMe: renderMe<any>
2323
}>;
2424

25-
// In case of type error, check the type of 'foo' in 'ImportHooks.re' and './hookExample'.
25+
// In case of type error, check the type of 'foo' in 'ImportHooks.res' and './hookExample'.
2626
export const fooTypeChecked: (_1:{ readonly person: person }) => string = fooNotChecked;
2727

2828
// Export 'foo' early to allow circular import from the '.bs.js' file.

jscomp/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import {default as defaultNotChecked} from './';
66

7-
// In case of type error, check the type of 'default' in 'ImportIndex.re' and './'.
7+
// In case of type error, check the type of 'default' in 'ImportIndex.res' and './'.
88
export const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked;
99

1010
// Export '$$default' early to allow circular import from the '.bs.js' file.

0 commit comments

Comments
 (0)