Context
From PR #452 review: .cts is not in AST_LANGUAGE_EXTENSIONS.typescript, so ctx.ast("file.cts", "typescript") is rejected by the plausibility guardrail. This is conservative but may be needed as .cts files appear in the wild.
Proposal
- Add
".cts" to AST_LANGUAGE_EXTENSIONS.typescript in src/engine/ast-support.ts
- In the TypeScript branch of
runner.ts, detect .cts and pass sourceType: "script" to parseJsModule (mirroring the .cjs handling)
- Add a test in
tests/engine/runner-ast.test.ts analogous to the existing .cjs/.mjs test
References
Context
From PR #452 review:
.ctsis not inAST_LANGUAGE_EXTENSIONS.typescript, soctx.ast("file.cts", "typescript")is rejected by the plausibility guardrail. This is conservative but may be needed as.ctsfiles appear in the wild.Proposal
".cts"toAST_LANGUAGE_EXTENSIONS.typescriptinsrc/engine/ast-support.tsrunner.ts, detect.ctsand passsourceType: "script"toparseJsModule(mirroring the.cjshandling)tests/engine/runner-ast.test.tsanalogous to the existing.cjs/.mjstestReferences
.ctssupportsrc/engine/ast-support.ts,src/engine/runner.ts,tests/engine/runner-ast.test.ts