Feature request: Qualified subdirectories (directory-based module namespaces)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- ocaml
- 领域
- compilers
调研方向
Read the existing recursive source scanning behavior described in the issue and the related proposals #1974, #1805, and #2459. The issue does not name implementation files or tests; first locate where subdirs: true is handled in the compiler and review its module naming rules. Done means an opt-in qualified mode supports the shown directory hierarchy and duplicate filenames while preserving the default behavior.
由索引模型根据 Issue 内容生成。
描述
Feature request: Qualified subdirectories (directory-based module namespaces)
Hi! I've been using ReScript a bit in my free time recently, and have been really enjoying it. However I've found it quite difficult/frustrating to organize code/packages using ReScript's existing tooling (even when using the "monorepo" features).
I'd like to propose an opt-in feature similar to Dune's (include_subdirs qualified), where source directories automatically become part of the ReScript module hierarchy.
For example, given:
src/
App.res
Components/
Button.res
Input.res
Admin/
Button.res
App.res could reference Components.Button, Components.Input, and Admin.Button.
This would provide two benefits:
- Better code organization: Module hierarchies could mirror the filesystem without manually creating wrapper modules.
- Duplicate filenames: Files such as
Components/Button.resandAdmin/Button.rescould coexist without module-name collisions.
Currently, recursive source scanning (subdirs: true) places all files in a flat module namespace.
Ideally, this would be an opt-in configuration (perhaps subdirs: "qualified"), preserving existing behavior by default. Directory modules could be implemented using compile-time aliases, without introducing additional JavaScript runtime wrappers.
Related issues
- [#1974 — Allow duplicate filenames / path-derived module names](https://github.com/rescript-lang/rescript/issues/1974): Closely related proposal, including examples like
Pages__Index. - [#1805 — Namespace proposal](https://github.com/rescript-lang/rescript/issues/1805): Earlier work on package-level namespaces.
- [#2459 — Recursive subdirectory scanning](https://github.com/rescript-lang/rescript/issues/2459): Related source-discovery functionality, but without directory qualification.
References
Thanks!
Ethan
- 主要语言
- OCaml
- 星标
- 7.5k
- 派生
- 483
- 平均合并
- 20 小时
- 30 天内合并 PR
- 219
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rescript-lang/rescript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
rescript-lang/rescript#9037 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 12/100
rescript-lang/rescript#9044 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 70/100
rescript-lang/rescript#8997 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
rescript-lang/rescript#8994 ·
维护者通常 1 天内回复
-
Have formatter insert newlines around multi-line expressions可能已有人在做 @rolandpeelen 于 4 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 25/100
rescript-lang/rescript#8960 ·
维护者通常 1 天内回复
查看 rescript-lang/rescript 的全部 Issue
相似的 Issue
-
crash lld:COFF
难度 2/5 1-3 小时 新手友好度 77/100
llvm/llvm-project#235970 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
-
A-gca C-experience-report
难度 2/5 1-3 小时 新手友好度 65/100
rust-lang/project-const-generics#124 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复