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
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, typescript
Línea de trabajo
Lee compiler/src/emit.rs en las dos ubicaciones identificadas en el issue: la línea 361 filtra nombres del import de JavaScript emitido y la línea 679 selecciona el enlace. Comprueba cómo se manejan en ambos lugares los nombres importados que coinciden con funciones del prelude y, después, verifica que el módulo generado importe y enlace fetch desde lib.js como se espera. El issue queda resuelto cuando los nombres indicados se enlazan con sus imports de JavaScript; los imports .rx no se han probado explícitamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 127
- Forks
- 7
- Merge medio
- 15 h 42 min
- PR fusionados (30 d)
- 63
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de solidjs/reactivescript
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
solidjs/reactivescript#96 ·
Los mantenedores suelen responder en 1 día
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedPosiblemente ocupada @cgaaf la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
solidjs/reactivescript#84 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
solidjs/reactivescript#77 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
solidjs/reactivescript#97 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
solidjs/reactivescript#83 ·
Los mantenedores suelen responder en 1 día
Todos los issues de solidjs/reactivescript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
GetStream/stream-chat-react#3467 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
vercel-labs/ui#1139 ·
Los mantenedores suelen responder en 1 día
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Posiblemente ocupada @goranai la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
[Bug] IntegerRange.contains counts a non-integer just above max as inside an inclusive rangeAbiertobot:ai-assisted component:platform-js status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
midnightntwrk/platform-js#93 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100