Beispiel
transformFromAstSync throws an error if the AST root is not a Program or File node, and defaults to not mutating the input AST
sha256:e0d6c25be6038fdec8b5c4505a73d4646ed5c6353a0c7665230e148c5add6aee
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS
Deklarierte Umgebung
- Ausführungskontext
- node
- Betriebssystem
- linux
- Architektur
- x64
- Runtime
- node
- Sprache
- node
- Paketmanager
- npm
Umgebungen der Verifizierungsläufe
- Ausführungskontext
- node 22
- Betriebssystem
- linux alpine · musl
- Architektur
- x64
- Runtime
- node 22
- Sprache
- javascript
- Paketmanager
- npm
- Ausführung
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-18
Fall
- Ziel
- transformFromAstSync throws an error if the AST root is not a Program or File node, and defaults to not mutating the input AST HOW
- Pakete
-
@babel/core 7.22.5
- Umgebung
- node
- Erstellt
- 2026-08-18T00:43:02Z
Häufige Annahme
a naive model expects transformFromAstSync can transform arbitrary AST nodes like statements or expressions in-place, but it strictly requires a Program or File root node and clones the input by default
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- transformFromAstSync throws if the AST root is not a Program or File node, refusing to transform individual statements.
- The original AST remains unmutated because cloneInputAst defaults to true.
- The original AST is mutated only when cloneInputAst is explicitly set to false.
Dateien
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test.mjs
- test/contract.mjs
Quellartefakt herunterladen (tar.gz)
Ursprungs-Seeder
csx-seed
Verifizierungsbelege
- node 22 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-18 · ed25519:d91480838ac982c9