@ray-js/build-plugin-router 0.6.23 → 0.6.25

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.
Files changed (2) hide show
  1. package/lib/index.js +9 -7
  2. package/package.json +4 -4
package/lib/index.js CHANGED
@@ -72,15 +72,21 @@ const standardAppConfigFieldMap = [
72
72
  'backgroundColor',
73
73
  ];
74
74
  function normalizeTabBarConfig(config, routes, fields) {
75
- let _a = config || {}, { list = [] } = _a, rest = __rest(_a, ["list"]);
75
+ if (!config) {
76
+ return;
77
+ }
78
+ let { list } = config, rest = __rest(config, ["list"]);
76
79
  let cfg;
77
80
  if (!lodash_1.default.isArray(list)) {
78
81
  printError(`tabBar.list 数据结构不对`.red);
79
82
  return cfg;
80
83
  }
81
84
  list = list.map((tab) => {
85
+ if (tab.id === undefined) {
86
+ return tab;
87
+ }
82
88
  for (const r of routes) {
83
- // 兼容老项目
89
+ // 兼容老项目,将老数据格式到新数据
84
90
  if (tab.id === r.id) {
85
91
  return Object.assign(Object.assign({}, tab), { pagePath: r.path });
86
92
  }
@@ -96,11 +102,7 @@ function normalizeTabBarConfig(config, routes, fields) {
96
102
  const tabs = list
97
103
  .map((tab, index) => {
98
104
  var _a;
99
- const m = routes.find((i) => {
100
- return (tab.pagePath === i.path ||
101
- // 兼容老项目
102
- tab.id === i.id);
103
- });
105
+ const m = routes.find((i) => tab.pagePath === i.path);
104
106
  if (!m) {
105
107
  printError(`tabBar.list[${index}].pagePath: ${tab.pagePath} 需要在路由配置中: \n${JSON.stringify(routes, null, 2)}`.red);
106
108
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/build-plugin-router",
3
- "version": "0.6.23",
3
+ "version": "0.6.25",
4
4
  "description": "Ray build plugin for router",
5
5
  "keywords": [
6
6
  "ray"
@@ -21,7 +21,7 @@
21
21
  "watch": "tsc -p ./tsconfig.build.json --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@ray-js/shared": "^0.6.23",
24
+ "@ray-js/shared": "^0.6.25",
25
25
  "chokidar": "^3.5.2",
26
26
  "colors": "1.4.0",
27
27
  "ejs": "^3.1.6",
@@ -30,7 +30,7 @@
30
30
  "url": "^0.11.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@ray-js/types": "^0.6.23"
33
+ "@ray-js/types": "^0.6.25"
34
34
  },
35
35
  "maintainers": [
36
36
  {
@@ -38,6 +38,6 @@
38
38
  "email": "tuyafe@tuya.com"
39
39
  }
40
40
  ],
41
- "gitHead": "e60b0be5d086d6d24238c12b29eebc3cbbd3f0dd",
41
+ "gitHead": "410b4714bc5f496978ddd642ee092f0fe3d8bf8d",
42
42
  "repository": {}
43
43
  }