diff --git a/jscomp/bsb/bsb_file_groups.ml b/jscomp/bsb/bsb_file_groups.ml index 03a234a65b..dac20e07c6 100644 --- a/jscomp/bsb/bsb_file_groups.ml +++ b/jscomp/bsb/bsb_file_groups.ml @@ -38,7 +38,7 @@ type file_group = { is_dev : bool; generators : build_generator list; (* output of [generators] should be added to [sources], - if it is [.ml,.mli,.re,.rei] + if it is [.ml,.mli,.res,.resi] *) } diff --git a/jscomp/bsb/bsb_file_groups.mli b/jscomp/bsb/bsb_file_groups.mli index fc0176bded..6abc224941 100644 --- a/jscomp/bsb/bsb_file_groups.mli +++ b/jscomp/bsb/bsb_file_groups.mli @@ -39,7 +39,7 @@ type file_group = { (* false means not in dev mode *) generators : build_generator list; (* output of [generators] should be added to [sources], - if it is [.ml,.mli,.re,.rei] + if it is [.ml,.mli,.res,.resi] *) } diff --git a/jscomp/gentype/EmitJs.ml b/jscomp/gentype/EmitJs.ml index 8a939ff3af..a61b0e16f0 100644 --- a/jscomp/gentype/EmitJs.ml +++ b/jscomp/gentype/EmitJs.ml @@ -229,7 +229,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName ("In case of type error, check the type of '" ^ valueName ^ "' in '" ^ (fileName |> ModuleName.toString) - ^ ".re'" ^ " and '" + ^ ".res'" ^ " and '" ^ (importPath |> ImportPath.emit) ^ "'.") ~early:true ~emitters ~name:valueNameTypeChecked ~type_ diff --git a/jscomp/gentype/GenTypeMain.ml b/jscomp/gentype/GenTypeMain.ml index 65b3de03f6..1184778246 100644 --- a/jscomp/gentype/GenTypeMain.ml +++ b/jscomp/gentype/GenTypeMain.ml @@ -104,9 +104,9 @@ let processCmtFile cmt = let isInterface = Filename.check_suffix cmtFile ".cmti" in let resolver = ModuleResolver.createLazyResolver ~config - ~extensions:[ ".re"; ".res"; EmitType.shimExtension ] + ~extensions:[ ".res"; EmitType.shimExtension ] ~excludeFile:(fun fname -> - fname = "React.re" || fname = "ReasonReact.re") + fname = "React.res" || fname = "ReasonReact.res") in let inputCMT, hasGenTypeAnnotations = let inputCMT = readCmt cmtFile in diff --git a/jscomp/gentype/ModuleResolver.ml b/jscomp/gentype/ModuleResolver.ml index 53106049d5..a54da792e0 100644 --- a/jscomp/gentype/ModuleResolver.ml +++ b/jscomp/gentype/ModuleResolver.ml @@ -195,20 +195,17 @@ let apply ~resolver ~useBsDependencies moduleName = moduleName |> Lazy.force resolver.lazyFind ~useBsDependencies (** Resolve a reference to ModuleName, and produce a path suitable for require. - E.g. require "../foo/bar/ModuleName.ext" where ext is ".re" or ".js". *) + E.g. require "../foo/bar/ModuleName.ext" where ext is ".res" or ".js". *) let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative ~resolver ~useBsDependencies moduleName = let outputFileRelativeDir = - (* e.g. src if we're generating src/File.re.js *) + (* e.g. src if we're generating src/File.bs.js *) Filename.dirname outputFileRelative in let outputFileAbsoluteDir = config.projectRoot +++ outputFileRelativeDir in - let moduleNameReFile = - (* Check if the module is in the same directory as the file being generated. - So if e.g. project_root/src/ModuleName.re exists. *) - outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".re") - in let moduleNameResFile = + (* Check if the module is in the same directory as the file being generated. + So if e.g. project_root/src/ModuleName.res exists. *) outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".res") in let candidate = @@ -216,7 +213,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative moduleName |> ImportPath.fromModule ~dir:Filename.current_dir_name ~importExtension in - if Sys.file_exists moduleNameReFile || Sys.file_exists moduleNameResFile then + if Sys.file_exists moduleNameResFile then candidate else let rec pathToList path = @@ -229,7 +226,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative match moduleName |> apply ~resolver ~useBsDependencies with | None -> candidate | Some (resolvedModuleDir, case, bsDependencies) -> - (* e.g. "dst" in case of dst/ModuleName.re *) + (* e.g. "dst" in case of dst/ModuleName.res *) let walkUpOutputDir = outputFileRelativeDir |> pathToList |> List.map (fun _ -> Filename.parent_dir_name) diff --git a/jscomp/gentype/Paths.ml b/jscomp/gentype/Paths.ml index 32b1881dc2..16b57ee4e1 100644 --- a/jscomp/gentype/Paths.ml +++ b/jscomp/gentype/Paths.ml @@ -61,7 +61,7 @@ let getBsConfigFile ~projectRoot = match bsconfig |> Sys.file_exists with true -> Some bsconfig | false -> None (** Find the relative path from /.../bs/lib - e.g. /foo/bar/bs/lib/src/Hello.re --> src/Hello.re *) + e.g. /foo/bar/bs/lib/src/Hello.res --> src/Hello.res *) let relativePathFromBsLib fileName = if Filename.is_relative fileName then fileName else diff --git a/jscomp/gentype_tests/typescript-react-example/src/IgnoreInterface.resi b/jscomp/gentype_tests/typescript-react-example/src/IgnoreInterface.resi index 9c7b72b9c6..7a7cf64707 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/IgnoreInterface.resi +++ b/jscomp/gentype_tests/typescript-react-example/src/IgnoreInterface.resi @@ -1,4 +1,4 @@ -// Use the annotations, and definitions, from the .re file +// Use the annotations, and definitions, from the .res file @@genType.ignoreInterface @genType type t diff --git a/jscomp/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx b/jscomp/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx index 8e81e77f70..53527ec0de 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx +++ b/jscomp/gentype_tests/typescript-react-example/src/ImportHookDefault.gen.tsx @@ -6,7 +6,7 @@ import {default as makeNotChecked} from './hookExample'; import {default as defaultNotChecked} from './hookExample'; -// In case of type error, check the type of 'make' in 'ImportHookDefault.re' and './hookExample'. +// In case of type error, check the type of 'make' in 'ImportHookDefault.res' and './hookExample'. export const makeTypeChecked: React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; @@ -20,7 +20,7 @@ export const make: unknown = makeTypeChecked as React.ComponentType<{ readonly renderMe: ImportHooks_renderMe }>; -// In case of type error, check the type of 'default' in 'ImportHookDefault.re' and './hookExample'. +// In case of type error, check the type of 'default' in 'ImportHookDefault.res' and './hookExample'. export const defaultTypeChecked: React.ComponentType<{ readonly person: person; readonly children: React.ReactNode; diff --git a/jscomp/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx b/jscomp/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx index 627a68e112..0ffc03894d 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx +++ b/jscomp/gentype_tests/typescript-react-example/src/ImportHooks.gen.tsx @@ -6,7 +6,7 @@ import {makeRenamed as makeRenamedNotChecked} from './hookExample'; import {foo as fooNotChecked} from './hookExample'; -// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.re' and './hookExample'. +// In case of type error, check the type of 'makeRenamed' in 'ImportHooks.res' and './hookExample'. export const makeRenamedTypeChecked: React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; @@ -22,7 +22,7 @@ export const makeRenamed: unknown = makeRenamedTypeChecked as React.ComponentTyp readonly renderMe: renderMe }>; -// In case of type error, check the type of 'foo' in 'ImportHooks.re' and './hookExample'. +// In case of type error, check the type of 'foo' in 'ImportHooks.res' and './hookExample'. export const fooTypeChecked: (_1:{ readonly person: person }) => string = fooNotChecked; // Export 'foo' early to allow circular import from the '.bs.js' file. diff --git a/jscomp/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx b/jscomp/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx index d0e0fdca0c..be5656abba 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx +++ b/jscomp/gentype_tests/typescript-react-example/src/ImportIndex.gen.tsx @@ -4,7 +4,7 @@ import {default as defaultNotChecked} from './'; -// In case of type error, check the type of 'default' in 'ImportIndex.re' and './'. +// In case of type error, check the type of 'default' in 'ImportIndex.res' and './'. export const defaultTypeChecked: React.ComponentType<{ readonly method?: "push" | "replace" }> = defaultNotChecked; // Export '$$default' early to allow circular import from the '.bs.js' file. diff --git a/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx b/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx index 205508536a..4963838083 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx +++ b/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.gen.tsx @@ -22,31 +22,31 @@ import {default as defaultNotChecked} from './MyMath'; import * as Curry__Es6Import from 'rescript/lib/es6/curry.js'; const Curry: any = Curry__Es6Import; -// In case of type error, check the type of 'round' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'round' in 'ImportJsValue.res' and './MyMath'. export const roundTypeChecked: (_1:number) => number = roundNotChecked; // Export 'round' early to allow circular import from the '.bs.js' file. export const round: unknown = roundTypeChecked as (_1:number) => number; -// In case of type error, check the type of 'area' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'area' in 'ImportJsValue.res' and './MyMath'. export const areaTypeChecked: (_1:point) => number = areaNotChecked; // Export 'area' early to allow circular import from the '.bs.js' file. export const area: unknown = areaTypeChecked as (_1:point) => number; -// In case of type error, check the type of 'returnMixedArray' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'returnMixedArray' in 'ImportJsValue.res' and './MyMath'. export const returnMixedArrayTypeChecked: () => numberOrString[] = returnMixedArrayNotChecked; // Export 'returnMixedArray' early to allow circular import from the '.bs.js' file. export const returnMixedArray: unknown = returnMixedArrayTypeChecked as () => numberOrString[]; -// In case of type error, check the type of 'useColor' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'useColor' in 'ImportJsValue.res' and './MyMath'. export const useColorTypeChecked: (_1:color) => number = useColorNotChecked; // Export 'useColor' early to allow circular import from the '.bs.js' file. export const useColor: unknown = useColorTypeChecked as (_1:color) => number; -// In case of type error, check the type of 'higherOrder' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'higherOrder' in 'ImportJsValue.res' and './MyMath'. export const higherOrderTypeChecked: (_1:((_1:number, _2:number) => number)) => number = higherOrderNotChecked; // Export 'higherOrder' early to allow circular import from the '.bs.js' file. @@ -58,7 +58,7 @@ export const higherOrder: unknown = function (Arg1: any) { return result } as (_1:((_1:number, _2:number) => number)) => number; -// In case of type error, check the type of 'convertVariant' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'convertVariant' in 'ImportJsValue.res' and './MyMath'. export const convertVariantTypeChecked: (_1:variant) => variant = convertVariantNotChecked; // Export 'convertVariant' early to allow circular import from the '.bs.js' file. @@ -71,13 +71,13 @@ export const convertVariant: unknown = function (Arg1: any) { : {TAG: 1, _0:result.value} as any } as (_1:variant) => variant; -// In case of type error, check the type of 'polymorphic' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'polymorphic' in 'ImportJsValue.res' and './MyMath'. export const polymorphicTypeChecked: (_1:a) => a = polymorphicNotChecked; // Export 'polymorphic' early to allow circular import from the '.bs.js' file. export const polymorphic: unknown = polymorphicTypeChecked as (_1:a) => a; -// In case of type error, check the type of 'default' in 'ImportJsValue.re' and './MyMath'. +// In case of type error, check the type of 'default' in 'ImportJsValue.res' and './MyMath'. export const defaultTypeChecked: number = defaultNotChecked; // Export '$$default' early to allow circular import from the '.bs.js' file. diff --git a/jscomp/gentype_tests/typescript-react-example/src/JSXV4.gen.tsx b/jscomp/gentype_tests/typescript-react-example/src/JSXV4.gen.tsx index fe1b67a982..2e6c911712 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/JSXV4.gen.tsx +++ b/jscomp/gentype_tests/typescript-react-example/src/JSXV4.gen.tsx @@ -6,7 +6,7 @@ import {make as makeNotChecked} from './hookExample'; import * as React from 'react'; -// In case of type error, check the type of 'make' in 'JSXV4.re' and './hookExample'. +// In case of type error, check the type of 'make' in 'JSXV4.res' and './hookExample'. export const makeTypeChecked: React.ComponentType<{ readonly actions?: JSX.Element; readonly person: person; diff --git a/jscomp/gentype_tests/typescript-react-example/src/MyInput.gen.tsx b/jscomp/gentype_tests/typescript-react-example/src/MyInput.gen.tsx index 67c7d78233..43af5fc54a 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/MyInput.gen.tsx +++ b/jscomp/gentype_tests/typescript-react-example/src/MyInput.gen.tsx @@ -4,7 +4,7 @@ import {default as defaultNotChecked} from './MyInput'; -// In case of type error, check the type of 'default' in 'MyInput.re' and './MyInput'. +// In case of type error, check the type of 'default' in 'MyInput.res' and './MyInput'. export const defaultTypeChecked: React.ComponentType<{ readonly onFocus?: (_1:inputFocusEvent) => void }> = defaultNotChecked; // Export '$$default' early to allow circular import from the '.bs.js' file. diff --git a/jscomp/ounit_tests/ounit_string_tests.ml b/jscomp/ounit_tests/ounit_string_tests.ml index b077704950..7502e74232 100644 --- a/jscomp/ounit_tests/ounit_string_tests.ml +++ b/jscomp/ounit_tests/ounit_string_tests.ml @@ -72,12 +72,12 @@ let suites = (* __LOC__ >:: begin fun _ -> OUnit.assert_bool __LOC__ @@ List.for_all (fun x -> Ext_string.is_valid_source_name x = Good) - ["x.ml"; "x.mli"; "x.re"; "x.rei"; + ["x.ml"; "x.mli"; "x.res"; "x.resi"; "A_x.ml"; "ab.ml"; "a_.ml"; "a__.ml"; "ax.ml"]; OUnit.assert_bool __LOC__ @@ not @@ List.exists (fun x -> Ext_string.is_valid_source_name x = Good) - [".re"; ".rei";"..re"; "..rei"; "..ml"; ".mll~"; + [".res"; ".resi";"..res"; "..resi"; "..ml"; ".mll~"; "...ml"; "_.mli"; "_x.ml"; "__.ml"; "__.rei"; ".#hello.ml"; ".#hello.rei"; "a-.ml"; "a-b.ml"; "-a-.ml" ; "-.ml" @@ -486,7 +486,10 @@ let suites = (Ext_filename.module_name "a/b/c.d") "C"; string_eq - (Ext_filename.module_name "a/b/xc.re") + (Ext_filename.module_name "a/b/xc.res") + "Xc"; + string_eq + (Ext_filename.module_name "a/b/xc.resi") "Xc"; string_eq (Ext_filename.module_name "a/b/xc.ml") diff --git a/jscomp/test/ext_string_test.js b/jscomp/test/ext_string_test.js index 014e800457..e6ff377110 100644 --- a/jscomp/test/ext_string_test.js +++ b/jscomp/test/ext_string_test.js @@ -493,11 +493,11 @@ function is_valid_source_name(name) { var x = check_any_suffix_case_then_chop(name, { hd: ".ml", tl: { - hd: ".re", + hd: ".res", tl: { hd: ".mli", tl: { - hd: ".rei", + hd: ".resi", tl: /* [] */0 } } diff --git a/jscomp/test/ext_string_test.ml b/jscomp/test/ext_string_test.ml index 7cbb4b58cb..5091d18962 100644 --- a/jscomp/test/ext_string_test.ml +++ b/jscomp/test/ext_string_test.ml @@ -363,9 +363,9 @@ type check_result = let is_valid_source_name name : check_result = match check_any_suffix_case_then_chop name [ ".ml"; - ".re"; + ".res"; ".mli"; - ".rei" + ".resi" ] with | None -> Suffix_mismatch | Some x -> diff --git a/lib/4.06.1/rescript.ml b/lib/4.06.1/rescript.ml index df3a112b63..647af071f0 100644 --- a/lib/4.06.1/rescript.ml +++ b/lib/4.06.1/rescript.ml @@ -4387,7 +4387,7 @@ type file_group = { (* false means not in dev mode *) generators : build_generator list; (* output of [generators] should be added to [sources], - if it is [.ml,.mli,.re,.rei] + if it is [.ml,.mli,.res,.resi] *) } @@ -4445,7 +4445,7 @@ type file_group = { is_dev : bool; generators : build_generator list; (* output of [generators] should be added to [sources], - if it is [.ml,.mli,.re,.rei] + if it is [.ml,.mli,.res,.resi] *) } diff --git a/lib/4.06.1/unstable/all_ounit_tests.ml b/lib/4.06.1/unstable/all_ounit_tests.ml index 2524808d9f..b10d320122 100644 --- a/lib/4.06.1/unstable/all_ounit_tests.ml +++ b/lib/4.06.1/unstable/all_ounit_tests.ml @@ -38647,12 +38647,12 @@ let suites = (* __LOC__ >:: begin fun _ -> OUnit.assert_bool __LOC__ @@ List.for_all (fun x -> Ext_string.is_valid_source_name x = Good) - ["x.ml"; "x.mli"; "x.re"; "x.rei"; + ["x.ml"; "x.mli"; "x.res"; "x.resi"; "A_x.ml"; "ab.ml"; "a_.ml"; "a__.ml"; "ax.ml"]; OUnit.assert_bool __LOC__ @@ not @@ List.exists (fun x -> Ext_string.is_valid_source_name x = Good) - [".re"; ".rei";"..re"; "..rei"; "..ml"; ".mll~"; + [".res"; ".resi";"..res"; "..resi"; "..ml"; ".mll~"; "...ml"; "_.mli"; "_x.ml"; "__.ml"; "__.rei"; ".#hello.ml"; ".#hello.rei"; "a-.ml"; "a-b.ml"; "-a-.ml" ; "-.ml" @@ -39061,7 +39061,10 @@ let suites = (Ext_filename.module_name "a/b/c.d") "C"; string_eq - (Ext_filename.module_name "a/b/xc.re") + (Ext_filename.module_name "a/b/xc.res") + "Xc"; + string_eq + (Ext_filename.module_name "a/b/xc.resi") "Xc"; string_eq (Ext_filename.module_name "a/b/xc.ml") diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index 63036f7600..6c0b129304 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -239914,20 +239914,17 @@ let apply ~resolver ~useBsDependencies moduleName = moduleName |> Lazy.force resolver.lazyFind ~useBsDependencies (** Resolve a reference to ModuleName, and produce a path suitable for require. - E.g. require "../foo/bar/ModuleName.ext" where ext is ".re" or ".js". *) + E.g. require "../foo/bar/ModuleName.ext" where ext is ".res" or ".js". *) let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative ~resolver ~useBsDependencies moduleName = let outputFileRelativeDir = - (* e.g. src if we're generating src/File.re.js *) + (* e.g. src if we're generating src/File.bs.js *) Filename.dirname outputFileRelative in let outputFileAbsoluteDir = config.projectRoot +++ outputFileRelativeDir in - let moduleNameReFile = - (* Check if the module is in the same directory as the file being generated. - So if e.g. project_root/src/ModuleName.re exists. *) - outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".re") - in let moduleNameResFile = + (* Check if the module is in the same directory as the file being generated. + So if e.g. project_root/src/ModuleName.res exists. *) outputFileAbsoluteDir +++ (ModuleName.toString moduleName ^ ".res") in let candidate = @@ -239935,7 +239932,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative moduleName |> ImportPath.fromModule ~dir:Filename.current_dir_name ~importExtension in - if Sys.file_exists moduleNameReFile || Sys.file_exists moduleNameResFile then + if Sys.file_exists moduleNameResFile then candidate else let rec pathToList path = @@ -239948,7 +239945,7 @@ let resolveModule ~(config : Config.t) ~importExtension ~outputFileRelative match moduleName |> apply ~resolver ~useBsDependencies with | None -> candidate | Some (resolvedModuleDir, case, bsDependencies) -> - (* e.g. "dst" in case of dst/ModuleName.re *) + (* e.g. "dst" in case of dst/ModuleName.res *) let walkUpOutputDir = outputFileRelativeDir |> pathToList |> List.map (fun _ -> Filename.parent_dir_name) @@ -240068,7 +240065,7 @@ let getBsConfigFile ~projectRoot = match bsconfig |> Sys.file_exists with true -> Some bsconfig | false -> None (** Find the relative path from /.../bs/lib - e.g. /foo/bar/bs/lib/src/Hello.re --> src/Hello.re *) + e.g. /foo/bar/bs/lib/src/Hello.res --> src/Hello.res *) let relativePathFromBsLib fileName = if Filename.is_relative fileName then fileName else @@ -241887,7 +241884,7 @@ let emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName ("In case of type error, check the type of '" ^ valueName ^ "' in '" ^ (fileName |> ModuleName.toString) - ^ ".re'" ^ " and '" + ^ ".res'" ^ " and '" ^ (importPath |> ImportPath.emit) ^ "'.") ~early:true ~emitters ~name:valueNameTypeChecked ~type_ @@ -243649,9 +243646,9 @@ let processCmtFile cmt = let isInterface = Filename.check_suffix cmtFile ".cmti" in let resolver = ModuleResolver.createLazyResolver ~config - ~extensions:[ ".re"; ".res"; EmitType.shimExtension ] + ~extensions:[ ".res"; EmitType.shimExtension ] ~excludeFile:(fun fname -> - fname = "React.re" || fname = "ReasonReact.re") + fname = "React.res" || fname = "ReasonReact.res") in let inputCMT, hasGenTypeAnnotations = let inputCMT = readCmt cmtFile in diff --git a/scripts/littlecase.js b/scripts/littlecase.js index 3c71fafbf4..ba17568e10 100644 --- a/scripts/littlecase.js +++ b/scripts/littlecase.js @@ -7,7 +7,7 @@ function copyReasonReact() { let dir = path.join(__dirname, "..", "..", "reason-react", "src"); let files = fs.readdirSync(dir); files.forEach(x => { - if (!(x.endsWith(".re") || x.endsWith(".rei"))) { + if (!(x.endsWith(".res") || x.endsWith(".resi"))) { return; } let little = x[0].toLowerCase() + x.slice(1); diff --git a/scripts/ninja.js b/scripts/ninja.js index 01bb53c00b..7c841506eb 100755 --- a/scripts/ninja.js +++ b/scripts/ninja.js @@ -567,9 +567,9 @@ function replaceCmj(x) { * @param {string} y */ function sourceToTarget(y) { - if (y.endsWith(".ml") || y.endsWith(".re") || y.endsWith(".res")) { + if (y.endsWith(".ml") || y.endsWith(".res")) { return replaceExt(y, ".cmj"); - } else if (y.endsWith(".mli") || y.endsWith(".rei") || y.endsWith(".resi")) { + } else if (y.endsWith(".mli") || y.endsWith(".resi")) { return replaceExt(y, ".cmi"); } return y; @@ -626,7 +626,6 @@ function ocamlDepForBscAsync(files, dir, depsMap) { */ function depModulesForBscAsync(files, dir, depsMap) { let ocamlFiles = files.filter(x => x.endsWith(".ml") || x.endsWith(".mli")); - let reFiles = files.filter(x => x.endsWith(".re") || x.endsWith(".rei")); let resFiles = files.filter(x => x.endsWith(".res") || x.endsWith(".resi")); /** * @@ -666,7 +665,7 @@ function depModulesForBscAsync(files, dir, depsMap) { cp.exec( `${bsc_exe} -modules -bs-syntax-only ${resFiles.join( " " - )} ${reFiles.join(" ")} ${ocamlFiles.join(" ")}`, + )} ${ocamlFiles.join(" ")}`, config, cb(resolve, reject) ); @@ -675,7 +674,7 @@ function depModulesForBscAsync(files, dir, depsMap) { } /** - * @typedef {('HAS_ML' | 'HAS_MLI' | 'HAS_BOTH' | 'HAS_RE' | 'HAS_RES' | 'HAS_REI' | 'HAS_RESI' | 'HAS_BOTH_RE' | 'HAS_BOTH_RES')} FileInfo + * @typedef {('HAS_ML' | 'HAS_MLI' | 'HAS_BOTH' | 'HAS_RES' | 'HAS_RESI' | 'HAS_BOTH_RES')} FileInfo * @param {string[]} sourceFiles * @returns {Map} * We make a set to ensure that `sourceFiles` are not duplicated @@ -693,12 +692,8 @@ function collectTarget(sourceFiles) { allTargets.set(name, "HAS_ML"); } else if (ext === ".mli") { allTargets.set(name, "HAS_MLI"); - } else if (ext === ".re") { - allTargets.set(name, "HAS_RE"); } else if (ext === ".res") { allTargets.set(name, "HAS_RES"); - } else if (ext === ".rei") { - allTargets.set(name, "HAS_REI"); } else if (ext === ".resi") { allTargets.set(name, "HAS_RESI"); } @@ -709,11 +704,6 @@ function collectTarget(sourceFiles) { allTargets.set(name, "HAS_BOTH"); } break; - case "HAS_RE": - if (ext === ".rei") { - allTargets.set(name, "HAS_BOTH_RE"); - } - break; case "HAS_RES": if (ext === ".resi") { allTargets.set(name, "HAS_BOTH_RES"); @@ -724,17 +714,11 @@ function collectTarget(sourceFiles) { allTargets.set(name, "HAS_BOTH"); } break; - case "HAS_REI": - if (ext === ".re") { - allTargets.set(name, "HAS_BOTH_RE"); - } - break; case "HAS_RESI": if (ext === ".res") { allTargets.set(name, "HAS_BOTH_RES"); } break; - case "HAS_BOTH_RE": case "HAS_BOTH": case "HAS_BOTH_RES": break; @@ -755,17 +739,14 @@ function scanFileTargets(allTargets, collIn) { var coll = collIn.concat(); allTargets.forEach((ext, mod) => { switch (ext) { - case "HAS_MLI": - case "HAS_REI": case "HAS_RESI": + case "HAS_MLI": coll.push(`${mod}.cmi`); break; case "HAS_BOTH_RES": - case "HAS_BOTH_RE": case "HAS_BOTH": coll.push(`${mod}.cmi`, `${mod}.cmj`); break; - case "HAS_RE": case "HAS_RES": case "HAS_ML": coll.push(`${mod}.cmi`, `${mod}.cmj`); @@ -793,9 +774,7 @@ function generateNinja(depsMap, allTargets, cwd, extraDeps = []) { let output_cmi = mod + ".cmi"; let input_ml = mod + ".ml"; let input_mli = mod + ".mli"; - let input_re = mod + ".re"; let input_res = mod + ".res"; - let input_rei = mod + ".rei"; let input_resi = mod + ".resi"; /** * @type {Override[]} @@ -821,26 +800,16 @@ function generateNinja(depsMap, allTargets, cwd, extraDeps = []) { mk([ouptput_cmj], [input_ml], "cc_cmi"); mk([output_cmi], [input_mli]); break; - case "HAS_BOTH_RE": - mk([ouptput_cmj], [input_re], "cc_cmi"); - mk([output_cmi], [input_rei], "cc"); - break; case "HAS_BOTH_RES": mk([ouptput_cmj], [input_res], "cc_cmi"); mk([output_cmi], [input_resi], "cc"); break; - case "HAS_RE": - mk([output_cmi, ouptput_cmj], [input_re], "cc"); - break; case "HAS_RES": mk([output_cmi, ouptput_cmj], [input_res], "cc"); break; case "HAS_ML": mk([output_cmi, ouptput_cmj], [input_ml]); break; - case "HAS_REI": - mk([output_cmi], [input_rei], "cc"); - break; case "HAS_RESI": mk([output_cmi], [input_resi], "cc"); break; @@ -1215,8 +1184,6 @@ ${mllList(ninjaCwd, [ var testDirFiles = fs.readdirSync(testDir, "ascii"); var sources = testDirFiles.filter(x => { return ( - x.endsWith(".re") || - x.endsWith(".rei") || x.endsWith(".resi") || x.endsWith(".res") || ((x.endsWith(".ml") || x.endsWith(".mli")) && !x.endsWith("bspack.ml")) diff --git a/scripts/rescript_convert.js b/scripts/rescript_convert.js index 02db4b94fb..e7f37419bf 100644 --- a/scripts/rescript_convert.js +++ b/scripts/rescript_convert.js @@ -4,7 +4,7 @@ var format_usage = `Usage: rescript convert [files] \`rescript convert\` converts the current directory -**This command removes old Reason/OCaml files and creates new ReScript +**This command removes old OCaml files and creates new ReScript files. Make sure your work is saved first!** `; @@ -33,7 +33,7 @@ var specs = [ * @param {string} file */ function shouldConvert(file) { - return [".ml", ".mli", ".re", ".rei"].some(x => file.endsWith(x)); + return [".ml", ".mli"].some(x => file.endsWith(x)); } /** diff --git a/scripts/tasks.js b/scripts/tasks.js index e64699b0e2..53eac5d4aa 100644 --- a/scripts/tasks.js +++ b/scripts/tasks.js @@ -88,8 +88,6 @@ function onSourceChange(eventType, filename) { filename.endsWith(".mll") || filename.endsWith(".mly") || filename.endsWith(".json") || - filename.endsWith(".re") || - filename.endsWith(".rei") || filename.endsWith(".res") || filename.endsWith(".resi") ) {