diff --git a/Makefile b/Makefile index 1644b595d..51d4d8537 100644 --- a/Makefile +++ b/Makefile @@ -62,3 +62,9 @@ format-check: ## Checks if format is correct build-playground: ## Builds the playground $(DUNE) build @playground-assets cd playground && yarn && yarn build + +.PHONY: move-v2.2.0-tag +move-v2.2.0-tag: ## Moves the v2.2.0 tag to the latest commit, useful to publish the v2.2.0 docs + git push origin :refs/tags/v2.2.0 + git tag -fa v2.2.0 + git push origin --tags diff --git a/docs/communicate-with-javascript.md b/docs/communicate-with-javascript.md index 475a61001..5c01d5488 100644 --- a/docs/communicate-with-javascript.md +++ b/docs/communicate-with-javascript.md @@ -2763,7 +2763,7 @@ type pet = { name : string } [@@deriving accessors] let pets = [| { name = "Brutus" }; { name = "Mochi" } |] -let () = pets |. Belt.Array.map name |. Js.Array.join ~sep:"&" |. Js.log +let () = pets |. Belt.Array.map name |. Js.Array2.joinWith "&" |. Js.log ``` ```reasonml [@deriving accessors] @@ -2771,7 +2771,7 @@ type pet = {name: string}; let pets = [|{name: "Brutus"}, {name: "Mochi"}|]; -let () = pets->(Belt.Array.map(name))->(Js.Array.join(~sep="&"))->Js.log; +let () = pets->(Belt.Array.map(name))->(Js.Array2.joinWith("&"))->Js.log; ``` Melange will generate a function for each field defined in the record. In this diff --git a/documentation-site.opam b/documentation-site.opam index e576b2ed8..92fb976bf 100644 --- a/documentation-site.opam +++ b/documentation-site.opam @@ -27,10 +27,8 @@ depends: [ ] dev-repo: "git+https://github.com/melange-re/melange-re.github.io.git" pin-depends: [ - [ "melange.dev" "git+https://github.com/melange-re/melange.git#7bec5dd58dbc0b20c9821c5b80c88c6d02df52e0" ] - [ "melange-playground.dev" "git+https://github.com/melange-re/melange.git#7bec5dd58dbc0b20c9821c5b80c88c6d02df52e0" ] - [ "reason-react.dev" "git+https://github.com/reasonml/reason-react.git#2a43311df12eb3988fd9729098928e6b03cfaa07" ] - [ "reason-react-ppx.dev" "git+https://github.com/reasonml/reason-react.git#2a43311df12eb3988fd9729098928e6b03cfaa07" ] + [ "melange.dev" "git+https://github.com/melange-re/melange.git#97ebd7d3d3f8fb66dbbf4df6691b0cf4b95dc153" ] + [ "melange-playground.dev" "git+https://github.com/melange-re/melange.git#97ebd7d3d3f8fb66dbbf4df6691b0cf4b95dc153" ] [ "cmarkit.dev" "git+https://github.com/dbuenzli/cmarkit.git#f37c8ea86fd0be8dba7a8babcee3682e0e047d91" ] ] build: [ diff --git a/playground/src/app.jsx b/playground/src/app.jsx index 41d9af073..39738c31f 100644 --- a/playground/src/app.jsx +++ b/playground/src/app.jsx @@ -137,7 +137,7 @@ function Sidebar({ onExampleClick }) {
{"Melange"} - {"dev"} + {"2.2.0"} {"OCaml"} @@ -149,7 +149,7 @@ function Sidebar({ onExampleClick }) { {"ReasonReact"} - {"dev"} + {"0.13.0"}
) : null} @@ -241,7 +241,7 @@ function ConsolePanel({ logs, clearLogs }) { ) } -function ProblemsPanel({ problems, warnings }) { +function ProblemsPanel({ problems }) { const defaultState = false; const [isCollapsed, setIsCollapsed] = React.useState(defaultState); const ref = React.useRef(null); @@ -263,11 +263,6 @@ function ProblemsPanel({ problems, warnings }) { ? problems.map((v) => v.msg).join("\n") : ""; - const warningsString = - warnings && warnings.length > 0 - ? warnings.map((v) => v.msg).join("\n") - : ""; - return ( <>
@@ -275,12 +270,7 @@ function ProblemsPanel({ problems, warnings }) {
- {(problems && problems.length > 0) - ?
{problemsString}
- : (warnings && warnings.length > 0) - ?
{warningsString}
- :
No problems!
- } + {problems && problems.length > 0 ? (
{problemsString}
) :
No problems!
}
) @@ -389,14 +379,14 @@ function OutputEditor({ language, value }) { } const problemFromCompile = ({ - js_warning_error_msg, + js_error_msg, row, column, endRow, endColumn, text, }) => ({ - msg: js_warning_error_msg, + msg: js_error_msg, loc: { row: row + 1, column: column + 1, @@ -406,13 +396,13 @@ const problemFromCompile = ({ }, }); -const toMonaco = (severity) => (problem) => ({ +const toMonaco = (problem) => ({ startLineNumber: problem.loc.row, startColumn: problem.loc.column, endLineNumber: problem.loc.endRow, endColumn: problem.loc.endColumn, message: problem.msg, - severity: severity, + severity: monaco.MarkerSeverity.Error, }); const compile = (language, code) => { @@ -422,12 +412,12 @@ const compile = (language, code) => { ? ocaml.compileRE(code) : ocaml.compileML(code); } catch (error) { - compilation = { js_warning_error_msg: error.message }; + compilation = { js_error_msg: error.message }; } if (compilation) { let problems = undefined; - if (compilation.js_warning_error_msg) { + if (compilation.js_error_msg) { problems = [problemFromCompile(compilation)]; } else if (compilation.warning_errors) { problems = compilation.warning_errors.map(problemFromCompile); @@ -435,7 +425,6 @@ const compile = (language, code) => { if (problems) { return { typeHints: [], - warnings: [], problems: problems, } } else { @@ -460,16 +449,14 @@ const compile = (language, code) => { } }), javascriptCode: compilation.js_code, - warnings: compilation.warnings.map(problemFromCompile), } } } else { return { typeHints: [], - warnings: [], problems: [ { - js_warning_error_msg: "No result was returned from compilation", + js_error_msg: "No result was returned from compilation", row, column, endRow, @@ -488,13 +475,7 @@ function updateMarkers(monaco, editorRef, compilation) { monaco.editor.setModelMarkers( editorRef.current.getModel(), owner, - compilation.problems.map(toMonaco(monaco.MarkerSeverity.Error)) - ); - } else if (compilation?.warnings) { - monaco.editor.setModelMarkers( - editorRef.current.getModel(), - owner, - compilation.warnings.map(toMonaco(monaco.MarkerSeverity.Warning)) + compilation.problems.map(toMonaco) ); } else { monaco.editor.removeAllMarkers(owner); @@ -618,7 +599,7 @@ function App() { React.useEffect(() => { updateMarkers(monaco, editorRef, compilation) - }, [monaco, compilation?.problems, compilation?.warnings]); + }, [monaco, compilation?.problems]); React.useEffect(() => { if (workerState.bundledCode) { @@ -717,7 +698,7 @@ function App() { - + diff --git a/scripts/add_canonical.ml b/scripts/add_canonical.ml index 2accc0d64..2f5b512ce 100644 --- a/scripts/add_canonical.ml +++ b/scripts/add_canonical.ml @@ -42,7 +42,7 @@ let replace_in_file ~orig_path file_path search_str = in let canonical_link = Printf.sprintf - "" (String.escaped relative_file_path) in diff --git a/scripts/add_canonical.t b/scripts/add_canonical.t index dacf417f9..7a132fdbf 100644 --- a/scripts/add_canonical.t +++ b/scripts/add_canonical.t @@ -7,7 +7,7 @@ Test add_canonical exe $ add_canonical . $ cat foo.html - + $ mkdir -p melange/Js/Global @@ -98,46 +98,46 @@ Test add_canonical exe $ add_canonical . $ cat ./melange/Js/Global/index.html - + $ cat ./melange/Node/Foo/index.html - + $ cat ./melange/Dom/Storage2/index.html - + $ cat ./melange/Belt/index.html - + $ cat ./melange/Belt/List/index.html - + $ cat ./melange/Stdlib/Int/index.html - + $ cat ./melange/Js/Typed_array/index.html - + $ cat ./melange/Js/TypedArray2/index.html - + $ cat ./melange/Js/WeakSet/index.html - + $ cat ./melange/Js/Fn/index.html - + $ cat ./melange/Belt/Set/String/index.html - + $ cat ./melange/Belt/Map/Dict/index.html - + $ cat ./melange/Belt/SortArray/Int/index.html - + $ cat ./melange/Melange_ppx/Ast_literal/index.html - + $ cat ./melange/Melange_ppx/External/index.html - + diff --git a/scripts/communicate-with-javascript.t b/scripts/communicate-with-javascript.t index 1e68f51d9..fe7edad71 100644 --- a/scripts/communicate-with-javascript.t +++ b/scripts/communicate-with-javascript.t @@ -142,7 +142,7 @@ file. To update the tests, run `dune build @extract-code-blocks`. > > let pets = [| { name = "Brutus" }; { name = "Mochi" } |] > - > let () = pets |. Belt.Array.map name |. Js.Array.join ~sep:"&" |. Js.log + > let () = pets |. Belt.Array.map name |. Js.Array2.joinWith "&" |. Js.log > EOF $ dune build @melange