@stylexswc/rs-compiler 0.6.3 → 0.6.4-rc.2
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 +42 -19
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
# NAPI-RS compiler for StyleX (\*\*unofficial)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
StyleX is a JavaScript library developed by Meta for defining styles optimized
|
|
4
|
+
for user interfaces. You can find the official repository
|
|
5
|
+
[here](https://www.github.com/facebook/stylex).
|
|
5
6
|
|
|
6
7
|
> [!WARNING]
|
|
7
8
|
> This is an unofficial style compiler for StyleX.
|
|
8
9
|
|
|
9
10
|
## Overview
|
|
10
11
|
|
|
11
|
-
This package provides an unofficial, high-performance compiler for StyleX, a
|
|
12
|
+
This package provides an unofficial, high-performance compiler for StyleX, a
|
|
13
|
+
popular library from Meta for building optimized user interfaces. It leverages
|
|
14
|
+
the power of NAPI-RS and SWC to achieve several key advantages:
|
|
12
15
|
|
|
13
16
|
> [!IMPORTANT]
|
|
14
|
-
> The usage of StyleX does not change.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- Seamless Integration: This compiler seamlessly integrates with Next.js's
|
|
19
|
-
|
|
20
|
-
-
|
|
17
|
+
> The usage of StyleX does not change. All changes are internal.
|
|
18
|
+
|
|
19
|
+
- Faster Build Times: By utilizing SWC instead of Babel, you can potentially
|
|
20
|
+
experience significant speed improvements during StyleX processing.
|
|
21
|
+
- Seamless Integration: This compiler seamlessly integrates with Next.js's
|
|
22
|
+
default SWC Compiler, ensuring a smooth workflow.
|
|
23
|
+
- Drop-in Replacement: Designed to be a drop-in replacement for the official
|
|
24
|
+
StyleX Babel plugin, minimizing disruption to existing codebases.
|
|
25
|
+
- Advanced Tooling Capabilities: NAPI-RS compiler unlocks access to StyleX
|
|
26
|
+
metadata and source maps, enabling the creation of advanced plugins and tools
|
|
27
|
+
for StyleX, ex. for creating a plugin for Webpack, Rollup, or other tools.
|
|
21
28
|
|
|
22
29
|
## Advantages of a `NAPI-RS` compiler versus a `SWC plugin`
|
|
23
30
|
|
|
24
|
-
- Compability with SWC: under the hood, the NAPI-RS compiler uses SWC for
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
31
|
+
- Compability with SWC: under the hood, the NAPI-RS compiler uses SWC for
|
|
32
|
+
parsing and transforming JavaScript code, ensuring compatibility with the
|
|
33
|
+
latest ECMAScript features.
|
|
34
|
+
- Direct Access to Node.js APIs: NAPI-RS allows you to directly access Node.js
|
|
35
|
+
APIs from your Rust code, providing greater flexibility and control.
|
|
36
|
+
- Improved Performance: NAPI-RS can often offer better performance than
|
|
37
|
+
traditional Node.js addons, especially for computationally intensive tasks.
|
|
38
|
+
- Simplified Development: NAPI-RS simplifies the process of developing Node.js
|
|
39
|
+
addons in Rust, making it easier to create high-performance and efficient
|
|
40
|
+
tools.
|
|
28
41
|
|
|
29
42
|
## Installation
|
|
30
43
|
|
|
@@ -36,21 +49,27 @@ npm install --save-dev @stylexswc/rs-compiler
|
|
|
36
49
|
|
|
37
50
|
### Transformation Process
|
|
38
51
|
|
|
39
|
-
Internally, this compiler takes your StyleX code and transforms it into a format
|
|
52
|
+
Internally, this compiler takes your StyleX code and transforms it into a format
|
|
53
|
+
optimized for further processing.
|
|
40
54
|
|
|
41
55
|
```ts
|
|
42
|
-
var { transform } = require('@stylexswc/compiler-rs')
|
|
56
|
+
var { transform } = require('@stylexswc/compiler-rs');
|
|
43
57
|
|
|
44
58
|
/// ...other logic
|
|
45
59
|
|
|
46
|
-
const { code, metadata, sourcemap } = transform(
|
|
60
|
+
const { code, metadata, sourcemap } = transform(
|
|
61
|
+
filename,
|
|
62
|
+
inputSourceCode,
|
|
63
|
+
transformOptions
|
|
64
|
+
);
|
|
47
65
|
|
|
48
66
|
/// ...other logic
|
|
49
67
|
```
|
|
50
68
|
|
|
51
69
|
### Output
|
|
52
70
|
|
|
53
|
-
The output from the compiler includes the transformed code, metadata about the
|
|
71
|
+
The output from the compiler includes the transformed code, metadata about the
|
|
72
|
+
generated styles, and an optional source map.
|
|
54
73
|
|
|
55
74
|
```json
|
|
56
75
|
{
|
|
@@ -112,7 +131,11 @@ const styleProps = {
|
|
|
112
131
|
## Compatibility
|
|
113
132
|
|
|
114
133
|
> [!IMPORTANT]
|
|
115
|
-
> The current resolution of the `exports` field from
|
|
134
|
+
> The current resolution of the `exports` field from
|
|
135
|
+
> `package. json` is only partially supported, so if you encounter problems,
|
|
136
|
+
> please open an
|
|
137
|
+
> [issue](https://github.com/Dwlad90/stylex-swc-plugin/issues/new) with an
|
|
138
|
+
> attached link to reproduce the problem.
|
|
116
139
|
|
|
117
140
|
## License
|
|
118
141
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexswc/rs-compiler",
|
|
3
3
|
"description": "NAPI-RS compiler for transform StyleX code",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.4-rc.2",
|
|
5
5
|
"ava": {
|
|
6
6
|
"extensions": {
|
|
7
7
|
"ts": "module"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@napi-rs/cli": "^2.18.4",
|
|
26
26
|
"@stylexjs/open-props": "^0.10.1",
|
|
27
27
|
"@stylexjs/stylex": "^0.10.1",
|
|
28
|
-
"@stylexswc/shared": "0.6.
|
|
28
|
+
"@stylexswc/shared": "0.6.4-rc.2",
|
|
29
29
|
"@swc-node/register": "^1.10.6",
|
|
30
30
|
"@swc/core": "^1.6.13",
|
|
31
31
|
"@taplo/cli": "^0.7.0",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
},
|
|
81
81
|
"repository": "https://github.com/Dwlad90/stylex-swc-plugin",
|
|
82
82
|
"optionalDependencies": {
|
|
83
|
-
"@stylexswc/rs-compiler-win32-x64-msvc": "0.6.
|
|
84
|
-
"@stylexswc/rs-compiler-darwin-x64": "0.6.
|
|
85
|
-
"@stylexswc/rs-compiler-linux-x64-gnu": "0.6.
|
|
86
|
-
"@stylexswc/rs-compiler-darwin-arm64": "0.6.
|
|
87
|
-
"@stylexswc/rs-compiler-linux-arm64-gnu": "0.6.
|
|
88
|
-
"@stylexswc/rs-compiler-linux-x64-musl": "0.6.
|
|
83
|
+
"@stylexswc/rs-compiler-win32-x64-msvc": "0.6.4-rc.2",
|
|
84
|
+
"@stylexswc/rs-compiler-darwin-x64": "0.6.4-rc.2",
|
|
85
|
+
"@stylexswc/rs-compiler-linux-x64-gnu": "0.6.4-rc.2",
|
|
86
|
+
"@stylexswc/rs-compiler-darwin-arm64": "0.6.4-rc.2",
|
|
87
|
+
"@stylexswc/rs-compiler-linux-arm64-gnu": "0.6.4-rc.2",
|
|
88
|
+
"@stylexswc/rs-compiler-linux-x64-musl": "0.6.4-rc.2"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
91
|
"artifacts": "napi artifacts",
|