@zohodesk/react-cli 1.1.27-exp.2 → 1.1.27-exp.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ const {
23
23
  app
24
24
  } = (0, _utils.getOptions)();
25
25
  const {
26
- disableES5Transpile
26
+ disableES5Import
27
27
  } = app;
28
28
 
29
29
  function aliasPathCreation(customAlias) {
@@ -64,7 +64,7 @@ const libAlias = {
64
64
  // '^@components(.*)$': '<rootDir>/src/components$1',
65
65
 
66
66
  exports.libAlias = libAlias;
67
- const totalAlias = disableES5Transpile ? Object.assign({}, libAlias, aliasPathCreation(alias)) : aliasPathCreation(alias);
67
+ const totalAlias = disableES5Import ? Object.assign({}, libAlias, aliasPathCreation(alias)) : aliasPathCreation(alias);
68
68
  const jestModuleNameMapper = Object.keys(totalAlias).reduce((previousValue, key) => {
69
69
  previousValue[`^${key}(.*)$`] = `${totalAlias[key]}$1`;
70
70
  return previousValue;
@@ -19,7 +19,7 @@ var _client_packages_group = require("@zohodesk/client_packages_group");
19
19
  function moduleResolver(options) {
20
20
  const {
21
21
  moduleResolvePath,
22
- disableES5Transpile
22
+ disableES5Import
23
23
  } = options.app;
24
24
  const customAlias = options.alias;
25
25
  let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
@@ -33,7 +33,7 @@ function moduleResolver(options) {
33
33
  }
34
34
 
35
35
  const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
36
- const totalAlias = disableES5Transpile ? Object.assign({}, _libAlias.libAlias, (0, _libAlias.aliasPathCreation)(customAlias)) : (0, _libAlias.aliasPathCreation)(customAlias);
36
+ const totalAlias = disableES5Import ? Object.assign({}, _libAlias.libAlias, (0, _libAlias.aliasPathCreation)(customAlias)) : (0, _libAlias.aliasPathCreation)(customAlias);
37
37
  return {
38
38
  extensions: ['.js', '.jsx', '.ts', '.tsx'],
39
39
  modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
@@ -11,6 +11,8 @@ var _utils = require("./utils");
11
11
 
12
12
  var _getI18nKeysFormModules = _interopRequireDefault(require("./utils/getI18nKeysFormModules"));
13
13
 
14
+ var _unicodeConversion = require("./utils/unicodeConversion");
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
18
  /**
@@ -58,8 +60,9 @@ class I18nFilesEmitter {
58
60
  }
59
61
 
60
62
  getTemplateString(i18nKeys, locale) {
61
- let i18nObject = this.getI18nObjectByLocale(i18nKeys, locale);
62
- return `${this.jsonpFunc}(${(0, _utils.jsonToString)(i18nObject)});`; // return `${this.jsonpFunc}(JSON.parse(${JSON.stringify(jsonToString(i18nObject))}));`;
63
+ const i18nObject = this.getI18nObjectByLocale(i18nKeys, locale);
64
+ const convertedI18nObject = (0, _unicodeConversion.convertUnicode)(JSON.stringify(i18nObject, null, 0));
65
+ return `${this.jsonpFunc}(${convertedI18nObject});`; // return `${this.jsonpFunc}(JSON.parse(${JSON.stringify(jsonToString(i18nObject))}));`;
63
66
  }
64
67
 
65
68
  renderI18nLocaleChunk(chunk, locale, i18nKeys) {
@@ -13,8 +13,6 @@ var _path = require("path");
13
13
 
14
14
  var _logger = require("../../../logger");
15
15
 
16
- var _unicodeConversion = require("./unicodeConversion");
17
-
18
16
  function isComment(line) {
19
17
  return line[0] === '#';
20
18
  }
@@ -33,8 +31,7 @@ function getPropertiesAsJSON(filePath) {
33
31
 
34
32
  const ind = line.indexOf('=');
35
33
  const key = line.slice(0, ind).replace(/\\ /g, ' ');
36
- let value = line.slice(ind + 1);
37
- value = (0, _unicodeConversion.convertUnicode)(value);
34
+ const value = line.slice(ind + 1);
38
35
 
39
36
  if (key && value) {
40
37
  i18nObj[key] = value;
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.convertUnicode = convertUnicode;
7
+ const UNICODE_PATTERN = /\\+u([0-9a-fA-F]{4})/g;
7
8
 
8
- function convertUnicode(str) {
9
- const unicodeRegex = /\\u([a-fA-F0-9]{4})/g;
10
- const converted = str.replace(unicodeRegex, (match, hex) => {
11
- return String.fromCharCode(parseInt(hex, 16));
12
- });
13
- return converted;
9
+ function convertUnicode(jsonStr) {
10
+ if (!jsonStr.includes('\\u')) {
11
+ return jsonStr;
12
+ }
13
+
14
+ UNICODE_PATTERN.lastIndex = 0;
15
+ return jsonStr.replace(UNICODE_PATTERN, (_, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
14
16
  }
@@ -232,6 +232,7 @@ var _default = {
232
232
  none: '(hover: none)'
233
233
  },
234
234
  disableES5Transpile: false,
235
+ disableES5Import: false,
235
236
  isReactMig: false,
236
237
  hasWidget: false,
237
238
  hasEFC: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.27-exp.2",
3
+ "version": "1.1.27-exp.3",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -12874,7 +12874,7 @@
12874
12874
  "sprintf-js": {
12875
12875
  "version": "1.0.3",
12876
12876
  "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
12877
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
12877
+ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
12878
12878
  },
12879
12879
  "sshpk": {
12880
12880
  "version": "1.17.0",
@@ -13312,7 +13312,7 @@
13312
13312
  "text-table": {
13313
13313
  "version": "0.2.0",
13314
13314
  "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
13315
- "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ="
13315
+ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="
13316
13316
  },
13317
13317
  "throat": {
13318
13318
  "version": "5.0.0",
@@ -14834,7 +14834,7 @@
14834
14834
  "wrappy": {
14835
14835
  "version": "1.0.2",
14836
14836
  "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
14837
- "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
14837
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
14838
14838
  },
14839
14839
  "write": {
14840
14840
  "version": "1.0.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.27-exp.2",
3
+ "version": "1.1.27-exp.3",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -43,10 +43,6 @@ class SelectorWeightPlugin {
43
43
  mods.forEach(module => {
44
44
  const filename = module.issuer.resource;
45
45
 
46
- if (filename == '/Users/zt375-t/work/desk_client_app/jsapps/supportapp/src/components/Subtab/chatGPT/chatGptCard/css/ChatGptCard.module.css') {
47
- console.log(module.content.toString());
48
- }
49
-
50
46
  if (!(0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(patterns, filename)) {
51
47
  return;
52
48
  }
@@ -108,6 +108,10 @@ const singleConvertor = (value, changeVal, details, range) => {
108
108
  }
109
109
  }
110
110
 
111
+ if (value == '0px') {
112
+ value = value.replace('px', '');
113
+ }
114
+
111
115
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
112
116
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
113
117
 
@@ -216,7 +220,7 @@ var _default = ({
216
220
  return;
217
221
  }
218
222
 
219
- if (settingsObject[decl.prop] && !decl.value.includes('var(--') && decl.value.toString() !== '0') {
223
+ if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
220
224
  const settings = settingsObject[decl.prop]; // console.log(settings)
221
225
 
222
226
  const {
@@ -306,7 +310,7 @@ var _default = ({
306
310
  range
307
311
  } = settings;
308
312
  const convertedVals = valArr.map(val => {
309
- if (val.includes('px') && val.toString() !== '0') {
313
+ if (val.includes('px')) {
310
314
  const convertedVal = singleConvertor(val, settings.replacements.px, {
311
315
  decl,
312
316
  filename,