Skip to content

docs: Add comprehensive KDoc comments and fix documentation issues - #8

Merged
yidafu merged 103 commits into
masterfrom
docs/add-comment
Nov 19, 2025
Merged

docs: Add comprehensive KDoc comments and fix documentation issues#8
yidafu merged 103 commits into
masterfrom
docs/add-comment

Conversation

@yidafu

@yidafu yidafu commented Nov 19, 2025

Copy link
Copy Markdown
Owner

Description

This PR adds comprehensive KDoc comments to the swc-binding module to enable API documentation generation with tools like Dokka, and fixes various typos and formatting issues in the implementation guide documentation.

Type of Change

  • 📚 Documentation update

Related Issues

N/A

Changes Made

KDoc Comments for API Documentation

  • SwcNative class: Enhanced documentation for all async methods including:

    • Native methods with detailed explanations of their low-level nature
    • Callback-based methods with Kotlin and Java usage examples
    • Suspend functions with coroutine integration details
    • All methods now include parameter descriptions, return value documentation, usage examples, and cross-references
  • customType.kt: Added comprehensive documentation for:

    • Identifier interface and implementation
    • BindingIdentifier interface
    • TemplateLiteral and TsTemplateLiteralType interfaces
    • Implementation classes with property documentation
  • json.kt: Improved documentation for JSON serializers:

    • astJson: AST serialization configuration details
    • configJson: Configuration object serialization details
    • outputJson: TransformOutput deserialization details
    • All serializers now include usage scenarios and configuration explanations

Documentation Fixes

  • Fixed typo: "pase_sync" -> "parse_sync"
  • Fixed typo: "Jupiter Kennel" -> "Jupyter Kernel"
  • Fixed typo: "NMP" -> "NPM"
  • Fixed Chinese typos: "申明" -> "声明", "装换" -> "转换"
  • Fixed JSON syntax error in code example (removed semicolon)
  • Fixed code example: "const" -> "val" in Kotlin
  • Improved punctuation and formatting consistency
  • Fixed broken code block closing tags
  • Improved section heading formatting

Module(s) Affected

  • swc-binding
  • Documentation

Testing

  • Manual testing performed

Test Steps:

  1. Verified all KDoc comments follow Kotlin KDoc standards
  2. Checked that documentation examples are syntactically correct
  3. Confirmed all cross-references (@see) are valid
  4. Verified Markdown formatting is correct

Benefits

  1. API Documentation Generation: Comprehensive KDoc comments enable automatic API documentation generation with tools like Dokka
  2. Better Developer Experience: Detailed comments with examples help developers understand how to use the API
  3. Improved Code Quality: Well-documented code is easier to maintain and extend
  4. Documentation Accuracy: Fixed typos and formatting issues improve readability

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • Documentation examples are syntactically correct
  • All KDoc comments follow Kotlin KDoc standards

Additional Notes

  • All KDoc comments include usage examples for both Kotlin and Java
  • Comments follow Kotlin KDoc standards and can be processed by Dokka
  • Documentation fixes apply to both English and Chinese versions of the implementation guide
  • No functional changes, only documentation improvements

…union coverage

- Add PipelineE2ETest to validate end-to-end transform pipeline
- Add SwcNativeAsyncFileSuccessTest for async file-path success flows
- Add OptionsUnionAdditionalTest to cover union option edge cases
- Update AsyncParseTest, ErrorHandlingTest, OptionsBuilderTest, SwcNativeTest, UnionTest, types/OptionsTest
  to align with recent behavior/typing changes

Chore: keep docs/scripts/config in sync with tests where applicable
refactor(swc-jni): extract sync work functions and improve error handling

Refactor swc-jni module's synchronous functions by extracting helper functions and improving error handling:

## Main Changes

- **Extract Helper Functions**:
  - `minify.rs`: Extract `perform_minify_sync_work` function
  - `parse.rs`: Extract `perform_parse_sync_work` and `perform_parse_file_sync_work` functions
  - `print.rs`: Extract `perform_print_sync_work` function
  - `transform.rs`: Extract `perform_transform_sync_work` and `perform_transform_file_sync_work` functions

- **Improve Error Handling**:
  - Replace `unwrap()` with `?` operator for error propagation
  - Unify return types to `SwcResult<T>`
  - Improve error context information (using `context()` and `convert_err()`)

- **Code Structure Optimization**:
  - Separate business logic from JNI binding functions
  - Improve code testability and maintainability
  - Unify code style and error handling patterns

- **Configuration File Rename**:
  - Rename `swc-jni/.cargo/config` to `swc-jni/.cargo/config.toml`

## Statistics

- 5 files changed
- +90 insertions, -52 deletions
- Net +38 lines

This refactoring improves code maintainability and error handling consistency, laying the foundation for future async function refactoring.
…ework union serializers and interfaces

- Remove ImplementationStage and stop generating *Impl classes entirely
- Generate leaf interfaces as final classes; each class now in its own file
- Rework SerializerGenerator:
  - Drop UnionFactory and caching; delegate via Union.Ux.serializerFor(...)
  - Wrap array unions with ArraySerializer(...)
  - Allow empty serializers modules when no polymorphic groups
- Update KotlinPoetConverter:
  - Ensure HasSpan classes define override span with default emptySpan()
  - Fill in abstract parent props on classes (override, nullable, default null)
  - Switch @serializable(with=...) wiring for union usages and ensure usage collection
- DslFileEmitter now constructs DSL builders for concrete class names (no *Impl)
- TypesFileLayout adds dedicated files for classes in addition to interfaces
- InterfaceStage emits all interfaces (including leaves) with inheritance order
- ConfigurationLoader normalizes relative paths based on config file location
- Adjust tests to new behavior (no *Impl, no UnionFactory, relaxed assertions)

BREAKING CHANGE: *Impl classes and UnionFactory are removed; consumers should rely on generated concrete classes and Union.Ux.serializerFor(...)
…e opt-in

- SerializerGenerator: delegate unions via Union.Ux.serializerFor(...); allow empty SerializersModule when groups absent
- KotlinPoetConverter: ensure correct @serializable(with=...) wiring and usage collection
- Tests: add SerializerModuleOptInTest to validate opt-in and module presence
- Update SwcNative with expanded API and better handling (115++/57--)
- Tweak DSL helpers and JSON utilities; refresh samples
- Split DslTest into focused suites and increase coverage
- Add new tests: ErrorBoundaryTest, MinifyBehaviorTest, ParsePrintIntegrationTest, UnionSerializationRoundTripTest
- Update existing tests for async ops, parser config, options builder, and AST assertions
- Enhance SwcNative API and handling
- Refine DSL helpers and JSON utilities; update samples
- Split and reorganize DslTest; add focused suites
- Add tests: ErrorBoundaryTest, MinifyBehaviorTest, ParsePrintIntegrationTest, UnionSerializationRoundTripTest
- Update async, parser config, options builder, and AST assertions
…ection

- Add type alias expansion in InheritanceAnalyzer to recursively expand
  union type aliases (e.g., Expression, Pattern) into their member types
- Implement lowest common ancestor (LCA) detection for finding shared
  parent interfaces among multiple types
- Optimize union type conversion by using expanded types and LCA to
  replace Union.Ux with more specific parent interfaces
- Add automatic ctxt field injection for classes matching Rust structs
  with independent SyntaxContext fields (BlockStatement, CallExpression,
  NewExpression, ArrowFunctionExpression, TaggedTemplateExpression,
  FunctionDeclaration, VariableDeclaration, Class, PrivateProperty,
  Constructor, Identifier)
- Add interface skip rules for ExprOrSpread and OptionalChainingCall
- Enhance serialization annotations:
  - Add @SerialName for Node-derived classes and sealed interface
    implementations to ensure polymorphic serialization compatibility
  - Add @transient for Node.type field to avoid conflict with
    JsonClassDiscriminator("type")
- Update documentation with special field handling (ctxt) explanation
- Add comprehensive tests for InheritanceAnalyzer functionality

This improves code generation quality by reducing unnecessary Union types
and ensuring better compatibility with Rust deserialization requirements.
Major refactoring to enhance code organization, maintainability, and type safety:

## Code Structure Improvements

### Split KotlinPoetConverter (1017 → 613 lines, ~40% reduction)
- Extract AnnotationConverter: handle annotation conversion logic
- Extract PropertyConverter: handle property conversion with modifiers
- Extract ClassDeclarationConverter: provide helper methods for class analysis
- Extract SerializationAnnotationHelper: handle serialization-related annotations
- Extract DataClassConverter: handle data class conversion
- Extract EnumClassConverter: handle enum class conversion
- Extract InterfaceClassConverter: handle interface/sealed interface conversion
- Extract RegularClassConverter: handle regular class conversion with complex logic
  (polymorphic annotations, property completion, span/ctxt field injection)

### Refactor Hardcoded Configuration (257 → 177 lines, ~31% reduction)
- Split nested objects into independent config classes (Kotlin code-based):
  - AnnotationConfig: annotation names and class name mapping with enum types
  - PropertyRulesConfig: property rules with enum-based reserved words
  - SerializerConfig: serializer configuration with enum policies
  - CtxtFieldsConfig: ctxt field configuration with categorized enum
  - InterfaceRulesConfig: interface conversion rules with enum mappings
  - TypeAliasRulesConfig: type alias rules configuration
  - ConverterRulesConfig: converter rules configuration
  - UnionConfig: union type configuration with validation
  - CollectionsConfig: collection type mappings
  - InterfaceHeuristicsConfig: interface heuristics configuration
- Keep Hardcoded.kt as compatibility layer with @deprecated annotations
- Use enum classes instead of string constants for better type safety
- Add configuration validation (e.g., UnionConfig.validate())

## Test Coverage

- Add KotlinPoetConverterComprehensiveTest: comprehensive tests for class, property,
  annotation, and function conversion scenarios
- Add HardcodedConfigTest: tests for all configuration rules and validations
- All existing tests pass, ensuring backward compatibility

## Benefits

- **Maintainability**: Clear separation of concerns, each converter handles one
  class type
- **Type Safety**: Enum classes replace string constants, reducing runtime errors
- **Testability**: Smaller, focused classes are easier to unit test
- **Readability**: Better code organization, easier to understand
- **Extensibility**: Easier to add new class type conversions or configuration rules
- **Backward Compatibility**: Hardcoded.kt remains as compatibility layer

## Statistics

- 29 files changed: 4981 insertions(+), 644 deletions(-)
- KotlinPoetConverter: 1017 → 613 lines (40% reduction)
- Hardcoded: 257 → 177 lines (31% reduction)
- 9 new specialized converter classes
- 9 new configuration classes
- 2 new comprehensive test files
- Remove all debug println! and eprintln! statements
- Translate all Chinese comments to English
- Simplify error handling by removing debug output
- Add serde_json_path_to_error dependency for better error reporting
- Clean up async callback error handling

This commit cleans up the codebase by removing debugging code and
improving code readability through English comments.
Major changes:
- Add multiple new test files to cover more syntax features:
  * AstNodeCoverageTest.kt: systematic testing of various AST node types
  * DSLBuildTest.kt: test DSL building functionality and round-trip transformations
  * JSXSyntaxTest.kt: comprehensive JSX/TSX syntax feature testing
  * TypeScriptSysntaxTest.kt: extended TypeScript syntax test coverage

- Significantly expand SwcNativeTest.kt (+1209 lines):
  * Add Symbol, Proxy/Reflect, Set/Map tests
  * Extend Promise, async/await, Generator function tests
  * Add module system tests (import/export)
  * Add transformation target tests (ES2015/ES2020/ES2022)
  * Add syntax downgrading tests (ES5)
  * Add minification options tests

- Fix compilation errors:
  * Fix const val issues in PropertyRulesConfig and SerializerConfig
  * Fix property name errors in DSL building (obj/prop → object/property)
  * Fix property name in TsParserConfig (jsx → tsx)
  * Fix illegal characters in function names (Promise.all → Promise all)
  * Fix AST node type mismatches

- Update documentation:
  * Add important notes about manual AST construction in README
  * Explain that boolean fields must be explicitly set to avoid serialization errors
  * Provide correct and incorrect example code

- Other improvements:
  * Add span.kt utility function
  * Update core files: SwcNative.kt, Union.kt, dsl.kt
  * Fix minor issues in multiple test files

Stats: 24 files changed, +4904 insertions, -157 deletions
…generation flexibility

Major changes:
- Remove Hardcoded.kt file and migrate configuration to appropriate config classes
  * Move serializer-related configs to SerializerConfig (interfaceToImplMap, additionalOpenBases)
  * Consolidate configuration management for better maintainability

- Enhance code generation rules and type handling:
  * Add getPropertyTypeOverride() in CodeGenerationRules for special type mappings
    (e.g., ForOfStatement.await: Span? → Boolean?)
  * Improve @SerialName conflict resolution for BindingIdentifier/Identifier and TemplateLiteral types
  * Add special handling for ComputedPropName to use literal value "Computed"
  * Remove automatic @SerialName annotation injection in KotlinPoetConverter
    (annotations should be explicitly defined in class declarations)

- Improve serializer generation:
  * Add custom type polymorphic registration support
  * Update SerializerGenerator to use SerializerConfig instead of Hardcoded
  * Enhance type filtering and polymorphic group building

- Add file writing optimizations:
  * Implement content comparison in GeneratedFileWriter to skip unchanged files
  * Add debug logging for specific file generation (ForOfStatement, ComputedPropName)
  * Normalize content comparison by ignoring header timestamps

- Update converter and emitter logic:
  * Refactor InterfaceConverter and TypeConverter for better type handling
  * Improve RegularClassConverter and SerializationAnnotationHelper
  * Update various stage processors and emitters

- Update tests to reflect configuration changes:
  * Update SerializerGeneratorTest and related test files
  * Remove HardcodedConfigTest (no longer needed)
  * Update test expectations for new configuration structure

Stats: 73 files changed, +1440 insertions, -663 deletions
…alization tests

Major changes:
- Add customType.kt with manual type definitions to resolve serialization conflicts:
  * Define Identifier and BindingIdentifier interfaces with shared IdentifierImpl implementation
  * Define TemplateLiteral and TsTemplateLiteralType interfaces with shared TemplateLiteralImpl
  * Remove type property to avoid @SerialName conflicts
  * Use typealias for BindingIdentifierImpl and TsTemplateLiteralTypeImpl

- Add comprehensive AST serialization test suite (AstSerializationTest.kt, 1026 lines):
  * Test serialization and deserialization for various AST node types
  * Test round-trip serialization (serialize -> deserialize -> serialize)
  * Test polymorphic serialization for union types
  * Cover Identifier, StringLiteral, NumberLiteral, BooleanLiteral, and other node types

- Reorganize test structure for better organization:
  * Remove deprecated async test files (AsyncMinifyTest, AsyncParseTest, AsyncPrintTest, AsyncTransformTest)
  * Remove old integration tests (ParsePrintIntegrationTest, MinifyBehaviorTest, SimpleAsyncTest)
  * Add new SwcNative* test files:
    - SwcNativeBasicTest.kt: basic functionality tests
    - SwcNativeBuiltinTest.kt: builtin feature tests
    - SwcNativeJSXSyntaxTest.kt: JSX/TSX syntax tests (renamed from JSXSyntaxTest)
    - SwcNativeJavaScriptSyntaxTest.kt: JavaScript syntax tests
    - SwcNativeMinifyTest.kt: minification tests
    - SwcNativeModuleTest.kt: module system tests
    - SwcNativeTSXSyntaxTest.kt: TSX syntax tests
    - SwcNativeTransformTest.kt: transformation tests
    - SwcNativeTypeScriptTest.kt: TypeScript syntax tests (renamed from TypeScriptSysntaxTest)
  * Move UnionSerializerTest.kt to generated/ directory

- Improve SwcNative API documentation:
  * Add comprehensive KDoc comments with usage examples
  * Document synchronous and asynchronous usage patterns
  * Add Java-friendly callback interface documentation
  * Improve method parameter documentation

- Update core files:
  * Enhance SwcNative.kt with better documentation and API improvements
  * Update Union.kt, dsl.kt, json.kt, and other core utilities
  * Update various test files to reflect new structure

Stats: 53 files changed, +5854 insertions, -5289 deletions
…terns

Major changes:
- Remove init_panic_hook function and all debug eprintln! statements:
  * Delete panic hook initialization from lib.rs
  * Remove all [Rust] prefixed debug logging from async_utils.rs, minify.rs, parse.rs, print.rs, transform.rs, and util.rs
  * Clean up error handling by removing debug output while preserving error functionality

- Add utility functions to eliminate code duplication:
  * get_java_string_or_throw(): unified helper for synchronous Java string retrieval with exception throwing
  * get_java_string_async(): unified helper for async context Java string retrieval
  * setup_async_callback(): centralized async callback setup (JVM + global reference)
  * execute_with_panic_protection(): unified panic protection wrapper for async work functions

- Refactor all JNI functions to use new utility functions:
  * printSync/printAsync: use get_java_string_or_throw and setup_async_callback
  * minifySync/minifyAsync: use new utility functions
  * parseSync/parseAsync/parseFileAsync: use new utility functions
  * transformSync/transformAsync/transformFileAsync: use new utility functions

- Improve code maintainability:
  * Reduce code duplication across all async functions (~15-20 lines per function)
  * Standardize error handling patterns
  * Improve code consistency and readability
  * Centralize common JNI operations in util.rs

- Update dependencies:
  * Update build-plugin/libs.versions.toml

Benefits:
- **Code reduction**: Eliminated ~100+ lines of duplicate code
- **Maintainability**: Error handling logic centralized, easier to modify
- **Consistency**: All functions use the same error handling patterns
- **Readability**: Cleaner code without debug noise

Stats: 7 files changed, +337 insertions, -229 deletions
… and serializers

Major changes:
- Generate AST node classes for all SWC AST types:
  * Add 200+ AST node classes in generated/ast/ package
  * Include TypeScript-specific types (Ts*), JSX types, and JavaScript core types
  * Generate config classes (Config, JscConfig, TransformConfig, etc.)
  * Add common types (Span, HasSpan, HasDecorator, etc.)

- Generate DSL builder classes:
  * Add 150+ DSL builder classes in generated/dsl/ package
  * Provide fluent API for constructing AST nodes programmatically
  * Include create.kt with factory functions for all node types

- Implement serialization infrastructure:
  * Add UnionSerializer.kt for polymorphic type serialization
  * Generate serializer.kt with comprehensive serialization support
  * Support kotlinx.serialization for JSON conversion

- Update test files:
  * Update AstNodeCoverageTest.kt, PipelineE2ETest.kt
  * Update SwcNativeBasicTest.kt, AstJsonTest.kt

Benefits:
- **Complete AST coverage**: All SWC AST node types now have Kotlin bindings
- **Type-safe DSL**: Fluent builder API for constructing AST nodes
- **Serialization ready**: Full support for JSON serialization/deserialization
- **Test coverage**: Updated tests to validate generated code

Stats: 400+ files added, 4 test files modified
…parison logic

Major changes:
- Enhance file content comparison in GeneratedFileWriter:
  * Extend normalization to ignore all comments (single-line, multi-line, KDoc)
  * Preserve string literals while removing comments for accurate comparison
  * Improve robustness of generated file change detection

- Refine polymorphic serialization discriminator logic:
  * Config-derived classes use "syntax" discriminator
  * Node-derived classes and sealed interface implementations use "type" discriminator
  * Add check for sealed interface implementation in RegularClassConverter
  * Ensure proper @SerialName annotation placement for polymorphic types

- Improve serialization annotation generation:
  * Always add @SerialName annotation (even when names match) for polymorphic serialization
  * Update CodeGenerationRules to ensure consistent serialization behavior
  * Add intermediate interfaces (ExpressionBase, Fn, PatternBase) to additionalOpenBases

- Enhance interface serialization handling:
  * Add discriminator support for interfaces in additionalOpenBases
  * Improve annotation logic for non-sealed interfaces in polymorphic serialization
  * Better handling of root interface discriminators

Benefits:
- **Better change detection**: File comparison now ignores all comments, reducing false positives
- **Correct serialization**: Proper discriminator usage ensures accurate JSON serialization/deserialization
- **Type safety**: Consistent @SerialName annotations improve polymorphic type handling
- **Maintainability**: Clearer separation between Config and Node serialization strategies

Stats: 5 files changed, 159 insertions(+), 31 deletions(-)
…ucture

- Add defaultSerializerMap configuration in SerializerConfig for polymorphic interfaces
- Introduce BaseGenerator base class to unify resource management across generators
- Refactor CodeEmitter to extract generic generateWithDryRun method eliminating code duplication
- Add DebugUtils utility class for centralized debug code management
- Update DslGenerator, SerializerGenerator, and TypesGenerator to extend BaseGenerator
- Update NameUtils with additional utility functions
- Refactor GeneratedFileWriter and related pipeline components for better maintainability
- Update comprehensive test suite to reflect generator structure changes

This change enables handling missing type discriminators in JSON by using default serializers (e.g., MethodProperty for Fn interface) during polymorphic deserialization, while improving code organization and reducing duplication.
- Add custom serializer for TruePlusMinus enum handling boolean and string values
- Update generated AST and DSL classes with serialization improvements
- Add comprehensive test suites for AST serialization, DSL building, and syntax parsing
- Split large test files into focused test classes (JSX, TypeScript, JavaScript)
- Add E2E tests for AST JSON parsing, transformation, and minification
- Add AST comparison analysis and validation utilities
…ucture

- Add defaultSerializerMap configuration in SerializerConfig for polymorphic interfaces
- Introduce BaseGenerator base class to unify resource management across generators
- Refactor CodeEmitter to extract generic generateWithDryRun method eliminating code duplication
- Add DebugUtils utility class for centralized debug code management
- Update DslGenerator, SerializerGenerator, and TypesGenerator to extend BaseGenerator
- Update NameUtils with additional utility functions
- Refactor GeneratedFileWriter and related pipeline components for better maintainability
- Update comprehensive test suite to reflect generator structure changes

This change enables handling missing type discriminators in JSON by using default serializers (e.g., MethodProperty for Fn interface) during polymorphic deserialization, while improving code organization and reducing duplication.
- Create test package dev.yidafu.swc.es.features with 11 test files
- Add ES2015FeaturesTest covering 24 ES6 features (let/const, arrow functions, classes, destructuring, etc.)
- Add ES2016FeaturesTest covering 2 ES7 features (Array.includes, exponentiation operator)
- Add ES2017FeaturesTest covering 7 ES8 features (async/await, Object.values/entries, string padding, etc.)
- Add ES2018FeaturesTest covering 3 ES9 features (async iterators, object rest/spread, Promise.finally)
- Add ES2019FeaturesTest covering 9 ES10 features (Array.flat/flatMap, Object.fromEntries, optional catch, etc.)
- Add ES2020FeaturesTest covering 9 ES11 features (BigInt, dynamic import, nullish coalescing, optional chaining, etc.)
- Add ES2021FeaturesTest covering 5 ES12 features (replaceAll, Promise.any, WeakRef, numeric separators, logical operators)
- Add ES2022FeaturesTest covering 6 ES13 features (top-level await, class fields, Array.at, error.cause, hasOwn, regex match indices)
- Add ES2023FeaturesTest covering 4 ES14 features (findLast/findLastIndex, hashbang, symbols as WeakMap keys, array copy methods)
- Add ES2024FeaturesTest covering 7 ES15 features (Object/Map.groupBy, Temporal API, well-formed unicode, Promise.withResolvers, etc.)
- Add ES2025FeaturesTest covering 7 ES16 features (Set methods, Iterator helpers, Temporal API, decorator metadata)
- Fix template literal string interpolation escaping using ${'$'} syntax for Kotlin
- Fix BigInt literal parsing by using constructor calls instead of literals
- Fix decorator metadata test by using TypeScript parser with decorators enabled
- All 111 tests passing successfully

This change adds comprehensive test coverage for ECMAScript features from ES2015 to ES2025, ensuring SWC parser correctly handles all modern JavaScript syntax features.
…ization patterns

- Add CollectionUtils utility class for unified collection initialization
- Refactor multiple files to use CollectionUtils instead of direct mutableSetOf/mutableMapOf calls
- Improve code documentation and comments across generator modules
- Remove unused code from DependencyContainer
- Update InheritanceAnalyzer, CodeEmitter, and various converters to use CollectionUtils
- Enhance CodeEmitter documentation with detailed descriptions of file generation process
- Improve KotlinPoetConverter, ClassDeclarationConverter, and RegularClassConverter implementations

This change improves code maintainability by centralizing collection initialization
patterns and reducing code duplication across the generator module.
…glish

- Standardize code indentation and formatting across serializers and AST classes
- Reorder import statements for consistency (kotlinx.serialization imports before kotlin.*)
- Translate Chinese comments to English in test utilities and comparison tools
- Remove trailing whitespace and normalize blank lines
- Update UnionSerializer and serializer.kt formatting for better readability
- Improve code consistency in customType.kt and TruePlusMinusSerializer

This change improves code maintainability and makes the codebase more accessible
to international contributors by standardizing formatting and language.
…e coverage

- Update GitHub Actions versions (checkout@v4, setup-java@v4, gradle-build-action@v3)
- Add permissions configuration for pull-requests: write access
- Configure checkout with fetch-depth: 0 for coverage diff calculation
- Scope coverage to swc-binding module only (skip swc-generator and other modules)
- Add verification step to ensure coverage report exists before posting
- Improve step names and add descriptive comments
- Update coverage report title with emoji for better visibility
- Support fallback to github.token if PR_TOKEN secret is not set

This change ensures that only swc-binding module test coverage is reported
in PR comments, making the coverage reports more focused and relevant.
Add ktlint filter configuration to exclude generated/dsl and generated/ast
directories from code formatting checks. These directories contain
auto-generated code and do not require code style checks.
- Update version badges: Kotlin 2.2.10, SWC and Rust badges with brand colors
- Add comprehensive SwcNative usage guide covering:
  * Synchronous and asynchronous methods
  * Coroutine and callback-based async patterns
  * Error handling and threading model
  * Best practices
- Add DSL usage guide with examples for:
  * Creating AST nodes (Module, VariableDeclaration, FunctionDeclaration, etc.)
  * Creating configuration objects (ParserOptions, TransformOptions)
  * Common patterns (literals, expressions)
- Enhance swc-generator README with special handling logic documentation:
  * Explicit type field handling
  * Property type overrides
  * Kotlin reserved word mapping
  * Type name overrides
  * Span property handling
  * Serialization annotations
- Fix Markdown linting issues (blank lines, list formatting)
- Update VSCode settings for Java configuration
Add comprehensive GitHub templates to improve issue and PR quality:

- Bug report template with detailed fields for reproduction, environment info, and error messages
- Feature request template with problem statement, solution proposal, and priority selection
- Documentation template for reporting docs issues and suggesting improvements
- Question template for community support
- Pull request template with checklist and structured sections
- Issue template configuration to disable blank issues and add contact links

These templates will help maintainers gather necessary information and improve
the overall quality of contributions.
Add comprehensive pull request template to standardize PR submissions:

- Structured sections for description, type of change, and related issues
- Module selection checklist (swc-binding, swc-generator, swc-jni, etc.)
- Testing checklist and test steps
- Code quality checklist (style guidelines, self-review, documentation)
- Screenshots and additional notes sections

This template will help maintainers review PRs more efficiently and ensure
contributors provide all necessary information.
…generation

Add detailed KDoc comments to swc-binding module to enable API documentation
generation with tools like Dokka. The comments include:

- SwcNative class: Enhanced documentation for all async methods including
  native methods, callback-based methods, and suspend functions with usage
  examples for both Kotlin and Java
- customType.kt: Added documentation for Identifier, BindingIdentifier,
  TemplateLiteral interfaces and their implementations
- json.kt: Improved documentation for JSON serializers (astJson, configJson,
  outputJson) with configuration details and usage scenarios

All comments follow Kotlin KDoc standards and include:
- Function descriptions
- Parameter and return value documentation
- Usage examples (Kotlin and Java)
- Cross-references to related APIs (@see)
- Important notes and best practices

This enables automatic API documentation generation and improves developer
experience when using the swc-binding library.
Fix various typos, spelling errors, and formatting issues...
@yidafu
yidafu merged commit faca1c0 into master Nov 19, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant