Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01a4a81

Browse files
authored
Merge pull request#1126 from nojaf/pnpm
Add support for pnpm
2 parents3d9a6d9 +72b0867 commit01a4a81

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

‎server/src/find-runtime.ts‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ async function findNodeModulesDirs(
5151
returnnodeModulesDirs;
5252
}
5353

54-
// Custom function to find Deno vendorized@rescript/runtime directories
55-
asyncfunctionfindDenoRescriptRuntime(nodeModulesPath:string){
54+
// Custom function to find Deno or pnpm vendorized@rescript/runtime directories
55+
asyncfunctionfindRescriptRuntimeInAlternativeLayout(
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-
constdenoRoot=join(nodeModulesPath,".deno");
61+
constalternativeRoot=join(nodeModulesPath,subfolder);
5962
letentries:string[];
6063
try{
61-
entries=awaitreaddir(denoRoot);
64+
entries=awaitreaddir(alternativeRoot);
6265
}catch{
6366
return[];
6467
}
@@ -71,7 +74,7 @@ async function findDenoRescriptRuntime(nodeModulesPath: string) {
7174
constresults:string[]=[];
7275
for(constdirofvendorDirs){
7376
construntimePath=join(
74-
denoRoot,
77+
alternativeRoot,
7578
dir,
7679
"node_modules",
7780
"@rescript",
@@ -102,15 +105,28 @@ async function findRuntimePath(project: string) {
102105
conststat=awaitstatAsync(standardPath);
103106
if(stat.isDirectory()){
104107
results.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 orDeno layouts
106109
returnresults;
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+
constpnpmResults=awaitfindRescriptRuntimeInAlternativeLayout(
117+
".pnpm",
118+
nm,
119+
);
120+
results.push(...pnpmResults);
121+
if(results.length>0){
122+
returnresults;
123+
}
124+
112125
// Only check for Deno vendorized layouts if standard layout wasn't found
113-
constdenoResults=awaitfindDenoRescriptRuntime(nm);
126+
constdenoResults=awaitfindRescriptRuntimeInAlternativeLayout(
127+
".deno",
128+
nm,
129+
);
114130
results.push(...denoResults);
115131

116132
returnresults;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp