示例
Prove that @babel/core loadPartialConfig() throws in Babel 8 when called without a callback, and that loadPartialConfigSync() is the required synchronous replacement — including its null return for ignored files
sha256:ece989311b3739c9235f3c4a0646704bee7ff8e4c348f7344ea4058cddeb7900
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Prove that @babel/core loadPartialConfig() throws in Babel 8 when called without a callback, and that loadPartialConfigSync() is the required synchronous replacement — including its null return for ignored files HOW
- 包
- @babel/core 8.0.1
- 环境
- node
- 创建时间
- 2026-08-16T15:15:12Z
常见的想当然
loadPartialConfig({...}) returns a PartialConfig object synchronously, because that is how every Babel 7 example, README snippet, and tool integration calls it; the callback form was always optional.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- Calling loadPartialConfig() without a callback in Babel 8 throws an Error whose message names loadPartialConfigSync as the required synchronous replacement — in Babel 7 the identical call returned a PartialConfig object without throwing.
- loadPartialConfigSync({ configFile: false, babelrc: false }) returns a non-null object with a hasFilesystemConfig() method
- loadPartialConfigSync returns null — not an empty object, not an error — when the filename matches an ignore glob
- The returned PartialConfig object exposes a fileHandling field equal to "transpile" for a normal JS file
- loadOptions() without a callback also throws in Babel 8, naming loadOptionsSync in the error message
文件
- 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