Rework: replace custom TS codegen with SWC AST#93
Merged
renardeinside merged 15 commits intomainfrom Feb 19, 2026
Merged
Conversation
…based addon application (#77)
…uter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ve stale addons - Simplify _base.py: drop Generic[T], abstract get_instance, as_depends - Fix _defaults.py: use @staticmethod, fix ConfigDependency Depends() target - Fix SQL addon: remove double-wrapping, update addon.toml to match exports - Extract apply_python_edits from apply_backend_addon for reuse in init - Fix init to apply Python AST edits (imports + Dependencies aliases) from addon manifests - Remove genie, lakebase, serving-endpoint addons (use old Dependency API) - Add tests verifying Dependencies class gets Sql member after addon apply Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ndency base class
Replace the custom TypeScript AST (TsExpr, TsStmt, TsFunction, TsModule) and the custom Emit trait with SWC's swc_ecma_ast + swc_ecma_codegen. - Add swc_common, swc_ecma_ast, swc_ecma_codegen, swc_atoms dependencies - Create ir/builders.rs with ergonomic helpers for SWC AST construction - Rewrite codegen.rs to produce swc_ecma_ast::Module - Rewrite emitter.rs to use SWC's Emitter for code output - Slim types.rs to type-only IR (TsType, TsProp, TsTypeDef, TypeRef) - Delete emit.rs (694 lines of custom emission code) - Update 5 test assertions for SWC formatting differences All 91 openapi tests pass. Net reduction of ~300 lines of custom code, with emission correctness now guaranteed by SWC. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
emit.rsstring-based TS emitter with SWC AST-based codegen (builders.rs+codegen.rs)ts_kw!macro, eliminate string-formatted types, merge duplicate helpersChanges
ts_kw!macro, deleted 78-lineir_type_to_stringbridge, merged 3 duplicate helper pairs, addedpromise_type/data_wrapper_type/ts_omit/ts_type_paramhelpersformat!()+ts_type_ref()string hacks with proper SWC AST construction for return types, hook options, and mutation typesformat_param_access+ testnormalize_ws()for multiline SWC outputTest plan
cargo check -p apx-core— clean compilation, no warningscargo test -p apx-core openapi— all 90 tests pass🤖 Generated with Claude Code