Skip to content

Commit 1353e65

Browse files
authored
Merge branch 'master' into rewatch-root
2 parents e549e13 + 2646aea commit 1353e65

File tree

83 files changed

+202
-391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+202
-391
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,25 @@
1919
#### :rocket: New Feature
2020

2121
- Add optional `message` argument to `Result.getOrThrow` and improve default error message. https://github.com/rescript-lang/rescript/pull/7630
22+
- Add `RegExp.escape` binding. https://github.com/rescript-lang/rescript/pull/7695
2223

2324
#### :nail_care: Polish
2425

2526
- Configuration fields `bs-dependencies`, `bs-dev-dependencies` and `bsc-flags` are now deprecated in favor of `dependencies`, `dev-dependencies` and `compiler-flags`. https://github.com/rescript-lang/rescript/pull/7658
27+
- Better error message if platform binaries package is not found. https://github.com/rescript-lang/rescript/pull/7698
2628

2729
#### :house: Internal
2830

2931
- Add rust linting to CI with `clippy`. https://github.com/rescript-lang/rescript/pull/7675
3032
- AST: use `Typ.arrows` for creation, after the refactoring of arrow types. https://github.com/rescript-lang/rescript/pull/7662
33+
- Don't skip Stdlib docstring tests. https://github.com/rescript-lang/rescript/pull/7694
34+
- Remove all leftovers of pinned-dependencies handling. https://github.com/rescript-lang/rescript/pull/7686
3135

3236
#### :bug: Bug fix
3337

3438
- Fix `--create-sourcedirs` generation with for a single project. https://github.com/rescript-lang/rescript/pull/7671
39+
- Fix rewatch not recompiling on changes under windows. https://github.com/rescript-lang/rescript/pull/7690
40+
- Fix locations of regex literals. https://github.com/rescript-lang/rescript/pull/7683
3541

3642
# 12.0.0-beta.2
3743

analysis/examples/workspace-project/bsconfig.json renamed to analysis/examples/workspace-project/rescript.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
"in-source": true
88
},
99
"suffix": ".mjs",
10-
"pinned-dependencies": ["common", "myplugin", "app"],
1110
"bs-dependencies": ["common", "myplugin", "app"]
1211
}

analysis/src/FindFiles.ml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,21 @@ let findProjectFiles ~public ~namespace ~path ~sourceDirectories ~libBs =
213213

214214
let findDependencyFiles base config =
215215
let deps =
216-
config |> Json.get "bs-dependencies" |> bind Json.array
217-
|> Option.value ~default:[]
218-
|> List.filter_map Json.string
216+
match
217+
( config |> Json.get "dependencies" |> bind Json.array,
218+
config |> Json.get "bs-dependencies" |> bind Json.array )
219+
with
220+
| None, None -> []
221+
| Some deps, None | _, Some deps -> deps |> List.filter_map Json.string
219222
in
220223
let devDeps =
221-
config
222-
|> Json.get "bs-dev-dependencies"
223-
|> bind Json.array
224-
|> Option.map (List.filter_map Json.string)
225-
|> Option.value ~default:[]
224+
match
225+
( config |> Json.get "dev-dependencies" |> bind Json.array,
226+
config |> Json.get "bs-dev-dependencies" |> bind Json.array )
227+
with
228+
| None, None -> []
229+
| Some devDeps, None | _, Some devDeps ->
230+
devDeps |> List.filter_map Json.string
226231
in
227232
let deps = deps @ devDeps in
228233
Log.log ("Dependencies: " ^ String.concat " " deps);

analysis/src/Packages.ml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,20 @@ let newBsPackage ~rootPath =
138138
[path]
139139
in
140140
let bind f x = Option.bind x f in
141-
let bsc_flags =
142-
Json.get "bsc-flags" config
143-
|> bind Json.array |> Option.value ~default:[]
141+
let compiler_flags =
142+
match
143+
( Json.get "compiler-flags" config |> bind Json.array,
144+
Json.get "bsc-flags" config |> bind Json.array )
145+
with
146+
| Some compiler_flags, None | _, Some compiler_flags ->
147+
compiler_flags
148+
| None, None -> []
144149
in
145150
let no_pervasives =
146-
bsc_flags
151+
compiler_flags
147152
|> List.exists (fun s -> Json.string s = Some "-nopervasives")
148153
in
149-
let opens_from_bsc_flags =
154+
let opens_from_compiler_flags =
150155
List.fold_left
151156
(fun opens item ->
152157
match item |> Json.string with
@@ -158,15 +163,15 @@ let newBsPackage ~rootPath =
158163
let path = name |> String.split_on_char '.' in
159164
path :: opens
160165
| _ -> opens))
161-
[] bsc_flags
166+
[] compiler_flags
162167
in
163168
let opens_from_pervasives =
164169
if no_pervasives then []
165170
else [["Stdlib"]; ["Pervasives"; "JsxModules"]]
166171
in
167172
let opens =
168173
opens_from_pervasives @ opens_from_namespace
169-
|> List.rev_append opens_from_bsc_flags
174+
|> List.rev_append opens_from_compiler_flags
170175
|> List.map (fun path -> path @ ["place holder"])
171176
in
172177
{

cli/common/bins.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,28 @@
66

77
const target = `${process.platform}-${process.arch}`;
88

9+
const supportedPlatforms = [
10+
"darwin-arm64",
11+
"darwin-x64",
12+
"linux-arm64",
13+
"linux-x64",
14+
"win32-x64",
15+
];
16+
917
/** @type {BinaryModuleExports} */
1018
let mod;
11-
try {
12-
mod = await import(`@rescript/${target}`);
13-
} catch {
19+
20+
if (supportedPlatforms.includes(target)) {
21+
const binPackageName = `@rescript/${target}`;
22+
23+
try {
24+
mod = await import(binPackageName);
25+
} catch {
26+
throw new Error(
27+
`Package ${binPackageName} not found. Make sure the rescript package is installed correctly.`,
28+
);
29+
}
30+
} else {
1431
throw new Error(`Platform ${target} is not supported!`);
1532
}
1633

0 commit comments

Comments
 (0)