@@ -191,6 +191,10 @@ function getBscArgs(
191
191
entry . project . workspaceRootPath ,
192
192
c . rewatchLockPartialPath
193
193
) ;
194
+ const rescriptLockfile = path . resolve (
195
+ entry . project . workspaceRootPath ,
196
+ c . rescriptLockPartialPath
197
+ ) ;
194
198
let buildSystem : "bsb" | "rewatch" | null = null ;
195
199
196
200
let stat : fs . Stats | null = null ;
@@ -202,9 +206,16 @@ function getBscArgs(
202
206
stat = fs . statSync ( rewatchLockfile ) ;
203
207
buildSystem = "rewatch" ;
204
208
} catch { }
209
+ try {
210
+ stat = fs . statSync ( rescriptLockfile ) ;
211
+ buildSystem = "rewatch" ;
212
+ }
213
+ catch { }
205
214
if ( buildSystem == null ) {
206
215
console . log ( "Did not find build.ninja or rewatch.lock, cannot proceed.." ) ;
207
216
return Promise . resolve ( null ) ;
217
+ } else if ( debug ( ) ) {
218
+ console . log ( `Using build system: ${ buildSystem } for ${ entry . file . sourceFilePath } ` ) ;
208
219
}
209
220
const bsbCacheEntry = entry . buildNinja ;
210
221
const rewatchCacheEntry = entry . buildRewatch ;
@@ -298,20 +309,28 @@ function getBscArgs(
298
309
entry . project . workspaceRootPath ,
299
310
"node_modules/@rolandpeelen/rewatch/rewatch"
300
311
) ;
312
+ let rescriptRewatchPath = null ;
301
313
if ( semver . valid ( project . rescriptVersion ) &&
302
314
semver . satisfies ( project . rescriptVersion as string , ">11" , { includePrerelease : true } ) ) {
303
- const rescriptRewatchPath = await utils . findRewatchBinary ( entry . project . workspaceRootPath )
304
- if ( rescriptRewatchPath != null ) {
305
- rewatchPath = rescriptRewatchPath ;
306
- if ( debug ( ) ) {
307
- console . log ( `Found rewatch binary bundled with v12: ${ rescriptRewatchPath } ` )
308
- }
309
- } else {
310
- if ( debug ( ) ) {
311
- console . log ( "Did not find rewatch binary bundled with v12" )
312
- }
315
+ rescriptRewatchPath = await utils . findRewatchBinary ( entry . project . workspaceRootPath )
316
+ }
317
+
318
+ if ( semver . valid ( project . rescriptVersion ) &&
319
+ semver . satisfies ( project . rescriptVersion as string , ">=12.0.0-beta.1" , { includePrerelease : true } ) ) {
320
+ rescriptRewatchPath = await utils . findRescriptExeBinary ( entry . project . workspaceRootPath )
321
+ }
322
+
323
+ if ( rescriptRewatchPath != null ) {
324
+ rewatchPath = rescriptRewatchPath ;
325
+ if ( debug ( ) ) {
326
+ console . log ( `Found rewatch binary bundled with v12: ${ rescriptRewatchPath } ` )
327
+ }
328
+ } else {
329
+ if ( debug ( ) ) {
330
+ console . log ( "Did not find rewatch binary bundled with v12" )
313
331
}
314
332
}
333
+
315
334
const rewatchArguments = semver . satisfies ( project . rescriptVersion , ">12.0.0-alpha.14" , { includePrerelease : true } ) ? [
316
335
"compiler-args" ,
317
336
"--rescript-version" ,
0 commit comments