Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### :boom: Breaking Change

- `Int.fromString` and `Float.fromString` use stricter number parsing and no longer uses an explicit radix argument, but instead supports parsing hexadecimal, binary and exponential notation.
- Remove `external-stdlib` configuration option from `rescript.json`. This option was rarely used and is no longer supported.

#### :eyeglasses: Spec Compliance

Expand Down
2 changes: 1 addition & 1 deletion compiler/bsb/bsb_build_schemas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let package_specs = "package-specs"
let type_ = "type"
let export_all = "all"
let export_none = "none"
let external_stdlib = "external-stdlib"

let jsx = "jsx"
let jsx_version = "version"
let jsx_module = "module"
Expand Down
27 changes: 6 additions & 21 deletions compiler/bsb/bsb_package_specs.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* Copyright (C) 2017 Hongbo Zhang, Authors of ReScript
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,7 +17,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
Expand All @@ -27,13 +27,7 @@ let ( // ) = Ext_path.combine
(*FIXME: use assoc list instead *)
module Spec_set = Bsb_spec_set

type t = {
modules: Spec_set.t;
runtime: string option;
(* This has to be resolved as early as possible, since
the path will be inherited in sub projects
*)
}
type t = {modules: Spec_set.t}

let ( .?() ) = Map_string.find_opt

Expand Down Expand Up @@ -159,9 +153,7 @@ let package_flag_of_package_specs (package_specs : t) ~(dirname : string) :
(fun format acc -> Ext_string.inter2 acc (package_flag format dirname))
package_specs.modules Ext_string.empty
in
match package_specs.runtime with
| None -> res
| Some x -> Ext_string.inter3 res "-runtime" x
res

let default_package_specs suffix =
(* TODO: swap default to Esmodule in v12 *)
Expand Down Expand Up @@ -205,18 +197,11 @@ let extract_js_suffix_exn (map : json_map) : string =
Bsb_exception.config_error config "expected a string extension like \".js\""

let from_map ~(cwd : string) map =
ignore cwd;
let suffix = extract_js_suffix_exn map in
let modules =
match map.?(Bsb_build_schemas.package_specs) with
| Some x -> from_json suffix x
| None -> default_package_specs suffix
in
let runtime =
match map.?(Bsb_build_schemas.external_stdlib) with
| None -> None
| Some (Str {str; _}) ->
Some
(Bsb_pkg.resolve_bs_package ~cwd (Bsb_pkg_types.string_as_package str))
| _ -> assert false
in
{runtime; modules}
{modules}
7 changes: 1 addition & 6 deletions compiler/gentype/GenTypeConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,7 @@ let read_config ~get_config_file ~namespace =
| Some b -> b
in
let generated_file_extension = generated_file_extension_string_option in
let external_stdlib = bsconf |> get_string_option "external-stdlib" in
let platform_lib =
match external_stdlib with
| None -> "rescript"
| Some external_stdlib -> external_stdlib
in
let platform_lib = "rescript" in
if !Debug.config then (
Log_.item "Project roLiterals.bsconfig_jsonot: %s\n" project_root;
if bsb_project_root <> project_root then
Expand Down
4 changes: 0 additions & 4 deletions docs/docson/build-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@
"$ref": "#/definitions/package-specs",
"description": "ReScript can currently output to [Commonjs](https://en.wikipedia.org/wiki/CommonJS), and [ES6 modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)"
},
"external-stdlib": {
"type": "string",
"description": "Use the external stdlib library instead of the one shipped with the compiler package"
},
"bs-external-includes": {
"type": "array",
"items": {
Expand Down
64 changes: 31 additions & 33 deletions rewatch/CompilerConfigurationSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,34 @@

This document contains a list of all bsconfig parameters with remarks, and whether they are already implemented in rewatch. It is based on https://rescript-lang.org/docs/manual/latest/build-configuration-schema.

| Parameter | JSON type | Remark | Implemented? |
| --------------------- | ----------------------- | ------ | :----------: |
| name | string | | [x] |
| namespace | boolean | | [x] |
| namespace | string | | [x] |
| sources | string | | [x] |
| sources | array of string | | [x] |
| sources | Source | | [x] |
| sources | array of Source | | [x] |
| ignored-dirs | array of string | | [_] |
| dependencies | array of string | | [x] |
| dev-dependencies | array of string | | [x] |
| generators | array of Rule-Generator | | [_] |
| cut-generators | boolean | | [_] |
| jsx | JSX | | [x] |
| gentypeconfig | Gentype | | [x] |
| compiler-flags | array of string | | [x] |
| warnings | Warnings | | [x] |
| ppx-flags | array of string | | [x] |
| pp-flags | array of string | | [_] |
| js-post-build | Js-Post-Build | `${file}` is now an absolute path | [x] |
| package-specs | array of Module-Format | | [_] |
| package-specs | array of Package-Spec | | [x] |
| entries | array of Target-Item | | [_] |
| use-stdlib | boolean | | [_] |
| external-stdlib | string | | [_] |
| bs-external-includes | array of string | | [_] |
| suffix | Suffix | | [x] |
| reanalyze | Reanalyze | | [_] |
| experimental-features | ExperimentalFeatures | | [x] |
| Parameter | JSON type | Remark | Implemented? |
| --------------------- | ----------------------- | ---------------------------------------- | :----------: |
| name | string | | [x] |
| namespace | boolean | | [x] |
| namespace | string | | [x] |
| sources | string | | [x] |
| sources | array of string | | [x] |
| sources | Source | | [x] |
| sources | array of Source | | [x] |
| ignored-dirs | array of string | | [_] |
| dependencies | array of string | | [x] |
| dev-dependencies | array of string | | [x] |
| generators | array of Rule-Generator | | [_] |
| cut-generators | boolean | | [_] |
| jsx | JSX | | [x] |
| gentypeconfig | Gentype | | [x] |
| compiler-flags | array of string | | [x] |
| warnings | Warnings | | [x] |
| ppx-flags | array of string | | [x] |
| pp-flags | array of string | | [_] |
| js-post-build | Js-Post-Build | `${file}` is now an absolute path | [x] |
| package-specs | array of Module-Format | | [_] |
| package-specs | array of Package-Spec | | [x] |
| entries | array of Target-Item | | [_] |
| bs-external-includes | array of string | | [_] |
| suffix | Suffix | | [x] |
| reanalyze | Reanalyze | | [_] |
| experimental-features | ExperimentalFeatures | | [x] |
| editor | object | VS Code tooling only; ignored by rewatch | [x] |

### Source
Expand Down Expand Up @@ -133,9 +131,9 @@ Currently supported features:

### Js-Post-Build

| Parameter | JSON type | Remark | Implemented? |
| --------- | --------- | ------ | :----------: |
| cmd | string | `${file}` is now an absolute path | [x] |
| Parameter | JSON type | Remark | Implemented? |
| --------- | --------- | --------------------------------- | :----------: |
| cmd | string | `${file}` is now an absolute path | [x] |

### Package-Spec

Expand Down
2 changes: 0 additions & 2 deletions rewatch/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,6 @@ impl Config {
"cut-generators",
"pp-flags",
"entries",
"use-stdlib",
"external-stdlib",
"bs-external-includes",
"reanalyze",
];
Expand Down
Loading