feat(ttsc): add TtscCompiler.transform() for 3rd parties.#38
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the ttsc transform single-file CLI command and shifts that “single-file / embed-style transform” use case to a new programmatic JS API (TtscCompiler.transform()), while renaming internal single-file emit plumbing and updating smoke tests/fixtures accordingly.
Changes:
- Remove
ttsc transformfrom the Go CLI/platform helper and delete related smoke corpus projects/tests. - Add
TtscCompiler.transform()and a new publicITtscCompilerTransformationresult type (embed-typescript-style union). - Rename/refactor internal single-file emit logic (
runTransform→runSingleFileEmit) and update tests/docs references.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/smoke/test/utility-plugins.test.cjs | Removes transform-mode coverage and reformats a few assertions; keeps build-path utility plugin coverage. |
| tests/smoke/test/transform-projects.test.cjs | Deletes the transform CLI project corpus tests. |
| tests/smoke/test/toolchain.test.cjs | Updates toolchain smoke tests to assert transform is rejected; formatting refactors. |
| tests/smoke/test/plugin-corpus.test.cjs | Replaces transform CLI usage with build/emit assertions; removes transform-specific source-plugin test. |
| tests/smoke/test/native-transformer.test.cjs | Adds a focused smoke test for the Go native transformer in project build mode. |
| tests/projects/transform-tsx/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-tsx/src/view.tsx | Removes transform CLI fixture source. |
| tests/projects/transform-space/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-space/src/throw error.ts | Removes transform CLI fixture source (space-in-path coverage). |
| tests/projects/transform-mts/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-mts/src/main.mts | Removes transform CLI fixture source. |
| tests/projects/transform-hello/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-hello/src/hello.ts | Removes transform CLI fixture source. |
| tests/projects/transform-extends/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-extends/tsconfig.base.json | Removes transform CLI fixture. |
| tests/projects/transform-extends/src/main.ts | Removes transform CLI fixture source. |
| tests/projects/transform-diagnostic/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-diagnostic/src/main.ts | Removes transform CLI fixture source. |
| tests/projects/transform-cts/tsconfig.json | Removes transform CLI fixture. |
| tests/projects/transform-cts/src/main.cts | Removes transform CLI fixture source. |
| tests/projects/go-source-plugin/go-plugin/main.go | Removes transform command support from the Go source-plugin fixture. |
| tests/projects/go-source-plugin-tsgo/go-plugin/main.go | Removes transform command support from the Go source-plugin fixture. |
| tests/projects/go-source-plugin-properties/go-plugin/main.go | Removes transform command support from the Go source-plugin fixture. |
| tests/projects/go-source-plugin-entry/go-plugin/cmd/transformer/main.go | Removes transform command support from the Go source-plugin fixture entry binary. |
| tests/projects/go-source-plugin-checker/go-plugin/main.go | Updates comments and removes transform path from checker fixture. |
| packages/ttsc/test/compiler.test.ts | Adds tests for TtscCompiler.transform() success/failure behavior. |
| packages/ttsc/src/structures/internal/TtscSingleFileEmitOptions.ts | Renames internal options interface for single-file emit path. |
| packages/ttsc/src/structures/internal/TtscCommonOptions.ts | Updates internal options comment to reflect removal of transform CLI path. |
| packages/ttsc/src/structures/index.ts | Exports the new ITtscCompilerTransformation public type. |
| packages/ttsc/src/structures/ITtscCompilerTransformation.ts | Introduces a new public transformation result union type. |
| packages/ttsc/src/launcher/internal/runTtsc.ts | Removes transform command handling; routes single-file emit via renamed helper. |
| packages/ttsc/src/compiler/internal/runSingleFileEmit.ts | Renames/refines the internal helper that emits one file via temp build output. |
| packages/ttsc/src/TtscCompiler.ts | Adds transform() API and result-mapping helper from compile → transformation shape. |
| packages/ttsc/driver/program.go | Updates ForceEmit comment to remove mention of ttsc transform. |
| packages/ttsc/cmd/ttsc/transform.go | Deletes the Go CLI single-file transform implementation. |
| packages/ttsc/cmd/ttsc/main.go | Removes transform command and its help/docs from the Go CLI entrypoint. |
| packages/ttsc/cmd/platform/main.go | Removes transform from platform helper’s recognized JS-provided commands list. |
| articles/lint.md | Tweaks article title text. |
| AGENTS.md | Updates smoke test list and CLI/API parity checklist to reflect new API surface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request removes the single-file
transformcommand from thettscCLI, deprecating the CLI interface for per-file transforms in favor of a new JS API method,TtscCompiler.transform. The change clarifies the separation between project-wide builds (the main use case for the CLI) and single-file transformations (now accessible via the JS API), and updates related documentation, test references, and code paths accordingly.CLI and API changes:
transformcommand and all related CLI flags, documentation, and code from the Go CLI (packages/ttsc/cmd/ttsc/main.go,packages/ttsc/cmd/platform/main.go, and deletedpackages/ttsc/cmd/ttsc/transform.go). The CLI now only supports project-wide build and check commands. [1] [2] [3] [4] [5] [6]transformmethod to theTtscCompilerJS API, which provides single-file transformation functionality for plugin authors and matches the shape ofembed-typescript's API. [1] [2] [3]runTransformtorunSingleFileEmitand updating related error messages and temporary directory names. [1] [2] [3] [4]transformcommand handling from the JS launcher and related argument parsing. [1] [2]Documentation and test updates:
transformCLI and clarify the new approach (includingAGENTS.mdand smoke suite test lists). [1] [2] [3]ForceEmit.@ttsc/lintarticle title for clarity.