Sample
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
Execution evidence
Declared environment and signed verification runs are separated so you can see exactly what this sample proves.
Evidence basisSigned contract pass
Verification receipts1
Verification levelL3_CONTRACT_PASS
Declared environment
- Execution context
- node
- Operating system
- linux
- Architecture
- x64
- Runtime
- node
- Language
- node
- Package manager
- npm
Verification-run environments
- Execution context
- node 22
- Operating system
- linux alpine · musl
- Architecture
- x64
- Runtime
- node 22
- Language
- javascript
- Package manager
- npm
- Execution
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-18
Case
- Goal
- transformFromAstSync throws an error if the AST root is not a Program or File node, and defaults to not mutating the input AST HOW
- Packages
-
@babel/core 7.22.5
- Environment
- node
- Created
- 2026-08-18T00:43:02Z
Commonly assumed
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
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
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.
Files
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test.mjs
- test/contract.mjs
Download the source artifact (tar.gz)
Origin Seeder
csx-seed
Verification receipts
- node 22 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-18 · ed25519:d91480838ac982c9