taro-css-to-react-native 4.0.13-alpha.0 → 4.0.13

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/dist/index.js CHANGED
@@ -46,8 +46,8 @@ var transformDecls = function transformDecls(styles, declarations, result) {
46
46
  }
47
47
  // scalable option, when it is false, transform single value 'px' unit to 'PX'
48
48
  // do not be wrapped by scalePx2dp function
49
- if (typeof options.scalable === 'boolean' && !options.scalable && /(\d+)px/.test(value)) {
50
- value = value.replace(/(\d+)px/g, '$1PX');
49
+ if (typeof options.scalable === 'boolean' && !options.scalable && /(?<!\d)(\d+)px/.test(value)) {
50
+ value = value.replace(/(?<!\d)(\d+)px/g, '$1PX');
51
51
  }
52
52
  // expect value is legal so that remove !import
53
53
  if (/!import/i.test(value)) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.remToPx = void 0;
7
7
  var remToPx = exports.remToPx = function remToPx(value) {
8
- return value.replace(/(\d*\.?\d+)rem/g, function (match, m1) {
8
+ return value.replace(/(?<!\d)((?:\d*\.\d+)|\d+)rem/g, function (match, m1) {
9
9
  return parseFloat(m1, 10) * 16 + 'px';
10
10
  });
11
11
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "taro-css-to-react-native",
3
3
  "description": "Convert CSS text to a React Native stylesheet object",
4
- "version": "4.0.13-alpha.0",
4
+ "version": "4.0.13",
5
5
  "author": "O2Team",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
package/src/index.js CHANGED
@@ -57,9 +57,9 @@ const transformDecls = (styles, declarations, result, options = {}) => {
57
57
  if (
58
58
  typeof options.scalable === 'boolean' &&
59
59
  !options.scalable &&
60
- /(\d+)px/.test(value)
60
+ /(?<!\d)(\d+)px/.test(value)
61
61
  ) {
62
- value = value.replace(/(\d+)px/g, '$1PX')
62
+ value = value.replace(/(?<!\d)(\d+)px/g, '$1PX')
63
63
  }
64
64
  // expect value is legal so that remove !import
65
65
  if (/!import/i.test(value)) {
@@ -1,3 +1,3 @@
1
1
  export const remToPx = value => {
2
- return value.replace(/(\d*\.?\d+)rem/g, (match, m1) => parseFloat(m1, 10) * 16 + 'px')
2
+ return value.replace(/(?<!\d)((?:\d*\.\d+)|\d+)rem/g, (match, m1) => parseFloat(m1, 10) * 16 + 'px')
3
3
  }