hadars 0.4.2-rc.0 → 1.0.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 +53 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,30 +21,30 @@ Bring your own router (or none), keep your components as plain React, and get SS
|
|
|
21
21
|
## Benchmarks
|
|
22
22
|
|
|
23
23
|
<!-- BENCHMARK_START -->
|
|
24
|
-
> Last run: 2026-04-
|
|
25
|
-
> hadars is **9.
|
|
24
|
+
> Last run: 2026-04-17 · 120s · 100 connections · Bun runtime
|
|
25
|
+
> hadars is **9.5x faster** in requests/sec
|
|
26
26
|
|
|
27
27
|
**Throughput** (autocannon, 120s)
|
|
28
28
|
|
|
29
29
|
| Metric | hadars | Next.js |
|
|
30
30
|
|---|---:|---:|
|
|
31
|
-
| Requests/sec | **
|
|
32
|
-
| Latency median | **
|
|
33
|
-
| Latency p99 | **
|
|
34
|
-
| Throughput | **
|
|
35
|
-
| Peak RSS |
|
|
36
|
-
| Avg RSS |
|
|
37
|
-
| Build time |
|
|
31
|
+
| Requests/sec | **218** | 23 |
|
|
32
|
+
| Latency median | **446 ms** | 2421 ms |
|
|
33
|
+
| Latency p99 | **838 ms** | 3244 ms |
|
|
34
|
+
| Throughput | **62.07** MB/s | 12.6 MB/s |
|
|
35
|
+
| Peak RSS | 1032.7 MB | **514.0 MB** |
|
|
36
|
+
| Avg RSS | 842.2 MB | **462.8 MB** |
|
|
37
|
+
| Build time | 1.1 s | 5.3 s |
|
|
38
38
|
|
|
39
39
|
**Page load** (Playwright · Chromium headless · median)
|
|
40
40
|
|
|
41
41
|
| Metric | hadars | Next.js |
|
|
42
42
|
|---|---:|---:|
|
|
43
|
-
| TTFB | **
|
|
44
|
-
| FCP | **
|
|
45
|
-
| DOMContentLoaded | **
|
|
46
|
-
| Load | **
|
|
47
|
-
| Peak RSS |
|
|
43
|
+
| TTFB | **15 ms** | 33 ms |
|
|
44
|
+
| FCP | **76 ms** | 112 ms |
|
|
45
|
+
| DOMContentLoaded | **31 ms** | 101 ms |
|
|
46
|
+
| Load | **96 ms** | 139 ms |
|
|
47
|
+
| Peak RSS | 508.0 MB | **299.5 MB** |
|
|
48
48
|
<!-- BENCHMARK_END -->
|
|
49
49
|
|
|
50
50
|
## Quick start
|
|
@@ -240,6 +240,45 @@ const config: HadarsOptions = {
|
|
|
240
240
|
export default config;
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
+
### swcPlugins example
|
|
244
|
+
|
|
245
|
+
SWC plugins let you apply compiler transforms (Relay, emotion, styled-components, etc.) to every file in both the client and SSR bundles.
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
import type { HadarsOptions } from 'hadars';
|
|
249
|
+
|
|
250
|
+
const config: HadarsOptions = {
|
|
251
|
+
entry: 'src/App.tsx',
|
|
252
|
+
swcPlugins: [
|
|
253
|
+
['@swc/plugin-relay', { rootDir: process.cwd(), artifactDirectory: 'src/__generated__' }],
|
|
254
|
+
],
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export default config;
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Plugin version compatibility** — SWC plugins are compiled against a specific version of `swc_core` and will silently fail or crash if the version doesn't match rspack's internal SWC. For `@rspack/core@1.6.8` the compatible plugins are:
|
|
261
|
+
|
|
262
|
+
| Plugin | Version |
|
|
263
|
+
|---|---|
|
|
264
|
+
| `@swc/plugin-relay` | `10.0.0` |
|
|
265
|
+
| `@swc/plugin-emotion` | `12.0.0` |
|
|
266
|
+
| `@swc/plugin-styled-components` | `10.0.0` |
|
|
267
|
+
| `@swc/plugin-styled-jsx` | `11.0.0` |
|
|
268
|
+
| `@swc/plugin-jest` | `10.0.0` |
|
|
269
|
+
| `@swc/plugin-formatjs` | `7.0.0` |
|
|
270
|
+
| `@swc/plugin-transform-imports` | `10.0.0` |
|
|
271
|
+
| `@swc/plugin-loadable-components` | `9.0.0` |
|
|
272
|
+
| `@swc/plugin-prefresh` | `10.0.0` |
|
|
273
|
+
| `swc-plugin-css-modules` | `6.0.0` |
|
|
274
|
+
| `swc-plugin-pre-paths` | `6.0.0` |
|
|
275
|
+
| `swc-plugin-transform-remove-imports` | `7.0.0` |
|
|
276
|
+
| `@lingui/swc-plugin` | `5.9.0` |
|
|
277
|
+
|
|
278
|
+
Install the exact version listed — do **not** use `latest` or a semver range. The full compatibility matrix for other rspack versions is at [plugins.swc.rs](https://plugins.swc.rs).
|
|
279
|
+
|
|
280
|
+
> The `@swc/core` package in hadars's `optionalDependencies` is used only by the hadars loader for its own AST transforms. It is a separate concern from the SWC version bundled inside rspack that runs your plugins.
|
|
281
|
+
|
|
243
282
|
### Error monitoring example
|
|
244
283
|
|
|
245
284
|
```ts
|