[BUG] npm 12 pack/publish drops files named like `[slug].js` that match a `files` glob
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 66/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- build-system, tooling
Línea de trabajo
The report points to processPackage in npm-packlist/lib/index.js, where globSync results are added as ignore rules. Start by reading that code and the packlist tests for files patterns; reproduce with the provided [slug].js example. Done means npm pack includes filenames with glob characters when they match a files entry, with regression coverage for the reported case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
With npm 12, a file whose name contains [ ] (or { }, or an extglob like +(a)) is left out of the tarball even though a files entry matches it. Route files such as [slug].js, [id].vue or [...all].astro are the common case. npm 11 packs them.
Expected Behavior
Every file matched by a files glob is packed, whatever characters its name contains.
Steps To Reproduce
mkdir -p rep/dist/blog && cd rep
echo '{"name":"rep","version":"1.0.0","files":["dist/**/*.js"]}' > package.json
echo x > dist/index.js
echo x > 'dist/blog/[slug].js'
npm pack --dry-run 2>&1 | grep -E 'B (dist|package)'
npm 12.2.2:
npm notice 2B dist/index.js
npm notice 58B package.json
npm 11.20.0 (and pnpm 12.18.0, bun 1.4.4):
npm notice 2B dist/blog/[slug].js
npm notice 2B dist/index.js
npm notice 58B package.json
Escaping does not help either: "files": ["app/\\[locale\\]/page.js"] also packs nothing from app/[locale]/.
Environment
- npm: 12.2.2 (bundles npm-packlist 11.3.0, same as npm-packlist
mainat d1eed617 and npm/clilatestat ab930df8) - Node.js: 26.13.0
- OS Name: Debian, Linux 6.1
Likely cause: processPackage in npm-packlist lib/index.js expands each files entry with globSync and then pushes the matched path back as an ignore rule (!/${rel}) without escaping it, so ignore-walk reads [slug] as a character class and {a,b} as a brace expansion, and the rule no longer matches the file it came from.
Credit: https://ucsbplse.github.io/
- Lenguaje dominante
- JavaScript
- Estrellas
- 10.3k
- Forks
- 5k
- Merge medio
- 4 d 11 h
- PR fusionados (30 d)
- 26
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 npm/cli
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 2 días
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endingsPosiblemente ocupada @saruk-vedant la tomó hace 7 días. AbiertoBug Needs Triage Triage Requested
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
npm/cli#10316 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[BUG] npm pkg delete removes the first array item for a nonexistent propertyPosiblemente ocupada @drawliin la tomó hace 42 días. Abiertocmd:delete Priority 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 2 días
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoEngineering Priority 1
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
Los mantenedores suelen responder en 2 días
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysPosiblemente ocupada @greenlincoln05 la tomó hace 63 días. AbiertoPriority 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
npm/cli#10018 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
Issues similares
-
docs: add SECURITY.md vulnerability reporting policyPosiblemente ocupada @AK-Lmn la tomó hoy. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
flisk-sh/linux2wasm#12 ·
Los mantenedores suelen responder en 1 día
-
possible bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Mintplex-Labs/anything-llm#7388 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 60/100
Los mantenedores suelen responder en 1 día
-
v6: Minified bootstrap.min.css is missing header infoPosiblemente ocupada @lazerg la tomó hoy. Abiertobug build confirmed has-pr v6
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
githubnext/gh-aw-workshop#6332 ·
Los mantenedores suelen responder en 1 día