@soda-gql/swc-transformer 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @soda-gql/swc-transformer
2
+
3
+ High-performance native transformer for soda-gql using SWC and Rust. This package provides the fastest transformation option for large codebases.
4
+
5
+ ## Features
6
+
7
+ - **Native performance** - Rust-based NAPI module for maximum speed
8
+ - **Source map chaining** - Merges with upstream source maps
9
+ - **Per-file artifact filtering** - Minimizes serialization overhead
10
+ - **Cross-platform support** - macOS, Linux, and Windows binaries
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @soda-gql/swc-transformer
16
+ # or
17
+ bun add @soda-gql/swc-transformer
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ This package is typically used through higher-level plugins:
23
+
24
+ - `@soda-gql/webpack-plugin` - Uses SWC transformer when available
25
+ - Direct usage in custom build pipelines
26
+
27
+ ### Direct Usage
28
+
29
+ ```typescript
30
+ import { createTransformer } from "@soda-gql/swc-transformer";
31
+
32
+ // createTransformer is async (loads native module)
33
+ const transformer = await createTransformer({
34
+ artifact: builderArtifact,
35
+ config: resolvedConfig,
36
+ sourceMap: true, // optional
37
+ });
38
+
39
+ // transform is synchronous after initialization
40
+ const result = transformer.transform({
41
+ sourceCode: source,
42
+ sourcePath: "/path/to/file.ts",
43
+ inputSourceMap: existingSourceMap, // optional
44
+ });
45
+
46
+ if (result.transformed) {
47
+ const { sourceCode, sourceMap, errors } = result;
48
+ // Use transformed code and source map
49
+ }
50
+ ```
51
+
52
+ ## Platform Support
53
+
54
+ The following platforms are supported with pre-built binaries:
55
+
56
+ | Platform | Architecture | Package |
57
+ |----------|--------------|---------|
58
+ | macOS | ARM64 | `@soda-gql/swc-transformer-darwin-arm64` |
59
+ | macOS | x64 | `@soda-gql/swc-transformer-darwin-x64` |
60
+ | Linux | x64 (glibc) | `@soda-gql/swc-transformer-linux-x64-gnu` |
61
+ | Linux | x64 (musl) | `@soda-gql/swc-transformer-linux-x64-musl` |
62
+ | Windows | x64 | `@soda-gql/swc-transformer-win32-x64-msvc` |
63
+
64
+ Platform-specific packages are installed automatically as optional dependencies.
65
+
66
+ ## Requirements
67
+
68
+ - Node.js >= 18
69
+ - `@swc/core` >= 1.0.0 (peer dependency)
70
+
71
+ ## Related Packages
72
+
73
+ - [@soda-gql/babel-transformer](../babel-transformer) - Babel-based alternative
74
+ - [@soda-gql/webpack-plugin](../webpack-plugin) - Webpack integration
75
+ - [@soda-gql/builder](../builder) - Static analysis and artifact generation
76
+
77
+ ## License
78
+
79
+ MIT