swc-plugin-react-compiler 0.0.0 → 0.1.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 CHANGED
@@ -1,20 +1,11 @@
1
1
  # swc-plugin-react-compiler
2
2
 
3
- SWC Wasm plugin that runs the Rust port of React Compiler through SWC.
3
+ SWC plugin that runs the Rust port of React Compiler through SWC.
4
4
 
5
5
  ![Preview](./preview.png)
6
6
 
7
- ## Important Notice
8
-
9
- This is **not** an official React plugin.
10
-
11
- This package builds a SWC Wasm plugin around the Rust React Compiler work that is
12
- currently being developed in the React repository. It is experimental, tracks
13
- internal compiler APIs, and may break as the upstream Rust port changes.
14
-
15
- Use it when you want to try the Rust React Compiler path with SWC today. Do not
16
- treat it as a production-supported replacement for an official React Compiler
17
- integration.
7
+ > [!NOTE]
8
+ > This is an unofficial plugin built to use the Rust port of React Compiler with SWC before an official SWC integration is available.
18
9
 
19
10
  ## Install
20
11
 
@@ -32,19 +23,9 @@ pnpm add -D swc-plugin-react-compiler
32
23
  yarn add -D swc-plugin-react-compiler
33
24
  ```
34
25
 
35
- For Vite React apps using SWC, also install `@vitejs/plugin-react-swc` if it is
36
- not already present.
37
-
38
- ```sh
39
- npm install -D @vitejs/plugin-react-swc
40
- pnpm add -D @vitejs/plugin-react-swc
41
- yarn add -D @vitejs/plugin-react-swc
42
- ```
43
-
44
26
  ## Vite Usage
45
27
 
46
- The package exports the absolute path to the compiled Wasm plugin. Pass that
47
- path to `@vitejs/plugin-react-swc`.
28
+ The package exports the absolute path to the compiled Wasm plugin. Pass that path to `@vitejs/plugin-react-swc`.
48
29
 
49
30
  ```ts
50
31
  // vite.config.ts
@@ -61,10 +42,9 @@ export default defineConfig({
61
42
  });
62
43
  ```
63
44
 
64
- The options object is forwarded to the React Compiler plugin options. For quick
65
- experiments, `compilationMode: 'all'` makes the transform easier to verify.
45
+ The options object is forwarded to the React Compiler plugin options. For quick experiments, `compilationMode: 'all'` makes the transform easier to verify.
66
46
 
67
- ## Direct SWC Usage
47
+ ## SWC Usage
68
48
 
69
49
  You can also pass the exported Wasm path directly to `@swc/core`.
70
50
 
@@ -89,35 +69,9 @@ const result = await transform(source, {
89
69
  console.log(result.code);
90
70
  ```
91
71
 
92
- ## Current Constraints
93
-
94
- - This package is experimental and unofficial.
95
- - The Rust implementation is pulled from the React repository and wrapped as a
96
- SWC Wasm plugin.
97
- - The SWC plugin is built against the SWC versions required by the upstream
98
- `react_compiler_swc` crate.
99
- - The transform expects SWC plugin metadata to provide the original source text.
100
- If source text cannot be read from the source map, the plugin leaves the module
101
- unchanged.
102
- - Transformed output may import `react/compiler-runtime`, so the consuming app
103
- must use a React version that provides that runtime entry.
104
-
105
- ## Repository Layout
106
-
107
- ```text
108
- .
109
- ├── crates/swc-plugin-react-compiler/ # Rust SWC Wasm plugin
110
- ├── src/ # JS package entry that exports the Wasm path
111
- ├── example/ # Vite TODO app using the plugin
112
- ├── Cargo.toml # Rust workspace
113
- ├── package.json # JS workspace
114
- ├── justfile # Development tasks
115
- └── mise.toml # Tool versions
116
- ```
117
-
118
72
  ## Development
119
73
 
120
- This repository uses `mise` for local tool versions and Yarn 4 with PnP.
74
+ This repository uses `mise`.
121
75
 
122
76
  Install the configured tools:
123
77
 
@@ -131,34 +85,28 @@ Set up the workspace:
131
85
  mise exec -- just setup
132
86
  ```
133
87
 
134
- Build the Wasm plugin:
88
+ Build the plugin:
135
89
 
136
90
  ```sh
137
91
  npm run build
138
92
  ```
139
93
 
140
- Run all checks:
141
-
142
- ```sh
143
- npm run check
144
- ```
145
-
146
94
  Run tests:
147
95
 
148
96
  ```sh
149
97
  npm run test
150
98
  ```
151
99
 
152
- Build the Vite example:
100
+ Run all checks:
153
101
 
154
102
  ```sh
155
- npm run example
103
+ npm run check
156
104
  ```
157
105
 
158
106
  Run the Vite example in development mode:
159
107
 
160
108
  ```sh
161
- mise exec -- just example-dev
109
+ mise exec -- just example
162
110
  ```
163
111
 
164
112
  The dev server serves the TODO example at `http://127.0.0.1:5173/`.
@@ -169,13 +117,12 @@ The `justfile` defines the main development tasks:
169
117
 
170
118
  ```sh
171
119
  just build # Build the Wasm plugin and copy it to the package root
172
- just check # cargo check, TypeScript, oxlint, and oxfmt
173
- just test # Rust tests
174
- just example # Build the Vite TODO example
175
- just example-dev # Run the Vite TODO example locally
120
+ just check # cargo check, typecheck, oxlint, and oxfmt
176
121
  just format # Apply oxfmt
122
+ just test # Rust tests
123
+ just example # Run the Vite TODO example locally
177
124
  ```
178
125
 
179
126
  ## License
180
127
 
181
- MIT. See [LICENSE](./LICENSE).
128
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "name": "swc-plugin-react-compiler",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
+ "description": "SWC plugin for the Rust React Compiler port",
5
+ "homepage": "https://github.com/leegeunhyeok/swc-plugin-react-compiler#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/leegeunhyeok/swc-plugin-react-compiler/issues"
8
+ },
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/leegeunhyeok/swc-plugin-react-compiler.git"
13
+ },
4
14
  "workspaces": [
5
15
  "example"
6
16
  ],
@@ -20,6 +30,10 @@
20
30
  },
21
31
  "./package.json": "./package.json"
22
32
  },
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "provenance": true
36
+ },
23
37
  "scripts": {
24
38
  "build": "mise exec -- just build",
25
39
  "check": "mise exec -- just check",
Binary file