@zohodesk/react-cli 1.1.27-exp.3 → 1.1.28-exp.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -44,6 +44,24 @@ Now to run app
44
44
 
45
45
  # Change Logs
46
46
 
47
+ # 1.1.28 (29-01-2025)
48
+
49
+ **Fixes**
50
+
51
+ - We've changed the i18n Unicode conversion process. Instead of converting the Unicode at runtime, we now convert it to the corresponding language during the build process and emit the final build
52
+ - Added @zohodesk-private in transformIgnorePatterns in jest.config.js file , fix in jest
53
+
54
+ **changes**
55
+
56
+ - separate the disableES5Transpile flag as two flags disableES5Transpile and disableES5Import
57
+ - disableES5Import flag handles the alias part
58
+ - disableES5Transpile flag handles the esmodules or common modules conversion part
59
+
60
+
61
+ # 1.1.27 (16-12-2024)
62
+
63
+ - While rendering i18n keys at runtime, we convert any keys containing Unicode to their corresponding language characters before rendering. This enhances performance and reduces file size.
64
+
47
65
  # 1.1.26 (06-09-2024)
48
66
 
49
67
  **Features**
@@ -26,7 +26,7 @@ const commonConfig = {
26
26
  // ...moduleNameMapper,
27
27
  // '\\.(css|less)$': 'identity-obj-proxy'
28
28
  // },
29
- transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
29
+ transformIgnorePatterns: ['/node_modules/(?!(@zohodesk|@zohodesk-private)/)'],
30
30
  // transformIgnorePatterns: ['/node_modules.*?.js$'],
31
31
  moduleFileExtensions: ['js', 'ts', 'tsx'],
32
32
  setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
@@ -11,8 +11,6 @@ var _utils = require("./utils");
11
11
 
12
12
  var _getI18nKeysFormModules = _interopRequireDefault(require("./utils/getI18nKeysFormModules"));
13
13
 
14
- var _unicodeConversion = require("./utils/unicodeConversion");
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
15
 
18
16
  /**
@@ -60,9 +58,8 @@ class I18nFilesEmitter {
60
58
  }
61
59
 
62
60
  getTemplateString(i18nKeys, locale) {
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))}));`;
61
+ let i18nObject = this.getI18nObjectByLocale(i18nKeys, locale);
62
+ return `${this.jsonpFunc}(${(0, _utils.jsonToString)(i18nObject)});`; // return `${this.jsonpFunc}(JSON.parse(${JSON.stringify(jsonToString(i18nObject))}));`;
66
63
  }
67
64
 
68
65
  renderI18nLocaleChunk(chunk, locale, i18nKeys) {
@@ -13,6 +13,8 @@ var _path = require("path");
13
13
 
14
14
  var _logger = require("../../../logger");
15
15
 
16
+ var _unicodeConversion = require("./unicodeConversion");
17
+
16
18
  function isComment(line) {
17
19
  return line[0] === '#';
18
20
  }
@@ -31,7 +33,8 @@ function getPropertiesAsJSON(filePath) {
31
33
 
32
34
  const ind = line.indexOf('=');
33
35
  const key = line.slice(0, ind).replace(/\\ /g, ' ');
34
- const value = line.slice(ind + 1);
36
+ let value = line.slice(ind + 1);
37
+ value = (0, _unicodeConversion.convertUnicode)(value);
35
38
 
36
39
  if (key && value) {
37
40
  i18nObj[key] = value;
@@ -4,13 +4,11 @@ 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;
8
7
 
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)));
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;
16
14
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.27-exp.3",
3
+ "version": "1.1.28",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.27-exp.3",
3
+ "version": "1.1.28-exp.1",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -41,7 +41,7 @@
41
41
  "@babel/preset-env": "7.11.0",
42
42
  "@babel/preset-react": "7.10.4",
43
43
  "@babel/runtime": "7.11.2",
44
- "@zohodesk/client_packages_group": "1.0.2",
44
+ "@zohodesk/client_packages_group": "1.0.2-exp.6",
45
45
  "@zohodesk/eslint-plugin-react-performance": "1.0.3",
46
46
  "@zohodesk/eslint-plugin-zsecurity": "0.0.1-beta.4",
47
47
  "@zohodesk/postcss-rtl": "1.5.2",