pub fn transform_sync(
_env: Env,
code: String,
filepath: String,
) -> Result<TransformResult>Expand description
Synchronously transforms TypeScript code through the macro expansion system.
This is similar to expand_sync but returns a TransformResult which
includes source map information (when available).
§Arguments
_env- NAPI environment (unused but required by NAPI)code- The TypeScript source code to transformfilepath- The file path (used for TSX detection)
§Returns
A TransformResult containing the transformed code and metadata.
§Errors
Returns an error if:
- Thread spawning fails
- The worker thread panics
- Macro expansion fails
§Thread Safety
Uses a 32MB thread stack to prevent stack overflow during deep AST recursion.