@kbach/react 0.6.49 → 0.6.50
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/KBACH.md +1044 -0
- package/README.md +79 -3
- package/dist/core/index.d.ts +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/native.d.ts +314 -0
- package/dist/native.js +99 -0
- package/kbach-react.md +27 -1
- package/package.json +18 -2
- package/src/native/babel/index.js +30 -0
- package/src/native/babel-plugin/index.js +605 -0
- package/src/native/babel-plugin/index.test.ts +86 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.50",
|
|
4
4
|
"description": "React / React Native components and hooks for the Kbach framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,15 @@
|
|
|
40
40
|
"source": "./src/vite-plugin.ts",
|
|
41
41
|
"import": "./dist/vite-plugin.mjs",
|
|
42
42
|
"require": "./dist/vite-plugin.js"
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
|
+
"./native": {
|
|
45
|
+
"types": "./dist/native.d.ts",
|
|
46
|
+
"source": "./src/native/index.ts",
|
|
47
|
+
"import": "./dist/native.js",
|
|
48
|
+
"require": "./dist/native.js"
|
|
49
|
+
},
|
|
50
|
+
"./babel": "./src/native/babel/index.js",
|
|
51
|
+
"./babel-plugin": "./src/native/babel-plugin/index.js"
|
|
44
52
|
},
|
|
45
53
|
"scripts": {
|
|
46
54
|
"build": "tsup",
|
|
@@ -50,6 +58,7 @@
|
|
|
50
58
|
"postinstall": "node scripts/postinstall.js"
|
|
51
59
|
},
|
|
52
60
|
"devDependencies": {
|
|
61
|
+
"@babel/core": "^7.29.7",
|
|
53
62
|
"@testing-library/react": "^16.3.2",
|
|
54
63
|
"@types/node": "^20.19.42",
|
|
55
64
|
"@types/react": "^19.2.0",
|
|
@@ -61,11 +70,15 @@
|
|
|
61
70
|
"vitest": "^1.0.0"
|
|
62
71
|
},
|
|
63
72
|
"peerDependencies": {
|
|
73
|
+
"@babel/core": "^7.0.0",
|
|
64
74
|
"react": ">=18.0.0",
|
|
65
75
|
"react-native": ">=0.70.0",
|
|
66
76
|
"vite": ">=4.0.0"
|
|
67
77
|
},
|
|
68
78
|
"peerDependenciesMeta": {
|
|
79
|
+
"@babel/core": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
69
82
|
"react-native": {
|
|
70
83
|
"optional": true
|
|
71
84
|
},
|
|
@@ -79,10 +92,13 @@
|
|
|
79
92
|
"files": [
|
|
80
93
|
"dist",
|
|
81
94
|
"scripts",
|
|
95
|
+
"src/native/babel-plugin",
|
|
96
|
+
"src/native/babel",
|
|
82
97
|
"types.d.ts",
|
|
83
98
|
"jsx-runtime.js",
|
|
84
99
|
"jsx-dev-runtime.js",
|
|
85
100
|
"kbach-react.md",
|
|
101
|
+
"KBACH.md",
|
|
86
102
|
"README.md"
|
|
87
103
|
]
|
|
88
104
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @kbach/react/babel — Babel preset (NativeWind-style).
|
|
5
|
+
*
|
|
6
|
+
* babel.config.js:
|
|
7
|
+
* ```js
|
|
8
|
+
* module.exports = function(api) {
|
|
9
|
+
* api.cache(true);
|
|
10
|
+
* return {
|
|
11
|
+
* presets: [
|
|
12
|
+
* 'babel-preset-expo',
|
|
13
|
+
* '@kbach/react/babel',
|
|
14
|
+
* ],
|
|
15
|
+
* };
|
|
16
|
+
* };
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Presets run in reverse order, so this preset's plugin runs BEFORE
|
|
20
|
+
* babel-preset-expo's JSX transform — which is the correct ordering:
|
|
21
|
+
* kbach renames className/tw attributes first, then the JSX transform
|
|
22
|
+
* compiles JSX using @kbach/react/jsx-runtime.
|
|
23
|
+
*/
|
|
24
|
+
module.exports = function kbachBabelPreset(api, options = {}) {
|
|
25
|
+
return {
|
|
26
|
+
plugins: [
|
|
27
|
+
[require('../babel-plugin'), options],
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
};
|