Package.json script tasks don't expose npm lifecycle env; cache-enabled tasks strip host-stamped values
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- nodejs, rust
- 領域
- build-system, tooling
調査の方向性
vt_plan の plan_spawn_execution から始め、EnvFingerprints::resolve、DEFAULT_UNTRACKED_ENV、既存の MARKER_ENV_NAME の挿入を調べます。次に、キャッシュされるケースを含め、vp_run_env の end-to-end fixture を最初から最後まで読みます。完了条件は、package.json のタスクが、キャッシュが有効なタスクを含め、関連する npm lifecycle environment を保持し、報告された動作をカバーしていることです。
索引モデルが issue の本文から書いたものです。
説明
Summary
When vite-task spawns a package.json script, the child gets none of the npm lifecycle environment variables (npm_execpath, npm_config_user_agent, npm_lifecycle_event, npm_node_execpath, …) that npm, pnpm, and Yarn all set when they run scripts. Tools that detect their invoking package manager from that env — npm-run-all2/run-p being the common one — silently fall back to npm, which then fails devEngines.packageManager enforcement in pnpm projects.
Downstream report: voidzero-dev/vite-plus#2317 (vpr check → run-p → npm → EBADDEVENGINES). Reproduced there with a minimal project: pnpm run check sets npm_execpath=<pnpm>/bin/pnpm.mjs, npm_config_user_agent=pnpm/11.20.0 …, npm_lifecycle_event=probe for the child; the same script through the task runner gets none of them.
Why a vite-plus-side fix can't fully cover it
voidzero-dev/vite-plus#2385 stamps npm_execpath / npm_config_user_agent / npm_node_execpath / INIT_CWD into the process env before Session::init snapshots it. That works for plain scripts (which default to cache: scripts: false), but two pieces need the planner:
- Cache-enabled tasks strip the stamped vars again.
plan_spawn_executionrunsEnvFingerprints::resolve(&mut spawn_envs, &cache_config.env_config)before spawning, andDEFAULT_UNTRACKED_ENVcontains no lowercasenpm_*name (matching is case-sensitive on Unix). So forcache: { scripts: true }or config-defined tasks (cached by default), the session-level stamp is filtered out and the npm fallback returns — only in the cached case, which no fixture currently exercises. TheVP_RUNmarker had this exact problem and is re-inserted after the filter, with a comment explaining why. npm_lifecycle_event/npm_lifecycle_scriptare per-task values (script name / script body). Only the planner knows them; a session-level stamp can't provide them. pnpm sets both for every script it runs.
Suggested direction
- Re-insert the lifecycle names post-filter next to the existing
MARKER_ENV_NAMEinsert invt_plan(or add them toDEFAULT_UNTRACKED_ENV), so host-provided lifecycle env survives cache-enabled tasks. - Optionally set
npm_lifecycle_event(andnpm_lifecycle_script) from the task itself when spawning package.json scripts, which vite-plus cannot do from outside.
Happy to send a PR for either or both if the direction sounds right — the vp_run_env e2e fixture looks like the natural place for coverage (its cached case already demonstrates the marker surviving the env filter).
- 主要言語
- Rust
- スター
- 468
- フォーク
- 42
- 平均マージ
- 2日 31分
- マージ済み PR(30日)
- 46
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/vite-task のほかの issue
-
remote cache
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
voidzero-dev/vite-task#768 ·
メンテナーはふだん 1 日以内に返信
-
remote cache
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
voidzero-dev/vite-task#767 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
voidzero-dev/vite-task#738 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
voidzero-dev/vite-task#719 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
voidzero-dev/vite-task#717 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/vite-task の issue をすべて見る
似ている issue
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
stackabletech/kafka-operator#1033 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue needs testing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
farion1231/cc-switch#7744 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
datafusion
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/iceberg-rust#3297 ·
メンテナーはふだん 1 日以内に返信