Rebuild source dependencies when package output settings change
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- ocaml
- Área
- build-system, compilers
Línea de trabajo
Empieza rastreando la invalidación existente de dependencias para los argumentos de source-map raíz durante la inicialización e inspecciona compiler-info.json junto con los artefactos .cmj generados. Después, examina la configuración de la prueba de integración para los dos proyectos que comparten una dependencia de origen. Se considera terminado cuando cambiar la configuración de salida del paquete hace que Rewatch vuelva a compilar la dependencia y ambos escenarios de orden de módulos se compilen correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
Rewatch can reuse stale dependency build artifacts when projects with different package-specs build the same source dependency.
We encountered this while working on moving Belt into the separate @rescript/belt package in the ReScript compiler repository:
- The regular analysis tests build
@rescript/beltthrough a CommonJS test project. - The reanalyze tests subsequently use the same package through an ES module test project.
- Both projects reference the same source dependency and therefore share its build artifacts.
- Rewatch considers the existing Belt artifacts current and does not rebuild them for the second project.
- The reanalyze tests fail with a misleading
Missing dependency Belt_*error.
This is not a particularly common project setup, but the compiler repository exposes the underlying invalidation problem because multiple test projects with different output formats build the same source dependency in sequence.
Dependencies are compiled using the consuming root project's package output settings. However, these settings are not recorded in lib/bs/compiler-info.json. Belt's .cmj files therefore still contain only the CommonJS package-output metadata when the ES module project is built.
The dependency files and compiler search path are present; it is the package-output metadata inside the .cmj files that is stale.
Proposed solution
Include the effective root package output settings in each package's compiler-info.json.
The stored value should contain a normalized representation of every effective package spec, including:
- Module format
in-source- Resolved suffix, including the root-level suffix fallback
During initialization, compare the current package output settings with those stored in compiler-info.json. If they differ, clean and rebuild the affected dependency.
This follows the existing mechanism that invalidates dependency builds when root source-map arguments change.
Testing
Add an integration test with two projects sharing a source dependency:
- Build the dependency through a CommonJS project.
- Build it through an ES module project without explicitly cleaning the dependency.
- Verify that Rewatch rebuilds the dependency and that the second project compiles successfully.
Ideally, test the reverse order as well.
- Lenguaje dominante
- OCaml
- Estrellas
- 7.5k
- Forks
- 485
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 55
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 rescript-lang/rescript
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
rescript-lang/rescript#8659 · 2 comentarios · 2 reacciones ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
rescript-lang/rescript#8647 ·
-
rescript-lang/rescript#8632 · 1 asignado ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
rescript-lang/rescript#8624 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
rescript-lang/rescript#8596 · 2 comentarios ·
Todos los issues de rescript-lang/rescript
Issues similares
-
nix: vendorHash is outdated Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
typelevel/sbt-typelevel#929 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
openSUSE/python-rpm-macros#219 ·
-
HMR stops working Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Qiskit/mcp-servers#221 ·