[BUG] npm 12 pack/publish drops files named like `[slug].js` that match a `files` glob
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
- 領域
- build-system, tooling
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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/
- 主要言語
- JavaScript
- スター
- 10.3k
- フォーク
- 5k
- 平均マージ
- 4日 11時間
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
npm/cli のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endings対応中かも @saruk-vedant が 7 日前に担当しました。 オープンBug Needs Triage Triage Requested
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
[BUG] npm pkg delete removes the first array item for a nonexistent property対応中かも @drawliin が 42 日前に担当しました。 オープンcmd:delete Priority 3
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings logged再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンEngineering Priority 1
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
メンテナーはふだん 2 日以内に返信
-
`npm audit signatures` does not report how many packages it skipped for want of registry keys対応中かも @greenlincoln05 が 63 日前に担当しました。 オープンPriority 3
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
docs: add SECURITY.md vulnerability reporting policy対応中かも @AK-Lmn が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
flisk-sh/linux2wasm#12 ·
メンテナーはふだん 1 日以内に返信
-
possible bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Mintplex-Labs/anything-llm#7388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
v6: Minified bootstrap.min.css is missing header info対応中かも @lazerg が今日担当しました。 オープンbug build confirmed has-pr v6
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#6332 ·
メンテナーはふだん 1 日以内に返信