CLI cannot load explicitly selected config paths containing # or %

Abierto
#1,371 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
cli, tooling

Línea de trabajo

Start with loadConfig() in src/cli/internal.ts and the reproduction in src/cli/config.test.ts. Check how explicit paths and MPPX_CONFIG reach import(), then run the focused config tests. Done means filenames containing # or %20 load correctly and the returned path and selection precedence remain unchanged.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Check existing issues
Describe the bug

On current main, an explicitly selected CLI config exists on disk but fails to load if its filename contains a literal # or %20. A plain filename with the same contents loads normally. I reproduced this through both the explicit argument and MPPX_CONFIG, without making a request or using a wallet.

loadConfig() passes an absolute filesystem path directly to import(), which interprets URL syntax in the path instead of preserving the filename. The expected result is to load the selected file and return its original filesystem path, without changing selection or precedence.

Link to Minimal Reproducible Example

https://github.com/Osraka/mppx/blob/c170d1b36ef4f6a2c2669e7abebe999430d600b7/src/cli/config.test.ts#L58-L74

Steps To Reproduce

From the repository root at 4cd2cd25, after installing the repo dependencies:

dir=$(mktemp -d)
config="$dir/config#draft%20v2.mjs"
printf 'export default { methods: [] }\n' > "$config"
node --import tsx --input-type=module --eval 'import { loadConfig } from "./src/cli/internal.ts"; console.log(await loadConfig(process.argv[1]))' "$config"

The file exists, but the import fails. Repeat with config.mjs in the same directory to see the passing control.

Package Version

0.22.1 (main at 4cd2cd25)

Anything else?

Reproduced on macOS arm64 with Node.js 22.21.0. I prepared a narrow fix that converts the selected path to a file URL only at the import boundary. The two regression tests fail on main; with the fix, the focused config suite passes 11/11 and the direct Node matrix passes 8/8. The linked regression file is on the fixed branch; the steps above reproduce against main.

The repository currently limits PRs to collaborators, so here is the three-file diff for review if useful.

Lenguaje dominante
TypeScript
Estrellas
196
Forks
79
Merge medio
15 h 20 min
PR fusionados (30 d)
156

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de wevm/mppx

Todos los issues de wevm/mppx

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.