-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support @mel.as renaming for modules (#879)
* test: show that modules can't be renamed in the output * feat: support `@mel.as` renaming for modules * chore: add changelog entry
- Loading branch information
1 parent
10bf73a
commit 9f09d2c
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Use `[@mel.as]` to change how module output name in resulting JS | ||
|
||
$ . ./setup.sh | ||
$ cat > dune-project <<EOF | ||
> (lang dune 3.8) | ||
> (using melange 0.1) | ||
> EOF | ||
$ cat > dune <<EOF | ||
> (melange.emit | ||
> (emit_stdlib false) | ||
> (preprocess (pps melange.ppx)) | ||
> (target js-out)) | ||
> EOF | ||
$ cat > x.ml <<EOF | ||
> module[@mel.as "Obj"] Object = struct end | ||
> EOF | ||
$ dune build @melange | ||
$ cat _build/default/js-out/x.js | ||
// Generated by Melange | ||
'use strict'; | ||
var Obj = {}; | ||
exports.Obj = Obj; | ||
/* No side effect */ | ||
Also applies to signatures | ||
$ dune clean | ||
$ cat > x.ml <<EOF | ||
> module[@mel.as "Obj2"] Object = struct end | ||
> EOF | ||
$ cat > x.mli <<EOF | ||
> module[@mel.as "Obj2"] Object : sig end | ||
> EOF | ||
$ dune build @melange | ||
$ cat _build/default/js-out/x.js | ||
// Generated by Melange | ||
'use strict'; | ||
var Obj2 = {}; | ||
exports.Obj2 = Obj2; | ||
/* No side effect */ | ||