A JS import named like a prelude function (`fetch`, `map`, `filter`, `len`, `str`, `sum`, `every`, `indexOf`, `fail`, `log`) is bound to `__B.<name>`, not to the import
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, typescript
调研方向
阅读 issue 指出的 compiler/src/emit.rs 中的两个位置:第 361 行会从生成的 JavaScript import 中筛选名称,第 679 行会选择绑定。检查与 prelude 函数同名的导入名称在这两个位置分别如何处理,然后验证生成的模块是否按预期从 lib.js 导入并绑定 fetch。列出的名称绑定到各自的 JavaScript import 后,issue 即告解决;.rx import 明确未经过测试。
由索引模型根据 Issue 内容生成。
描述
Found while building a component library on ReactiveScript. Written with Claude Fable 5.2 (in Claude Code), which also ran the reproductions; all of them were rerun before posting.
@reactivescript/compiler 0.3.1, through @solidjs/vite-plugin 3.0.0-next.57 (vite dev server, plugins: [solid()]),
mounted with createApp from @reactivescript/runtime 0.3.1, in Chromium.
lib.js:
export const fetch = (key) => "lib.js got " + key;
a.rx:
import { fetch } from "./lib.js"
export default component App() {
source out := "-"
<div>
<button onClick={() => { out := fetch("x") }}>go</button>
<p>{out}</p>
</div>
}
It compiles with no diagnostic. After a click the paragraph shows
{"key":"x","first":{},"queue":[],"waiters":[],"started":false}
Expected: lib.js got x. guide/language.md, "Imperative code": "anything else from JS comes in through an
import from a .js module." CP-4c (spec/11-compiler.md) lists B.fetch and B.fail as the scenario prelude:
"Compiled code calls them only in a conformance build".
The generated module has no import from lib.js. It binds the name to the prelude:
const v$fetch = __B.fetch;
The same happens with:
- an alias:
import { fetch as get } from "./lib.js"emitsconst v$get = __B.fetch; - a declaration beside the module:
lib.d.rxcontainingexport fn fetch(key: string): stringis accepted and
changes nothing; - each of the other nine names: the generated code binds every one to
__B.<name>. Of those I ran onlyfail,
where the call throws the prelude's panic.
In compiler/src/emit.rs on main (eab7356, read, not built) two places exclude these names for a JS import: line
361 filters them out of the emitted import list (!builtin(&n.name) && n.name != "log"), and line 679 chooses
the binding (self.js_import(from) && !builtin(name) && name != "log"), which falls through to the __B branch.
Not tested: an import of one of these names from another .rx module.
- 主要语言
- TypeScript
- 星标
- 127
- 派生
- 7
- 平均合并
- 15 小时 42 分钟
- 30 天内合并 PR
- 63
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
solidjs/reactivescript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
solidjs/reactivescript#96 ·
维护者通常 1 天内回复
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixed可能已有人在做 @cgaaf 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
solidjs/reactivescript#84 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
solidjs/reactivescript#77 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 62/100
solidjs/reactivescript#97 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
solidjs/reactivescript#83 ·
维护者通常 1 天内回复
查看 solidjs/reactivescript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
GetStream/stream-chat-react#3467 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
vercel-labs/ui#1139 ·
维护者通常 1 天内回复
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10可能已有人在做 @goranai 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bot:ai-assisted component:platform-js status:untriaged
难度 2/5 1-3 小时 新手友好度 82/100
midnightntwrk/platform-js#93 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100