Skip to content

Commit d93f51b

Browse files
Make experimental-features kebap-case in compiler config like the other fields (#7891)
* Make experimental-features kebap-case in compiler config like the other fields * Add compiler-flags alias to build-schema * Changelog
1 parent 9676953 commit d93f51b

File tree

9 files changed

+52
-61
lines changed

9 files changed

+52
-61
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#### :boom: Breaking Change
1616

17+
- Make experimental-features kebap-case in compiler config like the other fields. https://github.com/rescript-lang/rescript/pull/7891
18+
1719
#### :eyeglasses: Spec Compliance
1820

1921
#### :rocket: New Feature

compiler/frontend/bs_syntaxerr.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let pp_error fmt err =
8888
| Experimental_feature_not_enabled feature ->
8989
Printf.sprintf
9090
"Experimental feature not enabled: %s. Enable it by setting \"%s\" to \
91-
true under \"experimentalFeatures\" in rescript.json."
91+
true under \"experimental-features\" in rescript.json."
9292
(Experimental_features.to_string feature)
9393
(Experimental_features.to_string feature)
9494
| LetUnwrap_not_supported_in_position hint -> (

docs/docson/build-schema.json

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -318,29 +318,14 @@
318318
},
319319
"additionalProperties": false
320320
},
321-
"bsc-flags": {
321+
"compiler-flags": {
322322
"oneOf": [
323323
{
324324
"type": "array",
325325
"items": {
326326
"type": "string"
327327
},
328328
"description": "Default: `[\"-no-alias-deps\"]`"
329-
},
330-
{
331-
"type": "object",
332-
"properties": {
333-
"kind": {
334-
"enum": ["reset", "prefix", "append"]
335-
},
336-
"flags": {
337-
"type": "array",
338-
"items": {
339-
"type": "string"
340-
}
341-
}
342-
},
343-
"description": "(Not implemented yet)"
344329
}
345330
]
346331
},
@@ -422,7 +407,11 @@
422407
"description": "gentype config, see cristianoc/genType for more details"
423408
},
424409
"bsc-flags": {
425-
"$ref": "#/definitions/bsc-flags",
410+
"$ref": "#/definitions/compiler-flags",
411+
"description": "Flags passed to bsc.exe (deprecated, use compiler-flags instead)"
412+
},
413+
"compiler-flags": {
414+
"$ref": "#/definitions/compiler-flags",
426415
"description": "Flags passed to bsc.exe"
427416
},
428417
"warnings": {
@@ -485,7 +474,7 @@
485474
"$ref": "#/definitions/editor",
486475
"description": "Configure editor functionality, like modules that should be included in autocompletions for given (built-in) types."
487476
},
488-
"experimentalFeatures": {
477+
"experimental-features": {
489478
"type": "object",
490479
"description": "Enable experimental compiler features.",
491480
"properties": {

rewatch/CompilerConfigurationSpec.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22

33
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.
44

5-
| Parameter | JSON type | Remark | Implemented? |
6-
| -------------------- | ----------------------- | ------ | :----------: |
7-
| version | string | | [_] |
8-
| name | string | | [x] |
9-
| namespace | boolean | | [x] |
10-
| namespace | string | | [x] |
11-
| sources | string | | [x] |
12-
| sources | array of string | | [x] |
13-
| sources | Source | | [x] |
14-
| sources | array of Source | | [x] |
15-
| ignored-dirs | array of string | | [_] |
16-
| dependencies | array of string | | [x] |
17-
| dev-dependencies | array of string | | [x] |
18-
| generators | array of Rule-Generator | | [_] |
19-
| cut-generators | boolean | | [_] |
20-
| jsx | JSX | | [x] |
21-
| gentypeconfig | Gentype | | [_] |
22-
| compiler-flags | array of string | | [x] |
23-
| warnings | Warnings | | [x] |
24-
| ppx-flags | array of string | | [x] |
25-
| pp-flags | array of string | | [_] |
26-
| js-post-build | Js-Post-Build | | [_] |
27-
| package-specs | array of Module-Format | | [_] |
28-
| package-specs | array of Package-Spec | | [x] |
29-
| entries | array of Target-Item | | [_] |
30-
| use-stdlib | boolean | | [_] |
31-
| external-stdlib | string | | [_] |
32-
| bs-external-includes | array of string | | [_] |
33-
| suffix | Suffix | | [x] |
34-
| reanalyze | Reanalyze | | [_] |
35-
| experimentalFeatures | ExperimentalFeatures | | [x] |
5+
| Parameter | JSON type | Remark | Implemented? |
6+
| --------------------- | ----------------------- | ------ | :----------: |
7+
| version | string | | [_] |
8+
| name | string | | [x] |
9+
| namespace | boolean | | [x] |
10+
| namespace | string | | [x] |
11+
| sources | string | | [x] |
12+
| sources | array of string | | [x] |
13+
| sources | Source | | [x] |
14+
| sources | array of Source | | [x] |
15+
| ignored-dirs | array of string | | [_] |
16+
| dependencies | array of string | | [x] |
17+
| dev-dependencies | array of string | | [x] |
18+
| generators | array of Rule-Generator | | [_] |
19+
| cut-generators | boolean | | [_] |
20+
| jsx | JSX | | [x] |
21+
| gentypeconfig | Gentype | | [_] |
22+
| compiler-flags | array of string | | [x] |
23+
| warnings | Warnings | | [x] |
24+
| ppx-flags | array of string | | [x] |
25+
| pp-flags | array of string | | [_] |
26+
| js-post-build | Js-Post-Build | | [_] |
27+
| package-specs | array of Module-Format | | [_] |
28+
| package-specs | array of Package-Spec | | [x] |
29+
| entries | array of Target-Item | | [_] |
30+
| use-stdlib | boolean | | [_] |
31+
| external-stdlib | string | | [_] |
32+
| bs-external-includes | array of string | | [_] |
33+
| suffix | Suffix | | [x] |
34+
| reanalyze | Reanalyze | | [_] |
35+
| experimental-features | ExperimentalFeatures | | [x] |
3636

3737
### Source
3838

rewatch/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub struct Config {
293293

294294
pub namespace: Option<NamespaceConfig>,
295295
pub jsx: Option<JsxSpecs>,
296-
#[serde(rename = "experimentalFeatures")]
296+
#[serde(rename = "experimental-features")]
297297
pub experimental_features: Option<HashMap<ExperimentalFeature, bool>>,
298298
#[serde(rename = "gentypeconfig")]
299299
pub gentype_config: Option<GenTypeConfig>,

rewatch/tests/experimental-invalid.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ cd $(dirname $0)
33
source "./utils.sh"
44
cd ../testrepo
55

6-
bold "Test: invalid experimentalFeatures keys produce helpful error"
6+
bold "Test: invalid experimental-features keys produce helpful error"
77

88
cp rescript.json rescript.json.bak
99

1010
node -e '
1111
const fs=require("fs");
1212
const j=JSON.parse(fs.readFileSync("rescript.json","utf8"));
13-
j.experimentalFeatures={FooBar:true};
13+
j["experimental-features"]={FooBar:true};
1414
fs.writeFileSync("rescript.json", JSON.stringify(j,null,2));
1515
'
1616

@@ -32,5 +32,5 @@ if [ $? -ne 0 ]; then
3232
exit 1
3333
fi
3434

35-
success "invalid experimentalFeatures produces helpful error"
35+
success "invalid experimental-features produces helpful error"
3636

rewatch/tests/experimental.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ cd $(dirname $0)
33
source "./utils.sh"
44
cd ../testrepo
55

6-
bold "Test: experimentalFeatures in rescript.json emits -enable-experimental as string list"
6+
bold "Test: experimental-features in rescript.json emits -enable-experimental as string list"
77

88
# Backup rescript.json
99
cp rescript.json rescript.json.bak
1010

11-
# Inject experimentalFeatures enabling LetUnwrap using node for portability
11+
# Inject experimental-features enabling LetUnwrap using node for portability
1212
node -e '
1313
const fs=require("fs");
1414
const j=JSON.parse(fs.readFileSync("rescript.json","utf8"));
15-
j.experimentalFeatures={LetUnwrap:true};
15+
j["experimental-features"]={LetUnwrap:true};
1616
fs.writeFileSync("rescript.json", JSON.stringify(j,null,2));
1717
'
1818

1919
stdout=$(rewatch compiler-args packages/file-casing/src/Consume.res 2>/dev/null)
2020
if [ $? -ne 0 ]; then
2121
mv rescript.json.bak rescript.json
22-
error "Error grabbing compiler args with experimentalFeatures enabled"
22+
error "Error grabbing compiler args with experimental-features enabled"
2323
exit 1
2424
fi
2525

@@ -37,4 +37,4 @@ fi
3737
# Restore original rescript.json
3838
mv rescript.json.bak rescript.json
3939

40-
success "experimentalFeatures emits -enable-experimental twice as string list"
40+
success "experimental-features emits -enable-experimental twice as string list"

tests/build_tests/super_errors/expected/feature_letunwrap_not_enabled.res.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
5 │ Ok()
99
6 │ }
1010

11-
Experimental feature not enabled: LetUnwrap. Enable it by setting "LetUnwrap" to true under "experimentalFeatures" in rescript.json.
11+
Experimental feature not enabled: LetUnwrap. Enable it by setting "LetUnwrap" to true under "experimental-features" in rescript.json.

tests/build_tests/super_errors/expected/let_unwrap_on_top_level_not_enabled.res.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
3 │ let? Ok(_) = x
88
4 │
99

10-
Experimental feature not enabled: LetUnwrap. Enable it by setting "LetUnwrap" to true under "experimentalFeatures" in rescript.json.
10+
Experimental feature not enabled: LetUnwrap. Enable it by setting "LetUnwrap" to true under "experimental-features" in rescript.json.

0 commit comments

Comments
 (0)