- Notifications
You must be signed in to change notification settings - Fork 471
@rescript/runtime package #7796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fc76a2e d75ee7e a73ec3d 9648a04 d9eb323 6d4021a f898991 8e3323e d6aa620 f9188db 0565afa 3a4a9d8 488edeb 99382ad 6366814 68bfe78 e2a9bf9 fb158d9 abe93b6 e829f7a f014e59 78b6bfe ef1d4ef b9f8e3f 5165128 5f4e6aa File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,18 @@ | ||
| let ( /+ ) = Filename.concat | ||
| | ||
| let rec resolveNodeModulePath ~startPath name = | ||
| let path = startPath /+ "node_modules" /+ name in | ||
| if Files.exists path then Some path | ||
| else if Filename.dirname startPath = startPath then None | ||
| else resolveNodeModulePath ~startPath:(Filename.dirname startPath) name | ||
| if name = "@rescript/runtime" then | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember exactly, but this is incomplete code. I think this is incompatible with the I tried rewriting it to avoid relying on ninja's special stdlib resolution rules, but I wasn't successful. The current resolution rules still heavily rely on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know much about the module resolution. What's the problem? Is it problem we handle as we should elsewhere but not in analysis/tools? | ||
| (* Hack: we need a reliable way to resolve modules in monorepos. *) | ||
| Some Config.runtime_module_path | ||
| else | ||
| let scope = Filename.dirname name in | ||
| let name = Filename.basename name in | ||
| let name = | ||
| match scope.[0] with | ||
| | '@' -> scope /+ name | ||
| | _ -> name | ||
| in | ||
| let path = startPath /+ "node_modules" /+ name in | ||
| if Files.exists path then Some path | ||
| else if Filename.dirname startPath = startPath then None | ||
| else resolveNodeModulePath ~startPath:(Filename.dirname startPath) name | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| lib/bs | ||
| lib/ocaml | ||
| *.lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why is a
maxDepthneeded after this PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is from @cometkim.
From what I have seen, infinite recursion can occur during module resolution without it because
rescriptdepends on@rescript/runtime, but@rescript/runtimealso hasrescriptas a dev dependency.Maybe we should add a comment there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah a comment would be good.