示例
Verify how @babel/preset-env resolves input domain edges across empty target queries, numeric target versions, and regex feature filters
sha256:4075ed00db008acfd57b6abf92a49a1a778223299d8463bfe3a57491b60666c2
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Verify how @babel/preset-env resolves input domain edges across empty target queries, numeric target versions, and regex feature filters HOW
- 包
- @babel/preset-env 8.0.2 @babel/core 8.0.1
- 环境
- node
- 创建时间
- 2026-08-16T17:26:03Z
常见的想当然
Setting targets to an empty array [] behaves identically to an empty object {} by defaulting to the standard baseline and leaving modern syntax untranspiled.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- Passing targets: [] resolves to an empty environment matching zero engines and forces full ES5 transpilation of modern arrow functions and const declarations, whereas targets: {} defaults to the modern baseline.
- Passing targets: { node: 0 } coerces numeric 0 to Node version 0.0.0 and forces full ES5 transpilation, while targets: { node: true } targets the active Node.js runtime.
- Setting targets.node to false or null throws a target validation error rather than disabling or ignoring the Node target.
- Passing a RegExp in include that matches zero registered preset plugins throws an invalid plugin error at preset initialization instead of acting as a no-op filter.
- Specifying overlapping plugins between include and exclude via string or regex expansion throws a preset validation error rejecting duplicate entries.
- Passing include: null throws an unhandled TypeError on length, while include: undefined or empty string is safely handled.
- Calling transformIncludesAndExcludes parses string and RegExp filters into separate plugin and builtIn Sets.
文件
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9