@cssxjs/bundler 0.2.1 → 0.2.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v0.2.3 (Wed Nov 05 2025)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - fix: update stylus, add a runtime patch to support the 'u' unit which equals to 8px. ([@cray0000](https://github.com/cray0000))
6
+
7
+ #### Authors: 1
8
+
9
+ - Pavel Zhukov ([@cray0000](https://github.com/cray0000))
10
+
11
+ ---
12
+
13
+ # v0.2.2 (Tue Nov 04 2025)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - fix: support dynamic css var() for colors ([@cray0000](https://github.com/cray0000))
18
+
19
+ #### Authors: 1
20
+
21
+ - Pavel Zhukov ([@cray0000](https://github.com/cray0000))
22
+
23
+ ---
24
+
1
25
  # v0.2.0 (Tue Nov 04 2025)
2
26
 
3
27
  #### 🚀 Enhancement
@@ -2,6 +2,10 @@
2
2
  const { existsSync } = require('fs')
3
3
  const { join } = require('path')
4
4
  const stylus = require('stylus')
5
+ const patchStylusAddUnit = require('../patches/patchStylusAddUnit')
6
+
7
+ // apply patches
8
+ patchStylusAddUnit()
5
9
 
6
10
  const PROJECT_STYLES_PATH = join(process.cwd(), 'styles/index.styl')
7
11
  let UI_STYLES_PATH
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cssxjs/bundler",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Compile CSSX styles in React Native and Web bundlers",
5
5
  "exports": {
6
6
  "./metro-config": "./metro-config.js",
@@ -22,10 +22,10 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "@babel/core": "^7.0.0",
25
- "@cssxjs/babel-plugin-rn-stylename-inline": "^0.2.1",
26
- "@startupjs/css-to-react-native-transform": "^2.1.0-0",
27
- "babel-preset-cssxjs": "^0.2.1",
28
- "stylus": "0.54.7"
25
+ "@cssxjs/babel-plugin-rn-stylename-inline": "^0.2.3",
26
+ "@startupjs/css-to-react-native-transform": "^2.1.0-1",
27
+ "babel-preset-cssxjs": "^0.2.3",
28
+ "stylus": "0.64.0"
29
29
  },
30
- "gitHead": "44fe78c4d462f9720bb40aceecfceff0bbda6c2f"
30
+ "gitHead": "f0c94552a7c93f54f2b8b0fbf5d0d728a5e225f5"
31
31
  }
@@ -0,0 +1,43 @@
1
+ // add a new custom unit 'u' which is equal to 8px
2
+ const units = require('stylus/lib/units.js')
3
+ const Unit = require('stylus/lib/nodes/unit.js')
4
+ let patched = false
5
+
6
+ module.exports = function patchStylusAddUnit () {
7
+ if (patched) return
8
+ patched = true
9
+
10
+ // add the unit itself
11
+ if (!units.includes('u')) units.push('u')
12
+
13
+ /**
14
+ * a monkey patch to convert the 'type' to be dynamic setter/getter
15
+ * with the real value stored in a private symbol. This simulates having 'u' unit converted to 'px' * 8 on assignment.
16
+ *
17
+ * Original constructor is the following:
18
+ *
19
+ * constructor(val, type) {
20
+ * super();
21
+ * this.val = val;
22
+ * this.type = type;
23
+ * }
24
+ *
25
+ * this.val and this.type are never reassigned.
26
+ * This make it possible to hack the this.type assignment specifically by auto-multiplying the this.val by 8
27
+ * during the attempt to assign the 'u' to this.type
28
+ */
29
+
30
+ const TYPE = Symbol('unit.type')
31
+ Object.defineProperty(Unit.prototype, 'type', {
32
+ configurable: true,
33
+ enumerable: true,
34
+ get () { return this[TYPE] },
35
+ set (t) {
36
+ if (t === 'u') {
37
+ t = 'px'
38
+ if (typeof this.val === 'number') this.val = this.val * 8
39
+ }
40
+ this[TYPE] = t
41
+ }
42
+ })
43
+ }