A task config has no place for settings another tool reads, so keeping them beside the task takes a patch to Vite+
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 15/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- rust, typescript
- 領域
- tooling
研究方向
The task schema is UserTaskConfig in crates/vt_graph/src/config/user.rs, where unknown fields are denied; the issue asks for one ignored metadata field there. The generated type is crates/vt_graph/run-config.ts, and the static run path is in packages/cli/binding/src/cli/handler.rs. Shipping this needs a maintainer decision on the design across two repositories first, so check with them before writing code.
由索引模型根據 Issue 內容生成。
描述
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
What happens
A task rejects keys that Vite Task doesn't know: UserTaskConfig denies unknown fields (crates/vt_graph/src/config/user.rs:317-320 at a3c087a7, the revision Vite+ 1.4.0 pins), and since #815 the error names the field. That catches typos, which is right. But it also leaves no room for a setting that another tool reads from the same task.
The types close the same door. Task is generated from Vite Task's types as a type alias (crates/vt_graph/run-config.ts), and Vite+ ships it as one, so a tool can't add to it with declaration merging, the way it can extend Vite's UserConfig interface.
Stripping the keys before Vite Task decodes the config doesn't work for every config either. Vite+ first tries to extract run statically and decodes it in Rust (packages/cli/binding/src/cli/handler.rs:167-176 in Vite+ 1.4.0). Only a config it can't read statically reaches the JavaScript callback, which is decoded by the same Rust type. So a literal task that carries another tool's setting fails to load:
export default defineConfig({
run: { tasks: { check: { command: 'true', ci: { job: true } } } },
});
// vp run → unknown field `ci`
The case that motivates it
We generate our CI workflows from the task graph. Whether a task gets a CI job, and its schedule, are per-task settings that belong beside the task. Today a patch to Vite+ adds them to Task's type and strips them in resolveUniversalViteConfig. That works only for configs built through helpers, which skip the static path. The patch has to be reapplied on every Vite+ release, and any edit to it changes the lockfile's patch hash, so every task that fingerprints its dependencies misses once.
The ask
A metadata key on a task that Vite Task accepts and never reads. Cargo does this with package.metadata, for the same reason #815 names unknown fields: "Cargo by default will warn about unused keys in Cargo.toml to assist in detecting typos and such. The package.metadata table, however, is completely ignored by Cargo and will not be warned about." (Cargo: the metadata table)
// in a tool's types
declare module 'vite-plus' {
interface TaskMetadata {
ci?: { job?: boolean };
}
}
// in a config
tasks: {
'test:e2e': {
command: 'playwright test',
metadata: { ci: { job: true } },
},
}
What it means in each case:
- Its value must be a JSON object. Anything else (a number, an array,
null) is a config error, like any other mistyped field. - Inside it, Vite Task decodes nothing, validates nothing and outputs nothing, in any listing or in
--jsonoutput either. Tools read it from the config. Only JSON reaches Vite Task, as for every field: the JavaScript path serializesrunto JSON before Rust decodes it. - It isn't in any cache key. Editing it re-keys nothing.
- Outside
metadata, checking stays as strict as today, so #815's errors stay. - The static path reads it like any other field and ignores it, the same as the JavaScript path.
- Types:
metadata?: TaskMetadata, whereTaskMetadatais an empty interface that tools extend. By convention each tool takes one top-level key.
Where it goes, in two repositories:
- Vite Task: an ignored
metadatafield onUserTaskConfig, with a ts-rs type override so that the generatedrun-config.tsrefers toTaskMetadataby name. - Vite+:
export interface TaskMetadata {}, declared and exported from its entry (packages/cli/src/index.ts). Today that entry exports no run-config type.
This keeps the task schema lean. Vite Task gains one field it never interprets, instead of fields shaped by each tool. #277 asks for description, a key Vite Task would own and display; this is the opposite, a place for keys it never reads.
Alternatives considered
- Allow unknown keys. That loses #815's errors.
- A top-level key of the tool's own, keyed by task name. This works today: Vite's
UserConfigcan be extended, and the static path reads onlyrun. But each task's settings then sit in a second map in the same file, every tool repeats that map, and renaming a task leaves its settings behind under the old name. - A helper in each config that strips the tool's keys. Every package's config has to call it, and the tool can't then read what the helper stripped from the config Vite Task got.
- 主要語言
- Rust
- 星號
- 485
- 分支
- 51
- 平均合併
- 23 小時 40 分鐘
- 30 天內合併 PR
- 55
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/vite-task 的其他 Issue
-
fspy linux backend
難度 5/5 一週以上 新手友好度 6/100
voidzero-dev/vite-task#932 ·
維護者通常 1 天內回覆
-
remote cache
難度 5/5 一週以上 新手友好度 12/100
voidzero-dev/vite-task#931 ·
維護者通常 1 天內回覆
-
remote cache
難度 5/5 一週以上 新手友好度 5/100
voidzero-dev/vite-task#930 ·
維護者通常 1 天內回覆
-
read-write overlap
難度 5/5 一週以上 新手友好度 5/100
voidzero-dev/vite-task#929 ·
維護者通常 1 天內回覆
-
難度 3/5 半天 新手友好度 50/100
voidzero-dev/vite-task#928 ·
維護者通常 1 天內回覆
查看 voidzero-dev/vite-task 的全部 Issue
相似的 Issue
-
parity priority: low ui
難度 2/5 1-3 小時 新手友好度 67/100
storytold/vectorcraft#5660 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 79/100
qingjian-team/qingjian#901 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
longbridge/gpui-kit#3795 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 2 天內回覆