- Make the
unprocessed
alert fatal by default (#1135) - support
-H
for hidden include dirs in OCaml 5.2 (#1137) - support
[@mel.*]
attributes in uncurried externals (#1140) - add Worker types to
melange.dom
(#1147) - Add support for dynamic
import()
(#1164) - Fix code generation of custom
true
/false
constructors (#1175) - Fix code generation of OCaml objects that refers to an init variable in scope (#1183)
- Support
[@mel.as "string"]
in variant definitions (#884) - BREAKING: remove
[@@deriving jsConverter]
for variant definitions (#884). Use[@mel.as "string here"]
instead. - Support OCaml 5.3 (#1168)
- Upgrade Stdlib to the OCaml 5.3 Stdlib (#1182)
- Support
[@mel.tag "the_tag"]
in variant definitions (#1189)- combined with
[@mel.as ..]
in variant definitions and inline record payloads, Melange can now express types for discriminated union object shapes.
- combined with
- Support
-bin-annot-occurrences
on OCaml 5.2 (#1132)
- CLI: passing
--eval
tomelc
now works as expected (#1040) - runtime: add some bindings to
Js.Bigint
(#1044) - core: emit
throw new Error(..)
rather than throwing a JS object with the Melange exception payload (#1036) - stdlib: fix runtime primitive for
Float.{min,max}
and related functions (#1050) - core: emit
let
instead ofvar
in compiled JS (#1019) - core: in compiled JS, stop generating closures in loops that capture mutable variables (#1020)
- runtime: add bindings to
Js.Set
(#1047) - runtime: add minimal bindings for JS iterators (#1060)
- core: in compiled JS, emit
const
for variables that Melange knows aren't going to be reassigned (#1019, #1059). - runtime: add minimal bindings for JS iterators (#1060)
- core: handle missing
.cmj
when compiling dune virtual libraries (#1067, fixes #658) - core: print lambda IR after TRMC pass when
--drawlambda
is passed (#1072) - core: remove unnecessary internal code from melange-compiler-libs, slimming down the melange executable and speeding up the build (#1075)
- core: implement warning 51 in Melange (
wrong-tailcall-expectation
)- This warning had previously been disabled entirely in the typechecker version that Melange uses. It becomes more important with TRMC support added in Melange 2.1.0.
- core: accept
esm{,-global}
in addition toes6{,-global}
for--mel-module-type
; accept--mel-module-system
in addition to--mel-module-type
too (#1086). - core: upgrade the OCaml type checker version to OCaml 5.2 (#1074)
- core: upgrade the Stdlib to match OCaml 5.2's (#1078)
- runtime: add bindings for functions in
WeakMap
andWeakSet
(#1058) - runtime: add bindings to
Js.Map
(#1101) - core: fix a recursive module code generation bug when submodule names inside recursive modules are mangled (#1111)
- BREAKING: remove
Belt
as a dependency ofStdlib
(#796, #797)- Melange no longer includes the
melange.belt
library by default; after this release, you need to add(libraries melange.belt)
to your melange stanzas.
- Melange no longer includes the
- Melange Runtime / Stdlib: remove deprecated modules and functions
(#817):
Js.List
: useStdlib.List
orBelt.List
instead;Js.Null_undefined
: useJs.Nullable
instead;Js.Option
: useStdlib.Option
orBelt.Option
instead;Js.Result
: useStdlib.Result
orBelt.Result
instead;Js.Cast
.
- BREAKING:
- BREAKING(runtime): rename a few keys with legacy names
(#819):
- Exception ID
RE_EXN_ID
toMEL_EXN_ID
BS_PRIVATE_NESTED_SOME_NONE
option marker toMEL_PRIVATE_NESTED_SOME_NONE
- Exception ID
- BREAKING(runtime): unify pipe-first / pipe-last libraries in
Js
modules (#731, #893, #895, #899, #963, #964, #965)- Modules ending with
2
(e.g.Js.String2
,Js.Array2
,Js.TypedArray2
) are no longer available in Melange - The functions in their corresponding modules now take labeled arguments
and one positional argument, prioritizing the usage of
|>
but still allowing|.
(->
in Reason) when optionally labeled arguments aren't omitted.
- Modules ending with
- BREAKING(runtime): remove deprecated functions from
Js.*
modules (#897) - Consistently handle empty payloads in externals: (#852)
- Fix crash when pattern matching in the presence of complex constant inlining (#871)
- Support renaming modules in the output JS with
@mel.as
(#879) - Support
@mel.as
in@mel.obj
labelled arguments (#834) - Fix error location for empty string interpolation in
{j| .. |j}
(#888, #890) - Add
Js.Obj.assign
to merge 2 JS objects immutably (#900, #795) - Turn off warning 20 (
ignored-extra-argument
) for%mel.raw
application (#915) - Deprecate non-namespaced FFI attributes such as
@string
or@obj
in favor of e.g.@mel.string
and@mel.obj
(#923) - Improve error messages returned by
melange.ppx
(#924, #928, #931, #936) - Improve error messages in the Melange compiler core (#941)
- Fix a typo in
Node.node_module
(pa{r,}rent) #929 - BREAKING(runtime): Remove
Js.null_undefined
in favor ofJs.nullable
(#930) - BREAKING(ppx): disallow attribute payload in
[@mel.new]
in favor of the external primitive string (#938) - FFI: support
@mel.new
alongisde@mel.send
/@mel.send.pipe
(#906) - Don't process
[@mel.config]
twice (#940) - BREAKING(ppx): remove
@mel.splice
in favor of@mel.variadic
(#943) - Introduce an
unprocessed
alert to detect unprocessed Melange code, hinting users to preprocess withmelange.ppx
(#911, #945, #947) - Implement more Stdlib functions in modules String, Bytes, Buffer, BytesLabels and StringLabels (#711, #956, #958, #961)
- BREAKING(runtime): Improve
Js.Int
and change some of its functions to pipe-last (#966) - BREAKING(runtime): Improve
Js.Date
and change some of its functions to pipe-last (#967) - BREAKING(runtime): Improve
Js.Re
and change some of its functions to pipe-last (#969, #989) - BREAKING(runtime): Improve docstrings in the
Node
library and change some of its functions to pipe-last (#970) - BREAKING(runtime): Improve
Js.Float
and change some of its functions to pipe-last (#968) - BREAKING(runtime): Remove unnecessary
unit
argument fromJs.Math.atan2
(#972) - BREAKING(runtime): Add labeled arguments to the callbacks in
Js.Global
(#973) - BREAKING(runtime): Add a label to
Js.Dict.map
's function argument pipe-last (#974) - runtime(
Js.String
): deprecateanchor
,link
andsubstr
functions to match the JS standard deprecations #982 - Fix error messages related to
[@mel.meth]
arity mismatches (PR) - ppx: split
[@@deriving abstract]
into two (#987):[@@deriving jsProperties]
derives a JS object creation function that can generate a JS object with optional keys (when using[@mel.optiona]
)[@@deriving getSet]
derives getter / setter functions for the JS object derived by the underlying record.
- ppx: Deprecate
[@@deriving abstract]
(#979) - BREAKING(dom): remove
Dom.Storage2
in favor ofDom.Storage
(988) - playground: fix reporting of PPX alerts (#991)
- Move the unicode string transformation to the compiler core so that it runs
after PPX preprocessing
(#995,
#1037)
- PPXes will no longer see the internal
*j
delimiter in unicode strings and can hook on eitherj
orjs
- PPXes will no longer see the internal
- Preserve unicode in format strings (#1001)
- Support
@mel.as
in%mel.obj
(#1004) - Upgrade the Melange JS parser to Flow v0.225.1 (#1012)
- fix: add a newline after
%mel.raw
expressions to avoid breaking JS output when they contain single line comments (#1017) - BREAKING(core): only allow strings in
{j| ... |j}
interpolation (#1024)
- BREAKING(core): require OCaml 5.1.1 (#926)
- Add TRMC (Tail Recursion Modulo Cons) support (#743)
- [playground]: Add
melange.dom
to bundle (#779) - Fix
Sys.argv
runtime to match declared type (#791) - Make
'a Js.t
abstract (again), fixing a regression when bringing back OCaml-style objects BuckleScript (#786) - Don't issue "unused attribute" warning for well-formed
@@@mel.config
in interface files (#800) - Stop showing
Js__.Js_internal
in types and error messages (#798) - Fix printing of OCaml-style objects and uncurried application (#807)
- Build executables for bytecode-only platforms too (#596)
- Move the entire builtin PPX to
melange.ppx
. Preprocessing withmelange.ppx
will needed in most cases going forward, as it's responsible for processingexternal
declarations,@deriving
attributes and more, compared to the previous release wheremelange.ppx
just processed AST extension nodes (#583) - Remove old BuckleScript-style conditional compilation (#605)
- Don't emit JS import / require paths with
foo/./bar.js
(#598, #612) - Wrap the melange runtime
(#624,
#637). After this change,
Melange exposes fewer toplevel modules. Melange runtime / stdlib modules are
now wrapped under:
Caml*
/Curry
modules are part of the runtime and keep being exposed as beforeJs.*
contains all the modules previously accessible viaJs_*
, e.g.Js_int
->Js.Int
Belt.*
wraps all theBelt
modules;Belt_List
etc. are not exposed anymore, but rather nested underBelt
, e.g.Belt.List
Node.*
: we now ship amelange.node
library that includes the modules containing Node.js bindings. After this change, users will have to depend onmelange.node
explicitly in order to use theNode.*
modulesDom.*
: we now ship amelange.dom
library that includes the modules containing Node.js bindings. This library is included by default so theDom
module will always be available in Melange projects.
- Disable warning 61 (
unboxable-type-in-prim-decl
) for externals generated by Melange (#641, #643) - Add
--rectypes
(#644) to enable recursive types - [melange.ppx]: Deprecate
bs.*
attributes in favor ofmel.*
(#566, #662, #663) - [melange]: Fix field access code generation when
open
in inline functor applications (#661, #664) - [melange]: Upgrade the OCaml typechecker version to 5.1 (#668)
- [melange.ppx]: Deprecate
[@@mel.val]
and suggest its removal. This attribute is redundant and unnecessary (#675, #678) - [melange]: remove old, unused CLI flags:
-bs-ns
,-bs-cmi
,-bs-cmj
,-bs-no-builtin-ppx
,-bs-super-errors
(#686). - [melange]: generate correct code for types with the
option
shape (#700). - [melange]: stop exporting
$$default
in the generated JavaScript when using ES6 default exportslet default = ..
(#708). - [melange]: allow exporting invalid OCaml identifiers in the resulting
JavaScript with
@mel.as
(#714, fixes #713). - [melange]: Allow using
@mel.as
in external declarations without explicitly annotating@mel.{string,int}
(#722, fixes #578). - [melange]: Allow using
@mel.unwrap
in external declarations with@mel.obj
(#724, fixes #679). - [melange]: Support renaming fields in inline records / record extensions with
@mel.as
(#732, fixes #730).
- melange: print an error message if
$MELANGELIB
is set to a directory that doesn't exist (#449) - melange: fix bug where
--bs-module-name
didn't always affect generated JS file casing (#446) - melange: fix bug where
-o output.js
didn't always write a JavaScript file (#454) - melange: remove the
-bs-read-cmi
flag in favor of the builtin-intf-suffix
flag, standard in OCaml (#458, #460) - melange: return an actionable error message when no output is specified
with
-impl
/-intf
(#465, #466) - melange: use
Object.prototype.hasOwnProperty
in theCaml_obj
runtime (#469) - melange: transform
NonEscapeCharacter
correctly in JS strings (those written using{js|string here|js}
) (#469) - melange: define
MELANGE
conditional compilation variable (#472) - melange: Make
Pervasives
exactly match theStdlib
behavior (#476) - melange: fix unbound error when trying to use
Printexc.exn_slot_id
(#482) - melange: fix codegen issue accessing a nested module path that is also
include
d (#487) - melange: preserve the correct command-line order for load path directories (#492)
- melange: respect the
-nostdlib
option; don't add stdlib / runtime to the load path in that case (#496) - melange: build the Melange runtime / stdlib / runtime tests with the dune integration (#493). Thus melange now requires Dune 3.8.
- melange: allow shadowing sub-modules of Stdlib in user projects (#512)
- melange, reactjs-jsx-ppx: introduce a
reactjs-jsx-ppx
package, remove its dependency from melange (#517) - melange: remove the
--bs-jsx <version>
flag frommelc
now thatreactjs-jsx-ppx
is a separate package (#525) - melange: add
melpp
executable to preprocess#if
conditionals with the melange parser (#539) - mel: delete the
mel
package. The dune integration is now the only officially supported workflow for orchestrating melange builds (#546) - melange: Extract
melange.ppx
from the melange package. This preprocessing step interprets extensions such as%bs.obj
,%bs.raw
and%bs.re
,[@@deriving {abstract,accessors,jsConverters}]
andexternal
declarations. (#534) - melange: allow installing melange in more OCaml versions and compiler switches. Melange now migrates binary AST to the version it understands (#548)
- melange: don't run anonymous args function from
[@@@bs.config {flags = [| ... |]}]
attributes (#554) - melange: add
--preamble
flag to add a preamble to emitted JS. An example is"use client";
in React Server Components, which needs to appear before imports (#545, #574) - melange: turn off warning 20 (
ignore-extra-argument
) by default. This warning is rarely useful in Melange due to false positives when invoking functions defined with%bs.raw
(#488, #576)
ppx_rescript_compat
(ReScript compatibility layer): fix conversion for cases such asfoo["bar"] = assignment
(#441):- These are now correctly converted to the OCaml equivalent:
foo##bar #= assignment
- These are now correctly converted to the OCaml equivalent:
- mel: fix merlin generation, broken since
mel
was moved to its own package (#442)
- Disable warning 69 (
unused-field
in record) for the private record generated by thebs.deriving
attribute (#414) - Disable warning 20 (
ignored-extra-argument
) when applyingfoo##fn arg1 arg2
(#416):- in cases such as
external x : < .. > Js.t = ""
, the typechecker doesn't know the arity of the function, even though Melange will emit an uncurried function call.
- in cases such as
- Disable warning 61 (
unboxable-type-in-prim-decl
) inexternal
declarations (#415):- Melange externals are substantially different from OCaml externals. This warning doesn't make sense in a JS runtime.
- melc: introduce
--bs-module-name
flag to specify the original file name for the current compilation unit (#413)- Dune's namespacing implementation generates modules such as
lib__Original_name
. Passing--bs-module-name original_name
allows melange to issue correctimport
/require
statements to the unmangled JS file names.
- Dune's namespacing implementation generates modules such as
- melange Introduce 2 explicit modes of JavaScript compilation:
- "Batch compilation": produces
.cmj
and.js
files at the same time (this is the previous behavior -- using--bs-package-output MODULE_SYSTEM:REL_PATH:JS_EXTENSION
) - "Separate emission": produces only
.cmj
files with--bs-stop-after-cmj --bs-package-output REL_PATH_ONLY
, and allows emitting JavaScript files separately, with--bs-module-type MODULE_SYSTEM -o TARGET_FILE.JS_EXTENSION
(#384)
- "Batch compilation": produces
- mel: Fix
mel build --watch
exiting after the first change (#401) - melange: Remove dependency on
reason
. Reason syntax users should installreason
from their preferred package manager instead, and Melange / Dune will find it in$PATH
(#409) - melange: Remove dependency on
napkin
(the ReScript syntax parser). Users that depend on libraries written in ReScript syntax should install themel
package and Melange / Dune will find therescript_syntax
binary in$PATH
(#411)
- Initial release supporting OCaml 4.14.
- Initial public release
This is the only release of Melange that supports OCaml 4.12.