CodeSampleX

Sample

Transform TypeScript AST nodes using ts.transform, ts.factory, and ts.createPrinter in TypeScript 5.9.3

sha256:250f4f22e83d2d557c8444be328d462f4f7bbe1801321479b92b3a720c225353

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node linux 24 · ubuntu · glibc 2.39 x64 node node npm

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-27

Case

HOW
Goal
Transform TypeScript AST nodes using ts.transform, ts.factory, and ts.createPrinter in TypeScript 5.9.3
Packages
Symbols
  • ts.createPrinter
  • ts.createSourceFile
  • ts.factory
  • ts.transform
  • ts.visitEachChild
Environment
node
Created
2026-08-27T18:56:50Z

Contract

  1. ts.createSourceFile parses TypeScript code into an AST SourceFile with statements and syntax kinds
  2. ts.transform applies custom TransformerFactory functions to rewrite AST nodes during compilation pipeline
  3. ts.visitEachChild recursively traverses AST child nodes and returns updated parent nodes when children are transformed
  4. ts.factory and TransformationContext.factory create and update AST nodes including identifiers, binary expressions, and call expressions
  5. ts.createPrinter formats transformed AST SourceFile and nodes back to valid TypeScript/JavaScript code
  6. TransformationResult.dispose releases transformation context and allocated AST resources after transformation

Files

  • NOTES.md
  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • test/contract.mjs

Download the source artifact (tar.gz)

Origin Seeder

anonymous