Skip to content

Commit b05e3d9

Browse files
committed
fix gentype
1 parent 8a6a10c commit b05e3d9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

docs/docson/build-schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"definitions": {
44
"module-format": {
5-
"enum": ["commonjs", "es6", "es6-global"],
6-
"description": "es6-global generate relative `require` paths instead of relying on NodeJS' module resolution. Default: commonjs."
5+
"enum": ["esmodule", "commonjs", "es6", "es6-global"],
6+
"description": "es6 and es6-global are deprecated. Default: commonjs."
77
},
88
"suffix-spec": {
99
"type": "string",

jscomp/gentype/EmitType.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ let emitRequire ~importedValueOrComponent ~early ~emitters ~(config : Config.t)
382382
let importPathString = ImportPath.emit importPath in
383383
let output =
384384
match config.module_ with
385-
| ES6 when not importedValueOrComponent ->
385+
| ESModule when not importedValueOrComponent ->
386386
"import * as " ^ moduleNameString ^ " from '" ^ importPathString ^ "';"
387387
| _ ->
388388
"const " ^ moduleNameString ^ " = require('" ^ importPathString ^ "');"

jscomp/gentype/GenTypeConfig.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ModuleNameMap = Map.Make (ModuleName)
22

3-
type module_ = CommonJS | ES6
3+
type module_ = CommonJS | ESModule
44

55
(** Compatibility for `compilerOptions.moduleResolution` in TypeScript projects. *)
66
type moduleResolution =
@@ -41,7 +41,7 @@ let default =
4141
everything = false;
4242
exportInterfaces = false;
4343
generatedFileExtension = None;
44-
module_ = ES6;
44+
module_ = ESModule;
4545
moduleResolution = Node;
4646
namespace = None;
4747
platformLib = "";
@@ -53,7 +53,7 @@ let default =
5353

5454
let bsPlatformLib ~config =
5555
match config.module_ with
56-
| ES6 -> config.platformLib ^ "/lib/es6"
56+
| ESModule -> config.platformLib ^ "/lib/es6"
5757
| CommonJS -> config.platformLib ^ "/lib/js"
5858

5959
let getBsCurryPath ~config = Filename.concat (bsPlatformLib ~config) "curry.js"
@@ -154,9 +154,9 @@ let readConfig ~getConfigFile ~namespace =
154154
(* Give priority to gentypeconfig, followed by package-specs *)
155155
match (moduleString, packageSpecsModuleString) with
156156
| Some "commonjs", _ -> CommonJS
157-
| Some "es6", _ -> ES6
157+
| Some ("esmodule" | "es6"), _ -> ESModule
158158
| None, Some "commonjs" -> CommonJS
159-
| None, Some ("es6" | "es6-global") -> ES6
159+
| None, Some ("esmodule" | "es6" | "es6-global") -> ESModule
160160
| _ -> default.module_
161161
in
162162
let moduleResolution =

0 commit comments

Comments
 (0)