@@ -51,14 +51,17 @@ async function findNodeModulesDirs(
5151return nodeModulesDirs ;
5252}
5353
54- // Custom function to find Deno vendorized@rescript /runtime directories
55- async function findDenoRescriptRuntime ( nodeModulesPath :string ) {
54+ // Custom function to find Deno or pnpm vendorized@rescript /runtime directories
55+ async function findRescriptRuntimeInAlternativeLayout (
56+ subfolder :".deno" | ".pnpm" ,
57+ nodeModulesPath :string ,
58+ ) {
5659// We only care about the Deno vendorized layout:
5760// <nodeModulesPath>/.deno/@rescript+runtime@<version>/node_modules/@rescript/runtime
58- const denoRoot = join ( nodeModulesPath , ".deno" ) ;
61+ const alternativeRoot = join ( nodeModulesPath , subfolder ) ;
5962let entries :string [ ] ;
6063try {
61- entries = await readdir ( denoRoot ) ;
64+ entries = await readdir ( alternativeRoot ) ;
6265} catch {
6366return [ ] ;
6467}
@@ -71,7 +74,7 @@ async function findDenoRescriptRuntime(nodeModulesPath: string) {
7174const results :string [ ] = [ ] ;
7275for ( const dir of vendorDirs ) {
7376const runtimePath = join (
74- denoRoot ,
77+ alternativeRoot ,
7578dir ,
7679"node_modules" ,
7780"@rescript" ,
@@ -102,15 +105,28 @@ async function findRuntimePath(project: string) {
102105const stat = await statAsync ( standardPath ) ;
103106if ( stat . isDirectory ( ) ) {
104107results . push ( standardPath ) ;
105- // If we found standard layout, no need to search for Deno layouts
108+ // If we found standard layout, no need to search forpnpm or Deno layouts
106109return results ;
107110}
108111} catch ( e ) {
109112// Directory doesn't exist, continue
110113}
111114
115+ // Only check for pnpm vendorized layouts if standard layout wasn't found
116+ const pnpmResults = await findRescriptRuntimeInAlternativeLayout (
117+ ".pnpm" ,
118+ nm ,
119+ ) ;
120+ results . push ( ...pnpmResults ) ;
121+ if ( results . length > 0 ) {
122+ return results ;
123+ }
124+
112125// Only check for Deno vendorized layouts if standard layout wasn't found
113- const denoResults = await findDenoRescriptRuntime ( nm ) ;
126+ const denoResults = await findRescriptRuntimeInAlternativeLayout (
127+ ".deno" ,
128+ nm ,
129+ ) ;
114130results . push ( ...denoResults ) ;
115131
116132return results ;