rescript
Version:
ReScript toolchain
1,191 lines (884 loc) • 69.6 kB
Markdown
# Changelog
> **Tags:**
>
> - :boom: [Breaking Change]
> - :eyeglasses: [Spec Compliance]
> - :rocket: [New Feature]
> - :bug: [Bug Fix]
> - :memo: [Documentation]
> - :house: [Internal]
> - :nail_care: [Polish]
# 10.1.2
- Fix an issue where error messages related to duplicate props were displayed without a loc and were unclear https://github.com/rescript-lang/syntax/pull/728
# 10.1.1
#### :boom: Breaking Change
- Parse the attributes of labelled argument to the pattern attributes of argument instead of function. https://github.com/rescript-lang/syntax/pull/722
- The prop names duplicated to keyword are not mangled automatically in JSX v4.
- Use `@as` instead
#### :rocket: New Feature
- Add support for empty inlined record literal `{}` for inlined records where all fields are optional https://github.com/rescript-lang/rescript-compiler/pull/5900
#### :bug: Bug Fix
- Prevent inlining of async functions in additional cases https://github.com/rescript-lang/rescript-compiler/issues/5860
- Revert to ubuntu-18.04 in CI to support Linux versions with older glibc https://github.com/rescript-lang/rescript-compiler/issues/5868
- Fix build error where aliasing arguments to `_` in the make function with JSX V4. https://github.com/rescript-lang/syntax/pull/720
- Fix parsing of spread props as an expression in JSX V4 https://github.com/rescript-lang/syntax/pull/721
- Fix dropping attributes from props in make function in JSX V4 https://github.com/rescript-lang/syntax/pull/723
# 10.1.0
#### :bug: Bug Fix
- Fix issue where no error was reported when ? was used for non-optional fields. https://github.com/rescript-lang/rescript-compiler/pull/5853
- Fix issue where optional fields in inline records were not supported and would cause type errors https://github.com/rescript-lang/rescript-compiler/pull/5827
# 10.1.0-rc.5
#### :bug: Bug Fix
- Prevent inlining of async functions in last stage of the compiler when the functions are not exported (not in interface file or shadowed) https://github.com/rescript-lang/rescript-compiler/pull/5790
# 10.1.0-rc.4
#### :rocket: New Feature
- Support format check with `rescript format -check`. https://github.com/rescript-lang/rescript-compiler/pull/5760
#### :bug: Bug Fix
- Fix issue where the last line of `rescript format --help` usage was being swallowed https://github.com/rescript-lang/rescript-compiler/pull/5760
- Specialize the printing of the rhs of a record field assignment for optional values `{x: ? e}` https://github.com/rescript-lang/syntax/issues/714
# 10.1.0-rc.3
#### :rocket: New Feature
- Support the use of spread anywhere in list creation (e.g. `list{...x, 1, ...y, ...z}`). https://github.com/rescript-lang/syntax/pull/692
- Add support for the argument of `@react.component` to set a props type from the outside. https://github.com/rescript-lang/syntax/pull/699
#### :bug: Bug Fix
- Fix issue where the JSX key type is not an optional string https://github.com/rescript-lang/syntax/pull/693
- Prevent inlining of async functions https://github.com/rescript-lang/rescript-compiler/issues/5754
- Fix build error for JSX fragment without children https://github.com/rescript-lang/syntax/pull/704
- Fix issue where async as an id cannot be used with application and labelled arguments https://github.com/rescript-lang/syntax/issues/707
- Fix 5557: the exhaustive checking for char is incorrect during the unicode migration https://github.com/rescript-lang/rescript-compiler/pull/5749
- Fix 5753: the comment for unicode char is inaccurate https://github.com/rescript-lang/syntax/pull/709
- Treat await as almost-unary operator weaker than pipe so `await foo->bar` means `await (foo->bar)` https://github.com/rescript-lang/syntax/pull/711
#### :nail_care: Polish
- Change payload of `Pconst_char` from `char` to `int` https://github.com/rescript-lang/syntax/pull/709
# 10.1.0-rc.2
#### :bug: Bug Fix
- Fix issue with changes not being applied with React Native's Metro bundler for files with warnings https://github.com/rescript-lang/rescript-compiler/pull/5738
- Fix emitting unary minus for floats in case of negative constants https://github.com/rescript-lang/rescript-compiler/pull/5737
- Fix issue where a spread `...x` in non-last position would not be reported as syntax error https://github.com/rescript-lang/syntax/pull/673/
- Fix issue where the formatter would delete `async` in a function with labelled arguments.
- Fix several printing issues with `async` including an infinite loop https://github.com/rescript-lang/syntax/pull/680
- Fix issue where certain JSX expressions would be formatted differenctly in compiler 10.1.0-rc.1 https://github.com/rescript-lang/syntax/issues/675
- Fix issue where printing nested pipe discards await https://github.com/rescript-lang/syntax/issues/687
# 10.1.0-rc.1
#### :boom: Breaking Change
- Deprecate DOM element attributes in `JsxDOM.domProps`: `begin_`, `end_`, `to_`
- Use `begin`, `end`, `to` instead.
- Emit an error when a `@string` or `@int` attribute is used in a V4 component https://github.com/rescript-lang/rescript-compiler/issues/5724
## :rocket: New Feature
- Add extra variants for output filename suffixes in `bsconfig.json`: `.bs.mjs` and `.bs.cjs` are allowed https://github.com/rescript-lang/rescript-compiler/pull/5631
- Safe promises: t-first Js.Promise2 bindings, and remove warning for nested promises https://github.com/rescript-lang/rescript-compiler/pull/5709
#### :bug: Bug Fix
- Fix issue where uncurried async functions were emitted without `async` https://github.com/rescript-lang/rescript-compiler/pull/5718
- Fix location issue in error messages with JSX V4 where the multiple props types are defined https://github.com/rescript-lang/syntax/pull/655
- Fix location issue in make function in JSX V4 that breaks dead code elimination https://github.com/rescript-lang/syntax/pull/660
- Fix parsing (hence pretty printing) of expressions with underscore `_` and comments.
- Fix printing of comments inside JSX tag https://github.com/rescript-lang/syntax/pull/664
- Fix issue where formatter erases tail comments inside JSX tag https://github.com/rescript-lang/syntax/issues/663
- Fix issue where the JSX prop has type annotation of the first class module https://github.com/rescript-lang/syntax/pull/666
- Fix issue where an empty record literal {} expected to have a non-record type would type check https://github.com/rescript-lang/rescript-compiler/pull/5729
#### :eyeglasses: Spec Compliance
- Functions with consecutive dots now print as multiple arrow functions like in JavaScript.
#### :nail_care: Polish
- Add `loading`, `aria-*` DOM element attributes in `JsxDOM.domProps`: `ariaCurrent`, `ariaInvalid`, `ariaAutocomplete`, etc.
- Change the internal representation of props for the lowercase components to record. https://github.com/rescript-lang/syntax/pull/665
- Add `JsxPPXReactSupport` module to relocate the helper functions for JSX v4 from `rescript-react`
# 10.1.0-alpha.2
#### :rocket: New Feature
- Fix pretty printer where it would print doc comments on the same line as other attributes https://github.com/rescript-lang/syntax/pull/642
- Propagte `"jsx"` configuration to dependencies https://github.com/rescript-lang/rescript-compiler/pull/5661
- Add support for empty record literal `{}` for records where all fields are optional https://github.com/rescript-lang/rescript-compiler/pull/5658
- Add support for empty record type (e.g. `type empty = {}`) https://github.com/rescript-lang/rescript-compiler/pull/5658
#### :bug: Bug Fix
- Fix issue in formatting JSX spread props https://github.com/rescript-lang/syntax/pull/644
- Fix location issue in error messages with JSX V4 where the body of the component is an application https://github.com/rescript-lang/syntax/pull/633
- Fix printing of type declarations in error message where they would be considered recursive by default
- Fix issue where the printer would omit attributes for `->` and `|>` https://github.com/rescript-lang/syntax/pull/629
- Fix printing of optional fields in records https://github.com/rescript-lang/rescript-compiler/issues/5654
#### :nail_care: Polish
- Improvements and fixes for JSX V4. See guide https://github.com/rescript-lang/syntax/blob/master/cli/JSXV4.md
- Mention all missing fields in error message for records, not just one https://github.com/rescript-lang/rescript-compiler/pull/5657
# 10.1.0-alpha.1
#### :boom: Breaking Change
- Vendor genType, which does not need to be installed separately anymore. **Only TypeScript back-end** supported.
- Pipe `->` does not support a code block on the right-hand side e.g. `x->{ open A; get("test") }`
#### :rocket: New Feature
- Experimental support for for `async`/`await` https://github.com/rescript-lang/rescript-compiler/pull/5537
- Make `promise` a built-in type https://github.com/rescript-lang/rescript-compiler/pull/5650
- Initial support for JSX V4 including genType, still work in progress.
- :boom: when V4 is activated, at most one component is allowed for each module.
- Add placeholder types for ES6 collections: `Set`, `Map`, `WeakSet`, and `WeakMap` https://github.com/rescript-lang/rescript-compiler/pull/5630
#### :bug: Bug Fix
- Fix issue with arrays and creation of recursive values https://github.com/rescript-lang/rescript-compiler/pull/5640
- Fix issue where characters such as newlines would be escaped in a template string expression https://github.com/rescript-lang/rescript-compiler/issues/5638
- Fix issue where pipe `->` processing eats up attributes https://github.com/rescript-lang/rescript-compiler/pull/5581
- Fix issue where cancelling `rescript build` would leave the `.bsb.lock` file behind and block future builds
#### :nail_care: Polish
- Print patterns in warnings using rescript printer https://github.com/rescript-lang/rescript-compiler/pull/5492
# 10.0.1
#### :bug: Bug Fix
- Fix issue where watch mode would give an error on Windows https://github.com/rescript-lang/rescript-compiler/pull/5621
# 10.0.0
**Compiler**
#### :boom: Breaking Change
- `bsconfig.json` does not support `// line` comments anymore.
- Example: `"suffix": ".bs.js" // determine the suffix`
- Fix: remove the comment and use standard json.
- Changed return type of `Js.String.match_` as it was wrong. [#5070](https://github.com/rescript-lang/rescript-compiler/pull/5070)
- Example: any use of `Js.String.match_` and `Js.String2.match_`
- Fix: follow the type errors
#### :rocket: New Feature
- New records with optional fields e.g. `type opt = {x: int, y?: string}` were added as an experimental feature [#5423](https://github.com/rescript-lang/rescript-compiler/pull/5423) [#5452](https://github.com/rescript-lang/rescript-compiler/issues/5452) [New Syntax](https://github.com/rescript-lang/syntax/pull/589/files)
- Add support for `@new @variadic` (see https://github.com/rescript-lang/rescript-compiler/pull/5364)
#### :bug: Bug Fix
- Classify bigint correctly [#5351](https://github.com/rescript-lang/rescript-compiler/pull/5351)
- Fixed crash in `rescript build` on Windows [#5516](https://github.com/rescript-lang/rescript-compiler/pull/5516)
- Fixed `rescript init` command not working [#5526](https://github.com/rescript-lang/rescript-compiler/pull/5526)
- Fix issue with compiler log not terminated that causes problems with editor extension not clearing issues when fixed [#5545](https://github.com/rescript-lang/rescript-compiler/issues/5545)
##### :nail_care: Polish
- Changed Linux build to depend on GLIBC 2.28 again for compatibility with Debian 10.
- Proper M1 support (CI now supports M1 native builds)
**Syntax**
#### :boom: Breaking Change
- `@bs.send.pipe` is now removed. Earlier it was deprecated.
- Missing labels in function application is now an error (https://forum.rescript-lang.org/t/ann-more-strict-checks-in-missed-labels/2117).
- Example: `let f = (x, ~z) => x + z; f(1, 2)`
- Fix: do `let f = (x, ~z) => x + z; f(1, ~z=2)` instead
- Externals without `@val` annotations do not work anymore, and externals with `= ""` give an error.
- Example: `external setTimeout: (unit => unit, int) => float = "setTimeout"` is not supported anymore.
- Fix: use `@val external setTimeout: (unit => unit, int) => float = "setTimeout"` instead.
- Example2: `@val external setTimeout: (unit => unit, int) => float = ""` is not supported anymore.
- Fix2: use `@val external setTimeout: (unit => unit, int) => float = "setTimeout"` instead.
- Strings processed at compile-time don't need escaping anymore.
- Example: `let blockCommentsRe = %re("/\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+\\//g")`.
- Fix: use `let blockCommentsRe = %re("/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g")` instead.
- Remove parsing of "import" and "export" which was never officially supported https://github.com/rescript-lang/syntax/pull/597 https://github.com/rescript-lang/syntax/pull/599
- Example: `export type t = int`
- Fix: `@genType type t = int`
- Example2: `import realValue: complexNumber => float from "./MyMath"`
- Fix2: `@genType.import("./MyMath") external realValue: complexNumber => float = "realValue"`
#### :rocket: New Feature
- Unicode is now supported in regular strings and chars (when the symbol fits). This is now going to work: `let str = "Σ"`. And, you'll be able to pattern match on unicode chars: `switch c { | 'Σ' => "what a fine unicode char" | _ => "unicode is fun" }`
- Doc comments `/** ... */` are now supported. Inernally, they are attributes, so are only valid at positions where `@foo` is allowed, or a syntax error is given. Similarly for module-level `/*** comments */` that can go where `@@attributes` go.
#### :bug: Bug Fix
- Fix printing for inline nullary functor types [#477](https://github.com/rescript-lang/syntax/pull/477)
- Fix stripping of quotes for empty poly variants [#474](https://github.com/rescript-lang/syntax/pull/474)
- Implement syntax for arity zero vs arity one in uncurried application in [#139](https://github.com/rescript-lang/syntax/pull/139)
- Fix parsing of first class module exprs as part of binary/ternary expr in [#256](https://github.com/rescript-lang/syntax/pull/256)
- Fix formatter hanging on deeply nested function calls [#261](https://github.com/rescript-lang/syntax/issues/261)
**Libraries**
#### :boom: Breaking Change
- **"Attributes not allowed here"**. If you see this error chances are you're using a ppx that needs updating to a new version.
See an exampe of how to [update a ppx](https://github.com/zth/rescript-relay/pull/372)
- Example: for `rescript-relay` 0.23.0 is not supported.
- Fix: use `rescript-relay@beta` or the new version when released.
- Removed printing modules (Printf, Format etc) and related functions. Details of files added/removed: https://github.com/rescript-lang/rescript-compiler/commit/0fd8bb0e77c4b0e96a9647ac8af614305057003f.
#### :bug: Bug Fix
- Fix library issue with missing `bytes_to_string` https://github.com/rescript-lang/rescript-compiler/issues/5573 https://github.com/rescript-lang/rescript-compiler/pull/5589
#### :nail_care: Polish
- Several Belt / Js libraries are now converted to ReScript syntax, with corresponding comments in Markdown format suitable for hovering. See [#5361](https://github.com/rescript-lang/rescript-compiler/pull/5361).
**Playground**
#### :house: Internal
- Added `jsoo_playground_main.ml` as the rescript-lang.org playground bundle entrypoint
#### :boom: Breaking Change
- Removed Reason syntax support for the playground experience. See https://github.com/rescript-lang/rescript-compiler/pull/5375
# 9.1.4
## Build
- #5167 add dump subcommand so that
```
rescript dump path/to/file.cmi
```
Will dump the interface to a readable output, note this is integrated into the build system that the build will try to build it if it is not already there
- clean will clean its dependency by default.
subcommand `clean -with-deps`, `-with-deps` is not needed any more
- hide most bsc options, officially supported bsc flags (this is not a breaking change, those internal options are still there but subject to removal in the future)
```
Usage: bsc <options> <files>
Options are:
Options:
-w <list> Enable or disable warnings according to <list>:
+<spec> enable warnings in <spec>
-<spec> disable warnings in <spec>
@<spec> enable warnings in <spec> and treat them as errors
<spec> can be:
<num> a single warning number
<num1>..<num2> a range of consecutive warning numbers
default setting is +a-4-9-20-40-41-42-50-61-102
-bs-g Debug mode
-bs-D Define conditional variable e.g, -D DEBUG=true
-e (experimental) set the string to be evaluated in ReScript syntax
-v Print compiler version and location of standard library and exit
-version Print version and exit
-warn-help Show description of warning numbers
-warn-error <list> Enable or disable error status for warnings according
to <list>. See option -w for the syntax of <list>.
Default setting is -a+5+6+101+109
```
## Syntax
- #432 bad error message for unterminated quote
## Compiler
- #5165 bad error message for uncurried type mistmatch
- #5169 fix a code gen issue with user defined `None`
# 9.1.3 (bug fix release)
## Build
- #5154 when toplevel package-specs get changed, its dependencies should be rebuilt
- #5152 Rebuild not triggered when deletion with nested modules
- #5153 when Different compiler version triggered,
it should clean the whole dependencies instead of just the repo itself
- #5080 Add back -ws option for the build
## Syntax
- #425 fix CRLF handling for windows
- #414 Fix printing of underscore Pexp_fun sugar in context of Array.get
- #408 Don't parse Int token with suffices as hash ident for poly variants
- #410 Fix parsing of arrow type with objects in constructor declaration args
- #404 fix printing of Osig_module in outcome printer
- #402 Implement printing of `Otyp_module` in outcome printer
# 9.1
- Remove depercated APIs Js.Re.exec, Js.Re.test, Node.Fs.on
- #5014 #5063 #5027 the new ReScript CLI interface
Thew new CLI is self explainatory:
```
rescript -h
Available flags
-v, -version display version number
-h, -help display help
Subcommands:
build
clean
format
convert
help
Run rescript subcommand -h for more details,
For example:
rescript build -h
rescript format -h
```
- #5025 in place format support, this is subsumed into `rescript format` subcommand
- #5060 #5055
Add formatting support for stdin/sdout
- #5053 #5050 clean up structural object semantics
- #5037
Allows coercion from nullary types to int/string.
This applies to collections types too
- #5029
int polyvar is compiled into int.
`#0` is the same as 0 except it is structually typed as `#0`
- #5023 generate interface file in rescript syntax by default
- #5021 makes int64 runtime payload small for just comparison
- #5019, #5017, #5016, #5015, #5010 improve error message
- #5008 don't trigger a rebuild if mjs file changes, fix an infinite loop in watch mode
- #5005 not depending on Format for Arg module, smaller size
- #4985 fix the schema of bsb on `dev` property
- #4967 #4986, #4984, #4971, #4972, #4969 Breaking changes
Remove ocaml style classes while structural objects and structural typings are simplified. Js.t is no longer needed. If user does not know
what ocaml style class is, this should not affect them.
# 9.0.2
- #4990 Fix an optimization bug introduced in 9.0
- #4982 pattern match over modules
Provide user with a sugar to pattern match over modules:
```res
let {length, cons} = module(List)
```
More discussions can be found [here](https://forum.rescript-lang.org/t/introducing-an-extension-to-make-pattern-match-works-on-modules/1196)
# 9.0
- #4933 update syntax bf6561bb5d84
syntax changes listed [here](https://github.com/rescript-lang/syntax/blob/master/CHANGELOG.md#90)
- #4934 generate `@pure` annotations to help esbuild remove more dead code
- #4932 #4931 turn flow syntax checking from a error into warning 103, so it can be turned off as below
```res
@@config({
flags: ["-w", "-103"],
})
%%raw(`
if (import.meta.hot){
console.log('es6')
}
`)
```
The rationale is that flow could be not standard compilant so we need provide a work around, here
`import.meta` is something new in Ecmascript
- #4926 #4928
_internal_ changes, move jscomp/syntax to jscomp/frontend to avoid conflicts
- #4924 #4927 better code generated for pattern match.
Take advantage of the JS runtime, some predicates can be simplified
- #4920 #4925 support external-stdlib config
```
"external-stdlib" : "@rescript/std"
```
- #4922 #4923 \*breaking changes" Allow embed records in structural js objects
- #4908 #4919 #4917 #4916 #4914 #4913 #4910
Get rid of camlp4 as a dev dependency, introduce an optimized visitor pattern
generator, better performance, no object usage and less dependency thanks to wasm
- #4911 Relax uninterpretable attributes from error to warn to make ppx_deriving happy
- #4905 _internal_ add `Js_exn.anyToExnInternal`
- #4903 porting to open BSD/adJ
- #4902 for stdlib es6 artifacts ship .mjs instead of .js, so that
on the user side, if they config es6 with .mjs, it will work out of box
- #4900 #4986 `'` in string literals does not need to be escaped
- #4893 _internal_ simplify numbers in JS IR
- #4892 #4891 _internal_ simplify boxed int operations
- #4890 clean up constant in lambda IR, fix a subtle bug when do constant folding
- #4888 #4881 support external in private block
- #4882 #4884 #4887 remove nativeint, not allow literlas like `3n`
- #4873 #4875 #4876 better code generation for pattern match
- #4870 fix typo in uncurried error message
- #4867 _internal_ clean up bsb_helper
# 8.4.2
- #4864 #4865
Not install dev directory for pinned dependencies
- #4863
for a package, only cmi/cmj artifact changes will trigger a rebuild
# 8.4.1
- Syntax submodule upgrades from 7f5c968 to 7cc70c9
- #4856 #4858
Improve code generation for pattern match:
Input:
```res
type t =
| A
| B
| C
| D (int )
| E (int)
let f = x => {
switch x {
| A => 0
| B => 1
| C => 2
| D (x) => x
| E (x) => x + 1
}
}
```
Output was:
```js
function f(x) {
if (typeof x !== "number") {
if (x.TAG) {
return x._0 + 1 | 0;
} else {
return x._0;
}
switch (x) {
case /* A */0 :
return 0;
case /* B */1 :
return 1;
case /* C */2 :
return 2;
}
}
```
Now:
```js
function f(x) {
if (typeof x !== "number") {
if (x.TAG === /* D */ 0) {
return x._0;
} else {
return (x._0 + 1) | 0;
}
}
switch (x) {
case /* A */ 0:
return 0;
case /* B */ 1:
return 1;
case /* C */ 2:
return 2;
}
}
```
- #4855 _internal changes_
changes to compiler-libs will trigger a rebuild of the compiler, this allows us to
see how changes of compiler-libs affect bsc.exe quickly
- #4850 replace ocp-ocamlres with a lightweight nodejs script, get rid of such dev dependency
- #4854 #4848 #4847 #4844 #4836 #4826 #4824
Pinned packages support and `-make-world` respect changes of dependencies
- #4840 #4841 more robust handling of removing stale output
- #4831 use relative paths in the command line
It will be expanded to absolute path right after the compiler see the path,
such changes work better with the underlying ninja build engine, and should perform slightly better
- #4828 no need pass -o for compiling, inferred directly (with namespace support too)
- #4827 _internal_ the dev version of bsc now behave roughly the same as the released version
- #4825 fix a typo in the warning `%@string` -> `@string`
- #4823 introduce a new warning 109: toplevel expression is expected to have type unit
It is turned on as warn-error by default. This warning is introduced to avoid partial application errors in a curried language
- #4822 more robust hanlding of : ignore warnings and warn-error when bsb is building dependencies
# 8.3.3
This is a bug release for 8.3.\*
- #4817 _internal_ add an option RES_SKIP_STDLIB_CHECK so that
for a true monorepo, it does not need follow `node_modules` layout
- #4807 #4815 remove unused code in refmt parser _a lot_ (around 50_000 loc)
on darwin, the binary size is dropped fom 9.69M to 8.48M
- #4808 add back basic-reason theme to avoid breakage for existing docs
- #4806 Fix broken ocaml build with gcc 10
- #4804 restore back-wards compatibility with `build statement` in generated ninja files
- #4803 fix the bsb build schema location in the error message
- #4802 proper error message when bsconfig.json is missing
- #4801 add a sanity check for name field in bsconfig.json to match real package name
- #4810 #4784 regressions for weird indentation in warning output
# 8.3.1
This is a minor bug fix release for 8.3.0
- capture warnings when rebuild without enforce warn-as-error
- #4716 internal, make ninja a submodule in dev process
- #4722 better dataflow for cases like `let {a;b} as obj = ...`
- no need call `caml_enter_blocking_section` for single threaded compiler
- #4739 fix the interaction of exotic filenames like `[id]` with the build system.
# 8.3
- #4694, #4712 improving/customizing the underlying ninja build system, better performance
- #4681, #4710 creating persistent lib/bs.compiler.log per each build for editor diagnostics
- #4688, #4707 better error message
- - #4702 remove nativeint module which is not meaningful on js platform
- #4701 support both `bs.val` and `val` attributes, in the future to recommend the shorter ones
- #4693 Fix the compiler runtime issue, always flush err_formatter when at_exit
- #4687, #4689, #4691 allow user to customize js file extension in bsconfig.json (checkout the schema )
- #4685, #4624, #4690 allow more character set in filenames to make rescript play better with react native and next.js
- #4684 fix the raise of Sys.is_directory, make bsb works better with Emacs temp files
- #4679 better error message for nonrec GADT
- #4671, #4678 better strategies to remove stale output for the build system
- #4676 (internal) add Config.syntax_kind so that some changes in super_errors can be made upstream
- #4650, #4656, #4657, #4662 always warn-as-error while not degrading user expereince (with the help of build system)
- #4661 (internal) not depending on upstream compenv module
- #4639, #4642 refined static analysis to generate better code
- #4636, #4641 es6 default import support
- #4638 clean up the confusing error message over uncurry label
- #4637 remove unneeded mention of BuckleScript in uncurried message
- #4623 better data flow inference for common pattern: `let {a,b,c} = ...`
- #4622 add html element & observer phantom types
- #4618 fix combination of bs.obj with bs.as so that bs.as can carry more kinds of playload
- #4613 (internal) pass down @inlined attribute from upstream. (the info is passed down, how to make use of it is not done yet)
- #4609 Lift the restriction that user can only define a type with less than 256 constructors
- #4606, #3961 (internal) use is_a_functor from upstream instead of guessing
- #4605 (experimental) take `@@inline` attribute into consideration for functions
- #4604 enhance Random module
- #4600, #4599 fix missing bounds checking for Bytes.set
- #4597 fix Js.Array and Js.Array2 the wrong return type for `from` method
- #4513 better error message when interface/implementation mismatches (done in commit db485f1)
# 8.2
- `bsc -fmt myFile` now changed to `bsc -format myFile`
- #4573, #4565, #4559, #4558, #4556, #4554, #4553, #4550 introudce string literal types
- #4580 #4581, #4582, #4463, #4583 relax bs.as to allow object literals instead of json, so FFI below is allowed:
```ocaml
external fff0 : int -> int -> (_[@bs.as {json|[undefined,undefined]|json}]) -> int = "say"
[@@bs.val]
let testUndefined () =
fff0 1 2
```
- #4570 refine purity analysis so that object literals in raw will be considered pure
- #4548 #4555 fix ghost locaption in empty array
- #4540 optimize code generation for recursive modules
- #4530 internal -color option default to always
- #4569 emit a warning for use of `` ( [ `a| `b] [@bs.string]) `` since it is no longer needed
- #4531 better generated js code for belt
- #4526 add `bsc -fmt file` option, format into the new syntax
- #4495 enable newish es syntax in raw
- #4491, #4492, #4493 fix a bug when printing a single object literal as statement, optimize this case into a nop
- #4482, #4480 disable user to redefine `unit`, `true`, `false`
- #4474 #4465 [reactjs] add support for ref argument inside of React.forwardRef type applciations
- #4473 adding an experimental new syntax
- #4470 tweak error message for not found record fields/constructors
* bug fixes
- #4572, #4585 fix a corner case for ffi to allow such bindings:
```ocaml
external get : _ -> _ -> _ = "" [@@bs.get_index]
```
- #4589 fix building failure on freebsd
- #4524, #4519 fix an inlining bug
- #4505 #4502, fix bad error message in bsb -bla
* internal
- #4497 #4507, #4516 compiler performance improvement
# 8.0
- Code generation
* #4308,#4309, #4397 #4403 #4404 #4409 variant as objects
```
A (0,1)
```
now is
```js
{ TAG : /*A*/0, _0 : 0, _1:1 }
```
* #4399 remove magics in Belt.List to prepare new data representations
* #4405 polyvar as objects
```
A 1
```
now is
```js
{HASH:MAGIC_NUMBER, VAL:1}
```
* #4331,#4332 #4337,#4339, #4338, #4337 Encoding exception as dictionary, add stacktrace support
* #4322, #4325,#4326, #4364, #4383, #4371 lazy values as objects, make `caml_update_dummy` generalized
* #4456, #4458 optimize String.make
* #4447, #4442 improve arity inference over raw named function expression
* #4413 changed internal encoding of Some ((Some .. None)), not relying on physiclal equivalence, friendlier to serialization
* #4379 make bs.config take effect ASAP, however, it can not happen befor parsing.
This meangs, it won't have effect over flags like `-bs-D` when it happens in lexing.
* #4426, #4428 apply bs.inline to float literals
* #4378 apply bs.inline to int64, proper error for not supported types
* #4425 optimize `bs.as "0"` to allow users to turn record representation into array when needed
* #4407, #4423 Fix compatiblity layer between debug mode and none-debug mode
- For exmaple, `A (1,2)` are equal for code generated either in debug or non-debug mode
* #4422 remove Unix module from stdlib
* #4421 special encode list as `{hd : v0, tl : ...}`
* #4420 remove legacy jsx v2
* #4390 less parens for `bs.as` json literals
* #4245, #4385 breaking changes: enable strict-sequence, strict-formats by default
* #4304, #4293 better code generated for string interpolation
- Fix
* #4451, #4454 fix imprecise locations over pipe
* #4442 fix gentypeconfig.language parsing
* #4430 when cleaning generated files, use `langauge` from `gentypeconfig`
* #4324 fix react-hooks theme name field
- Libs
* #4443 provide a best effort generic seralization mechanism
* #4427 better error message for non-existing module in `sources[n].public`
* #4414, #4419 better error message for cases like below
```
Error: This expression should not be a function, the expected type is
(int bounce -> 'a bounce [@bs])
```
* #4416 fix typo (unrecognized primitive -> unrecognized primitive)
* #4408 [playground] fix jsoo_refmt_main, remove load_modules (uneeded)
* #4395 fix jsoo_refmt_main, delete playground folder
* #4394 repl.js: add dev mode
* #4393 Playground: bring back load_modules API
* #4389 React JSX ppx: better error message for missing labels
* #4388 [jsx] fix unused pattern warnings
* #4380 [jsx] remove bs.config handling in jsx ppx, use bs.config.flags instead
* #4376 remove Math.imul polyfill, inline Math.imul
* #4370 remove deprecated support for `fun%raw`
* #3845, #4367 fix `output too many parens for callback`
* #4359 [jsx] rais error if creating react.component with unnamed argument
* #4364 remove customised formatter for exceptions
* #4358 change reasonreact version for templates
* #4351 force binding location on the actual make binding
- Internal tools/refactoring
* #4460 bspack is a stand alone file not relying on c stubs
* #4459 bsb customized command line parsing, prettier output over `bsb -h`
* #4455 simplify bsb_helper command line parsing
* #4458 clean up lexing runtime, stay close to lexing.c
* #4441 remove unused Obj.set_tag
* #4438 tweak post-processing after linking, better constant substitution
* #4429 #4431 #4435 minor breaking changes
- more compatct encoding of .bsbuild
- flatten dev gropus
- for files in dev directory they can refer each other
* #4402 move `caml_set_oo_id` into `caml_oo` module
* #4392 remove unused return_exp in J.ml ast
* #4387 fix a build bug when no mli provided, add reason-react for testing
* #4366, #4373 update polymoprhic comparison not relying for lazy values
* #4372 vendor jsoo byte code, build playground on the fly
* #4354 `bstracing -all` can handle multiple build sessions
# 7.3.2
- #4315 synup super_errors for better uncurry error message
- #4335 fix js_date.setUTCTime
- #4343 fix regex syntax checking for empty or comment string
- #4351 precie binding location for reasonreact jsx
# 7.3
- #4235 #4237 #4241 #4244 #4240 generalized uncurry work
- #4255 #4258 #3953 code generation: compiling unit to `undefined`
- #4288 code generation: improve module alias code generation
- #4287 code generation: meaningful names for pattern match
- #4286 code generation: better code generation for loops
- #4224 #4262 code generation: eleminate intermediate variables when inlining
- #4198 #4228 remove some long deprecated APIs, Js.Math.pow_int
- #4257 docs: add docs about Belt.Id.comparable
- #4256 tweaks to super error message
- #4284 regression fix: better dumping cmi files to avoid scary names
- #4285 #4268 turn off warning 20 by default (which produces false alarm)
- #4283 tweak react-hooks template
- #4270 #4273 deriving abstract free in belt, belt no longer relies on such extension
- #4272 code generation: better handling of option unpacking
- #4269 not rely on `npm link` for bsb templates
- #4266 #4265 fix belt.MutableMap
- #4259 consistent warning docs in `bsc -warn-help`
- #4251 remove String.prototype.polyfill
- #4250 adding `-unboxed-types` option (where @unboxed attribute may not be needed)
- #4217 make compiler int64 encoding agnostic
# 7.2
- #4211 #4210 optimize int64 performance, Int64.to_string (10x faster), Int64.neg etc
- #4209 add a space after "acquire lock" in bsb error handling
- #4208 #4206 let%private support
```ocaml
let %private x = 3
```
`x` will not be exported
```ocaml
module N = struct
let %private x = 3
end
```
`x` will not be exported by N
- #4196 fix printing indexed operators
- #4177 #4180 support `[@@@bs.config {flags = [| ".." |] }]` per file level to allow file level special flags
- #4158 #4157 #4166 #4168 loading stdlib from memory, no postinstall needed
- #4152 support copyright style comments preserved in JS
```
[%%raw "//copyright ]
```
copyright will be preserved in output js
- #4191 #4189 add a flag -bs-unsafe-empty-array for easy transition (regain polymorphism for empty array), this is a temporary flag which will be removed eventually
- #4190 (internal) remove bsdep which is not used
- #4188 better encoding around internals for performance and size
- #4155 fix React PPX regressions from 7.1.0 which caused a type error when writing recursive components.
- #4185 remove stale tasks.json in bsb themes for vscode, leave it for users to keep it up to date
- #4159 #4161 #4182 improve the startup time, reducing both the size of cmi and cmj
- #4179 (internal) remove bsppx, use "bsc.exe -as-ppx" for editor tooling
- #4171 add a warning for using `fun%raw`, use `[%raw]` directly
- #4169 An escape hatch for function level comments
- #4164 #4162 #4165 make code generation platform agnostic (not depending on printf either)
- #4164 add Node.Buffer.toStringWithEncoding
- #4150 Grab the hostname from window.location when conntecting to websocket for react-hooks theme
- #4143 better compilation of optional arguments
- #4142 fix yarn start command
- #4140 docs: update README in basic reason template
# 7.1.0
(it was 7.0.2 but bumped into 7.1.0 due to a breaking change introduced in 7.0.2)
- #4131 support `bstracing -C`
# 7.0.2
- #4117 Upgrade to Reason 3.6.0 @ 8f71db0
- #4097 introduce a js parser for syntax checking inside raw.
We can now tell whether the code inside raw is a function or not and the arity of raw function, so
```ocaml
let f = [%raw{|function(x){return x}|}]
```
```ocaml
let f = fun%raw x -> {|x|}
```
will be treated the same, to make FFI simpler, the special form `fun%raw` will be discouraged.
- #4090 #4087 fix the unsoundess issue of Js.Array.push
now the empty array `[||]` won't have a polymorophic type, it will have a concrete type.
This is a bug fix but also a breaking change
- #4038 Duplicated package warning for symlinked folders
- #41112 #4111 #4067 #4101 provide websocket error better error message and better docs
- #4108 fix warning concat in some edge cases (bsb)
- #4100 make node process exit return 'a instead of unit
- #4098 restore encoding int64 using a tuple for compatibility reasons
- #4114 fix SPA mode watcher path in react-hooks template
- #4199 Change ReactJS PPX to avoid modifying locations of existing code (better integration with editors)
- #4122 toplevel [@@@warning "+101"] works for our own warnings (apart from OCaml ones)
`bsc -warn-help` listed several of our own warnings
```
101 BuckleScript warning: Unused bs attributes
102 BuckleScript warning: polymorphic comparison introduced (maybe unsafe)
103 BuckleScript warning: about fragile FFI definitions
104 BuckleScript warning: bs.deriving warning with customized message
105 BuckleScript warning: the external name is inferred from val name is unsafe from refactoring when changing value name
106 BuckleScript warning: Unimplemented primitive used:
107 BuckleScript warning: Integer literal exceeds the range of representable integers of type int
108 BuckleScript warning: Uninterpreted delimiters (for unicode)
```
- #4060 #4057 add unboxed type support
- #4078, #4069 better code generated for cases like `match x with true -> ..| false -> ..`
- #4075, #4065 allow emoji in folder name
- #4074 allow defining a custom hostname for websocket
- #4064 fix shake_compile prefix & code param order
- #4053 use setImmediate for rebuilding to fix watch mode for some specific editors
- #4050 support pipe first poly variant
- #4049 Add support for custom underscored namespace
- #4018 #4020 #4028 #4031 #4037 #4048 #4042 #4041 #4040 improve compiler performance (optimize hash base data structure)
- #4039 upgrade refmt (various bug fixes)
- #4006 #4029 fix misleading error message
- #4025 #4026 fix corner case of code gen for empty object literal
- #4024 Playground: update repl.js and docs to support jsoo 3.5.1
# 7.0.1
- #4009 #4011 fix ocaml type checking bug (cherry pick)
- #4000 #4010 add react-starter theme
- #4005 fix windows installing issues
# 7.0.0
- #4003 not doing ast invariant checking, leave it to us (faster compilation)
- #4002 upgrade ocamldoc in 4.06, fix document build
- #4001 tweak error message
- #3999 #3987 fix ppx reactjs regression keep attributes on object fields
- #3998 #3996 less strict check for duplication in record labels
- #3996 #3969 fix refmt upgrade regressions
- #3982 bs.as for record support (language level feature)
- #3989 #3993 check renamed label is unique when using bs.as
- #3985 more precise runtime information passed down from upstream, fix a corner case of compiling ocaml class
- #3986 more precise runtime information passed down from upstream, add module alias comments in generated code
- #3991 #3980 fix a corner case when printing js object in statement position
- #3977 #3978 not relying on ref internal for the runtime
- #3976 add bs js playground reason support
- #3974 bsb tweak react hooks template README
- #3971 docs about format of lib/bs/.bsbuild
- #3967 #3973 fix recursive value initialization
- #3972 upgrade repl.js to 4.06.1
- #3890 Fix typo in readme
- #3898 #3900 #3911 #3913 #3915 #3925 #3928 #3929 #3932 #3936 #3934 OCaml record as Js object
- #3945 sync refmt 3.5.3
- #3916 add large ocaml object test
- #3935 #3931 partial fix for recursive values inside recursive modules
- #3917 #3926 speicalize all ref handling (prepare for js object interaction)
- #3918 use folders from esy ocaml for snapshots
- #3920 remove size field which is never used
- #3921 add queue_402 for testing recursive values
- #3912 add -bs-noloc opton for easy debugging (when using -dparsetree -dtypedtree)
- #3927 more tests for records
- #3901 internal rewrite float_of_bits to not rely on int64 representation
- #3903 Fix invalid json in hooks template
- #3905 Fix int64 test specification
- #3906 remove optimizations relying on int64 internals which is fragile when changing into bigint
- #3907 remove some transformations in printer
- #3893 specialize code generation for Sys.os_type better code for stdlib
- #3899 add missing optimization `let _ = xx in yy`
- #3878 add Belt.Option.forEach
- #3941 remove null_to_undefined since type is specialized
- #3943 fix SPA mode regression for hooks template
- #3944 #3956 add spacing to variant formatter
- #3950 fix react-hooks watcher websocket support
- #3954 alias result type using stdlib `result`
- #3955 update ¨CONTRIBUTING file
- #3959 internal, remove alias_table which is not needed
- #3960 add test case for functor coercion
- #3962 #3960 set env var `BSB_PROJECT_ROOT` for bsb
- #3965 better inline heruistics
- #3966 #3897 improve module coercion code gen in strict subtyping
Deprecations
- #3889 remove deprecated light names in bs.deriving abstract
# 5.2.1 (2019/10/16)
Fixes
- #3884 (not using temp file when creating cmt for ocaml 4.06 only)
- #3877, #3881 Pattern match bug over list of integers
- #3875, #3879 regression introduced in 5.2.0 over pattern match optimization
- #3865 consistent name mangling when compiling modules into object
- #3852, #3870 for module with all module aliases and no interface file, always make it pure (treat it the same as namespace file)
- #3874 internal bug fix for ocaml cmpiler
Codegen
- #3880 optimize pattern match for (string|int) option
- #3866 update react-hooks template
- #3843 mitigate windows anti-virius issue
# 5.2.0 (2019/09/23)
Features
- #3803 Add a -install flag for mono-repository improvement for parallel compilation
- #3790 #3802 #3799 #3792 #3836 Compile locla modules to objects and clean up
- #3836 initial support of esy
- #3780 Better code generation for if branches
- #3799 Improve code gen, better code equality for block
- #3778 #3770 Improve pattern match compilation against the outer-most staticfail
- #3764 better code gen for lazy evaluation
- #3822 allow `f##"Content-Type"` for uncommon property name
- #3810 annoate constructor names in pattern match compilation
Fixes
- #3809 Escape question mark and ampersand to special chars
- #3805 #3796 Fix stale builds (module alias + namespace interaction)
- #3777 More friendly error message for invalid package name
- #3794 Calling genType from bsc instead from the patched ocaml compiler
- #3784 avoid trailing white space in case branch
- #3781 #3783 quote package path properly
- #3793 pass bs-version to genType
- #3674 installation from master works out of box
- #3823 fix reason language server
Docs
- #3795 Fix docs for stringifyAny
- #3788 Rename getUnasfe to getUnsafe
- #3830 fix isSortedExample
- #3829 fix mapWithDefault example
- #3828 fix getExn example
- #3827 fix partition example
- #3826 simplify truncateToLengthUnsafe example
# 5.1.0 (2019/08/15)
Features
- #3731 #3734 #3724 #3714 enable bsc for reason, so that for one file, `bsc hi.re` works
- #3671 add tool `bstracing` to visualize the building process
- #3730 #3738 Code gen: simplify `return undefined` as `return`
- #3713 support ppx with arguments (extended the schema)
- #3708 #3701 respect NODE_PATH when resolving node modules
Fixes
- #3699 Exit code from bsb in watch mode should be 0 instead of 2
- #3692, #3693 fix "cyclic dependencies error is swallowed"
- #3530, #3690 best effort support for shared library support
- #3683, #3678 Docs: fix example in Belt.Array
- #3657, #3669 Fix "For dependencies with namespace, the namespace file is always rebuilt"
- #3666, #3668 Fix "Ninja fails to compile on alpine linux "
- #3667, #3664 Fix "Warning number does not concat properly in some cases"
- #3662, #3515 Fix "bsb doesn't work with non-Unicode characters in the file path "
- #3653, #3519 Fix "[@react.component] vs .rei " in 4.06 branch
- #3655 Improve OCaml version file error
- #3652 Fix pnpm install (again)
- #3651 Fix "React PPX: Show warning 26 on unused props with default value"
Internal
- #3711 not inlining self recursive functions
- #3740 enable backtrace by default for compiler in dev mode
- #3705 dump package path in .sourcedirs.json for troubleshooting
- #3698 better data format for .bsdeps
- #3680, #3684, #3677, #3675, #3672 better encoding for .bsbuild
- #3673 strip the binary by default on \*nix platform
- #3658 #3545 fix a bunch of edge cases with dev build
- #3643 Fix nasty out of bound error in string/bytes access
# 5.0.6
Fixes
- #3648, #3647, #3645 make sure bsppx.exe (used by editor tools/Merlin, Reason Language service) behaves consistently with bsc.exe
- #3643 fix a hidden out of bounds bug
- #3642 pass down ninja internal flags in combination of `bsb -make-world`, for example `bsb -make-world -- -d explain`
- #3641 fix pnpm install
- #3635 fix debug mode runtime crash
- #3633 fix bs dev dependency issue
# 5.0.5
Fixes
- #3615 pruning stale build artifacts in bsb, more robust to file changes (moving files around, renaming)
- #3609, #3914 Fix a fatal error in code generation
- #3598, #3595 Fix code generation when toplevel binding is partial match (edge case)
- #3588 Fix double quote -ppx argument on windows
- #3577 fix webpack file serving for direct route access
- #3574, #3566 Fix code generation when some built in module names are reused
- #3572, #3570 fix infinite loop in bsb -w (edge case)
- #3558, #3557 fix missing Js.MapperRt module (playground js)
- #3555, #3546 bs.deriving `accessors` add support for GADT
- #3553, #3549 Fix code generation for leading zero float (edge case)
- #3474 fix bad error message when bsconfig `dev` and `non-dev` overlap
- #3532 add missing docs for `Js.error` and `Js.trace`
- #3536 fixing nesting `|.` issue
- #3519 avoid `'a array` manifested in external generated signature which causes inconsistent signatures. The concrete issue is that when adding `.rei` file for `[@react.component]` it triggers not match type error
- #3534 correct commands for building vendor OCaml from ocaml.tar.gz
- `*` enforce the rule that a module has to contain `.ml` or `.re` file, interface only file is not supported
Features
- #3600 allow user to polyfill missing c stubs
- #3613, #3612 add a warning number 105 (on by default) for cases as below
```ocaml
external f : int -> int = "" [@@bs.val]
```
Such ffi declaration is fragile to refactoring when changing names of `f`
- #3587, #3571, #3568 simplify debugger mode, `debugger.chrome` is not needed to turn on debug mode
Internals
- #3556, #3554 allow test reason files directly
- #3594, #3586, #3580, #3575 upgrade ninja to a customized more performant internal version
# 5.0.4
Features
- #3523, #3516 Fusing react-jsx ppx as a flag
Docs
- #3522 add BS_VSCODE variable docs
Fixes
- #3540, #3482 remove unsupported items in the bsconfig.json schema
- #3539, #3474 fix bad error message when a repo has same name for two modules
- #3538, #3532 update docs
- #3536, #3537 fix nesting (|.) ppx issues
- #3519, #3535 fix external declarations that can not be generalized (uncovered by react jsx ppx v3)
- #3534 fix commands building from ocaml.tar.gz
- #3527, #3525, #3504, #3500 playground upgrade
- #3518, #3507, #3517 not emit warnings for dependencies
- #3515 fix on binding renameSync
- #3508 tweak error message for syntax error
- #3506 sync location and optional fixes for new jsx ppx
- #3501, #3505 fix inconsistency between Js.String and Js.String2
- #3502, #3503 fix pipe syntax on qualified opens
- #3492, #3499 fix code gen in external when apply bs.uncurry to (unit -> ..)
- #3496, #3495 fix 'bs.module isn't being resolved relatively correctly'
# 5.0.1
Features
- #3479 add a theme named react-hooks for the new ppx
- #3476 add bs.inline support for literals (int, string, bool) so that it gets a stronger guarantee for inlining
- #3473 upstream reason@3c6a9ca98
- #3470,#3466 ract jsx ppx
Fixes
- #3455 fix polymorphic comparison and equality for js date
- #3465 fix brutal console.clear
- #3468 add BS_VSCODE to disable -super-errors, which works better with vscode problem matcher
# 5.0.0
Features
- #3418 sync up with refmt 681c491ba760cdf3b49f92297c3dab1703682808
- #3395, #3417 better gentype support (gentype.import)
- #3412,#3416 Warning against usage of `string_of_float`
- #3414, #3415, #2893 allow usage of ` a |. M.(f a b)`
- #3403 first class bs.variadic support
- #3402 in watch mode, clear the screen upon rebuilding
-