@modern-js/plugin-i18n 1.2.2 → 1.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,5 +1,18 @@
1
1
  # @modern-js/plugin-i18n
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 17d0cc46: feat: prebundle lodash to @modern-js/utils/lodash
8
+ - Updated dependencies [77ff9754]
9
+ - Updated dependencies [d2d1d6b2]
10
+ - Updated dependencies [07a4887e]
11
+ - Updated dependencies [ea2ae711]
12
+ - Updated dependencies [17d0cc46]
13
+ - Updated dependencies [d2d1d6b2]
14
+ - @modern-js/utils@1.4.0
15
+
3
16
  ## 1.2.2
4
17
 
5
18
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import _get from "lodash/get";
1
+ import { get } from '@modern-js/utils/lodash';
2
2
  import { getObjKeyMap } from "./utils";
3
3
 
4
4
  class I18n {
@@ -26,8 +26,7 @@ class I18n {
26
26
  return fallbackText || key;
27
27
  }
28
28
 
29
- const message = _get(model, key);
30
-
29
+ const message = get(model, key);
31
30
  const value = message || fallbackText || key;
32
31
 
33
32
  if (typeof value === 'string') {
@@ -1,11 +1,10 @@
1
- import _isString from "lodash/isString";
2
- import _isObject from "lodash/isObject";
1
+ import { isObject, isString } from '@modern-js/utils/lodash';
3
2
  export function getObjKeyMap(obj, prefix = '') {
4
3
  const result = {};
5
4
  Object.keys(obj).forEach(key => {
6
- if (_isString(obj[key])) {
5
+ if (isString(obj[key])) {
7
6
  result[key] = prefix ? `${prefix}.${key}` : key;
8
- } else if (_isObject(obj[key])) {
7
+ } else if (isObject(obj[key])) {
9
8
  result[key] = getObjKeyMap(obj[key], prefix ? `${prefix}.${key}` : key);
10
9
  }
11
10
  });
@@ -5,12 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.I18n = void 0;
7
7
 
8
- var _get2 = _interopRequireDefault(require("lodash/get"));
8
+ var _lodash = require("@modern-js/utils/lodash");
9
9
 
10
10
  var _utils = require("./utils");
11
11
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
12
  class I18n {
15
13
  constructor() {
16
14
  this.language = 'en';
@@ -36,7 +34,7 @@ class I18n {
36
34
  return fallbackText || key;
37
35
  }
38
36
 
39
- const message = (0, _get2.default)(model, key);
37
+ const message = (0, _lodash.get)(model, key);
40
38
  const value = message || fallbackText || key;
41
39
 
42
40
  if (typeof value === 'string') {
@@ -5,18 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getObjKeyMap = getObjKeyMap;
7
7
 
8
- var _isString2 = _interopRequireDefault(require("lodash/isString"));
9
-
10
- var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ var _lodash = require("@modern-js/utils/lodash");
13
9
 
14
10
  function getObjKeyMap(obj, prefix = '') {
15
11
  const result = {};
16
12
  Object.keys(obj).forEach(key => {
17
- if ((0, _isString2.default)(obj[key])) {
13
+ if ((0, _lodash.isString)(obj[key])) {
18
14
  result[key] = prefix ? `${prefix}.${key}` : key;
19
- } else if ((0, _isObject2.default)(obj[key])) {
15
+ } else if ((0, _lodash.isObject)(obj[key])) {
20
16
  result[key] = getObjKeyMap(obj[key], prefix ? `${prefix}.${key}` : key);
21
17
  }
22
18
  });
@@ -1,11 +1,10 @@
1
- import _get from "lodash/get";
2
-
3
1
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
2
 
5
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
4
 
7
5
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
6
 
7
+ import { get } from '@modern-js/utils/lodash';
9
8
  import { getObjKeyMap } from "./utils";
10
9
 
11
10
  var I18n = /*#__PURE__*/function () {
@@ -42,8 +41,7 @@ var I18n = /*#__PURE__*/function () {
42
41
  return fallbackText || key;
43
42
  }
44
43
 
45
- var message = _get(model, key);
46
-
44
+ var message = get(model, key);
47
45
  var value = message || fallbackText || key;
48
46
 
49
47
  if (typeof value === 'string') {
@@ -1,12 +1,11 @@
1
- import _isString from "lodash/isString";
2
- import _isObject from "lodash/isObject";
1
+ import { isObject, isString } from '@modern-js/utils/lodash';
3
2
  export function getObjKeyMap(obj) {
4
3
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
5
4
  var result = {};
6
5
  Object.keys(obj).forEach(function (key) {
7
- if (_isString(obj[key])) {
6
+ if (isString(obj[key])) {
8
7
  result[key] = prefix ? "".concat(prefix, ".").concat(key) : key;
9
- } else if (_isObject(obj[key])) {
8
+ } else if (isObject(obj[key])) {
10
9
  result[key] = getObjKeyMap(obj[key], prefix ? "".concat(prefix, ".").concat(key) : key);
11
10
  }
12
11
  });
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.2",
14
+ "version": "1.2.3",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -28,11 +28,10 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7",
31
- "lodash": "^4.17.11"
31
+ "@modern-js/utils": "^1.4.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/jest": "^26",
35
- "@types/lodash": "^4.14.126",
36
35
  "@types/node": "^14",
37
36
  "typescript": "^4",
38
37
  "@scripts/build": "0.0.0",
@@ -43,17 +42,7 @@
43
42
  "modernConfig": {},
44
43
  "publishConfig": {
45
44
  "registry": "https://registry.npmjs.org/",
46
- "access": "public",
47
- "types": "./dist/types/index.d.ts",
48
- "exports": {
49
- ".": {
50
- "node": {
51
- "import": "./dist/js/modern/index.js",
52
- "require": "./dist/js/node/index.js"
53
- },
54
- "default": "./dist/js/treeshaking/index.js"
55
- }
56
- }
45
+ "access": "public"
57
46
  },
58
47
  "scripts": {
59
48
  "new": "modern new",