@weapp-tailwindcss/react-native 0.2.0 → 0.2.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 +24 -5
- package/README.zh-CN.md +47 -0
- package/dist/babel.cjs +1 -1
- package/dist/babel.d.ts +1 -1
- package/dist/compiler.cjs +1 -1
- package/dist/metro-transformer.cjs +1 -1
- package/dist/metro.cjs +1 -1
- package/dist/{rolldown-runtime-D6vf50IK.cjs → rolldown-runtime-VH7oDXx4.cjs} +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# @weapp-tailwindcss/react-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> English | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A Tailwind CSS v4 compiler for React Native and Expo. It reuses source scanning and candidate generation from `weapp-tailwindcss`, then compiles CSS into a serializable React Native style manifest without adding NativeWind or a `react-native-css` runtime.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
pnpm add @weapp-tailwindcss/react-native tailwindcss
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
## Expo and Metro
|
|
14
|
+
|
|
11
15
|
```js
|
|
12
16
|
// metro.config.js
|
|
13
17
|
const { getDefaultConfig } = require('expo/metro-config')
|
|
@@ -21,8 +25,23 @@ module.exports = withWeappTailwindcss(config, {
|
|
|
21
25
|
})
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
Metro scans sources, builds the exact candidate set and manifest, and connects the Babel JSX transform to the existing Expo transformer. You do not need to maintain a second `classNameSet`.
|
|
29
|
+
|
|
30
|
+
## Runtime model
|
|
31
|
+
|
|
32
|
+
- Static `className` values compile to pre-generated StyleSheet lookups without calling `tw()` during render.
|
|
33
|
+
- Dynamic class values are resolved through `tw(value)` at runtime.
|
|
34
|
+
- Regular inline `style` overrides Tailwind classes, while `!important` classes override inline styles.
|
|
35
|
+
- Unsupported CSS declarations are recorded in manifest `warnings` instead of producing incorrect native styles silently.
|
|
36
|
+
|
|
37
|
+
## Public entry points
|
|
38
|
+
|
|
39
|
+
The package exposes `compiler`, `tailwind`, `babel`, `metro`, `runtime`, and the platform-neutral `env` type entry. Custom Metro setups can compose these entry points directly.
|
|
40
|
+
|
|
41
|
+
## Scope
|
|
42
|
+
|
|
43
|
+
This package generates React Native style manifests. It does not emit Web CSS or mini-program WXSS and does not add NativeWind or a browser CSS runtime to the application.
|
|
25
44
|
|
|
26
|
-
|
|
45
|
+
## Documentation
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
See the [React Native and Expo guide](https://tw.icebreaker.top/docs/quick-start/react-native-expo) for the complete setup.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @weapp-tailwindcss/react-native
|
|
2
|
+
|
|
3
|
+
> [English](./README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
面向 React Native 与 Expo 的 Tailwind CSS v4 编译器。它复用 `weapp-tailwindcss` 的源码扫描与候选生成,将 CSS 编译为可序列化的 React Native style manifest,不引入 NativeWind 或 `react-native-css` 运行时。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @weapp-tailwindcss/react-native tailwindcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Expo 与 Metro
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
// metro.config.js
|
|
17
|
+
const { getDefaultConfig } = require('expo/metro-config')
|
|
18
|
+
const { withWeappTailwindcss } = require('@weapp-tailwindcss/react-native/metro')
|
|
19
|
+
|
|
20
|
+
const config = getDefaultConfig(__dirname)
|
|
21
|
+
|
|
22
|
+
module.exports = withWeappTailwindcss(config, {
|
|
23
|
+
input: './global.css',
|
|
24
|
+
sourceGlobs: ['./src/**/*.{js,jsx,ts,tsx}'],
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Metro 会扫描源码、生成精确候选集合和 manifest,并把 Babel JSX transform 接入现有 Expo transformer。无需维护第二份 `classNameSet`。
|
|
29
|
+
|
|
30
|
+
## 运行模型
|
|
31
|
+
|
|
32
|
+
- 静态 `className` 编译为预生成的 StyleSheet lookup,不在 render 中调用 `tw()`。
|
|
33
|
+
- 动态 class 才通过 `tw(value)` 在运行时解析。
|
|
34
|
+
- 普通 inline `style` 覆盖 Tailwind class,`!important` class 覆盖 inline style。
|
|
35
|
+
- 不支持的 CSS 声明会记录在 manifest `warnings` 中,不会静默生成错误样式。
|
|
36
|
+
|
|
37
|
+
## 公开入口
|
|
38
|
+
|
|
39
|
+
包提供 `compiler`、`tailwind`、`babel`、`metro`、`runtime` 与中性类型入口 `env`。非 Expo 或定制 Metro 场景可以显式组合这些入口。
|
|
40
|
+
|
|
41
|
+
## 边界
|
|
42
|
+
|
|
43
|
+
本包生成 React Native 样式清单,不输出 Web CSS 或小程序 WXSS,也不把 NativeWind 或浏览器 CSS 运行时引入应用。
|
|
44
|
+
|
|
45
|
+
## 文档
|
|
46
|
+
|
|
47
|
+
完整接入说明见 [React Native / Expo 指南](https://tw.icebreaker.top/zh-cn/docs/quick-start/react-native-expo)。
|
package/dist/babel.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
2
2
|
let _babel_types = require("@babel/types");
|
|
3
3
|
_babel_types = require_rolldown_runtime.__toESM(_babel_types, 1);
|
|
4
4
|
//#region src/babel.ts
|
package/dist/babel.d.ts
CHANGED
package/dist/compiler.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
3
|
let postcss = require("postcss");
|
|
4
4
|
postcss = require_rolldown_runtime.__toESM(postcss, 1);
|
|
5
5
|
//#region src/compiler.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
3
|
const require_babel = require("./babel.cjs");
|
|
4
4
|
const require_metro = require("./metro.cjs");
|
|
5
5
|
let node_fs = require("node:fs");
|
package/dist/metro.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
3
|
const require_compiler = require("./compiler.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
@@ -15,7 +15,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/react-native",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"description": "Tailwind CSS
|
|
4
|
+
"version": "0.2.2",
|
|
5
|
+
"description": "Tailwind CSS compiler and Expo Metro integration for cross-platform React Native apps. 面向跨端 React Native 应用的 Tailwind CSS 编译器与 Expo Metro 集成。",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -91,11 +91,13 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@babel/types": "^8.0.4",
|
|
94
|
-
"postcss": "^8.5.
|
|
95
|
-
"weapp-tailwindcss": "^5.
|
|
94
|
+
"postcss": "^8.5.26",
|
|
95
|
+
"weapp-tailwindcss": "^5.3.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@babel/core": "^8.0.1",
|
|
99
|
+
"@types/react": "^19.2.18",
|
|
100
|
+
"react": "^19.2.8",
|
|
99
101
|
"vitest": "^4.1.0"
|
|
100
102
|
},
|
|
101
103
|
"scripts": {
|