@@ -191,6 +191,10 @@ function getBscArgs(
191191 entry . project . workspaceRootPath ,
192192 c . rewatchLockPartialPath
193193 ) ;
194+ const rescriptLockfile = path . resolve (
195+ entry . project . workspaceRootPath ,
196+ c . rescriptLockPartialPath
197+ ) ;
194198 let buildSystem : "bsb" | "rewatch" | null = null ;
195199
196200 let stat : fs . Stats | null = null ;
@@ -202,9 +206,16 @@ function getBscArgs(
202206 stat = fs . statSync ( rewatchLockfile ) ;
203207 buildSystem = "rewatch" ;
204208 } catch { }
209+ try {
210+ stat = fs . statSync ( rescriptLockfile ) ;
211+ buildSystem = "rewatch" ;
212+ }
213+ catch { }
205214 if ( buildSystem == null ) {
206215 console . log ( "Did not find build.ninja or rewatch.lock, cannot proceed.." ) ;
207216 return Promise . resolve ( null ) ;
217+ } else if ( debug ( ) ) {
218+ console . log ( `Using build system: ${ buildSystem } for ${ entry . file . sourceFilePath } ` ) ;
208219 }
209220 const bsbCacheEntry = entry . buildNinja ;
210221 const rewatchCacheEntry = entry . buildRewatch ;
@@ -298,20 +309,28 @@ function getBscArgs(
298309 entry . project . workspaceRootPath ,
299310 "node_modules/@rolandpeelen/rewatch/rewatch"
300311 ) ;
312+ let rescriptRewatchPath = null ;
301313 if ( semver . valid ( project . rescriptVersion ) &&
302314 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" )
313331 }
314332 }
333+
315334 const rewatchArguments = semver . satisfies ( project . rescriptVersion , ">12.0.0-alpha.14" , { includePrerelease : true } ) ? [
316335 "compiler-args" ,
317336 "--rescript-version" ,
0 commit comments