@zohodesk/react-cli 1.1.26 → 1.1.27-exp.1
Sign up to get free protection for your applications and to get access to all the 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,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
|
-
|
62
|
-
|
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) {
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.convertUnicode = convertUnicode;
|
7
|
+
const UNICODE_PATTERN = /\\+u([0-9a-fA-F]{4})/g;
|
8
|
+
|
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)));
|
16
|
+
}
|