[BUG] npm 12 pack/publish drops files named like `[slug].js` that match a `files` glob
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 66/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- build-system, tooling
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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/
- Lingua principale
- JavaScript
- Stelle
- 10.3k
- Fork
- 5k
- Merge medio
- 4g 11h
- PR unite (30g)
- 26
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di npm/cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endingsForse già presa @saruk-vedant l’ha presa 7 giorni fa. ApertaBug Needs Triage Triage Requested
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
-
[BUG] npm pkg delete removes the first array item for a nonexistent propertyForse già presa @drawliin l’ha presa 42 giorni fa. Apertacmd:delete Priority 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 2 giorni
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. ApertaEngineering Priority 1
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 2 giorni
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysForse già presa @greenlincoln05 l’ha presa 63 giorni fa. ApertaPriority 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 2 giorni
Issue simili
-
docs: add SECURITY.md vulnerability reporting policyForse già presa @AK-Lmn l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
flisk-sh/linux2wasm#12 ·
I maintainer di solito rispondono entro 1 giorno
-
possible bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Mintplex-Labs/anything-llm#7388 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 60/100
I maintainer di solito rispondono entro 1 giorno
-
v6: Minified bootstrap.min.css is missing header infoForse già presa @lazerg l’ha presa oggi. Apertabug build confirmed has-pr v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
githubnext/gh-aw-workshop#6332 ·
I maintainer di solito rispondono entro 1 giorno