@ray-js/build-plugin-router 0.5.7-beta-2 → 0.5.9-beta-1

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 +10 -6
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -37,7 +37,7 @@ function PluginRouter(api) {
37
37
  }
38
38
  },
39
39
  buildRoutesConfig(immediate) {
40
- var _a, _b;
40
+ var _a;
41
41
  const routesConfigFile = api.searchJSFile('src/routes.config');
42
42
  const { target } = api.options;
43
43
  if (!routesConfigFile) {
@@ -50,8 +50,15 @@ function PluginRouter(api) {
50
50
  if (!['tuya', 'wechat', 'thing'].includes(target)) {
51
51
  return this.generateWebRoutes(routesConfig);
52
52
  }
53
- const _target = lodash_1.default.capitalize(target);
54
- const appConfig = (_a = this[`get${_target}AppConfigData`]) === null || _a === void 0 ? void 0 : _a.call(this, routesConfig, (_b = globalConfig[target]) !== null && _b !== void 0 ? _b : {});
53
+ let _target = lodash_1.default.capitalize(target);
54
+ if (_target === 'Tuya') {
55
+ _target = 'Thing';
56
+ }
57
+ const thingGlobalConfig = globalConfig['thing'] || globalConfig['tuya'] || {};
58
+ const targetGlobalConfig =
59
+ // @ts-ignore
60
+ target === 'thing' || target === 'tuya' ? thingGlobalConfig : globalConfig[target];
61
+ const appConfig = (_a = this[`get${_target}AppConfigData`]) === null || _a === void 0 ? void 0 : _a.call(this, routesConfig, targetGlobalConfig !== null && targetGlobalConfig !== void 0 ? targetGlobalConfig : {});
55
62
  if (lodash_1.default.isEmpty(appConfig.tabBar)) {
56
63
  delete appConfig.tabBar; // 微信小程序tabBar不能为空对象,所以当为空对象时,索性所有小程序都删了
57
64
  }
@@ -113,9 +120,6 @@ function PluginRouter(api) {
113
120
  return config;
114
121
  },
115
122
  getThingAppConfigData(routesConfig, globalConfig) {
116
- return this.getTuyaAppConfigData(routesConfig, globalConfig);
117
- },
118
- getTuyaAppConfigData(routesConfig, globalConfig) {
119
123
  const { routes, tabBar } = routesConfig;
120
124
  const pages = routes.map((r) => r.path.replace(/^\//, ''));
121
125
  const tabBarConfig = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/build-plugin-router",
3
- "version": "0.5.7-beta-2",
3
+ "version": "0.5.9-beta-1",
4
4
  "description": "Ray build plugin for router",
5
5
  "keywords": [
6
6
  "ray"
@@ -21,13 +21,13 @@
21
21
  "watch": "tsc -p ./tsconfig.build.json --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@ray-js/plugin-utils": "^0.5.7-beta-2",
25
- "@ray-js/shared": "^0.5.7-beta-2",
24
+ "@ray-js/plugin-utils": "^0.5.9-beta-1",
25
+ "@ray-js/shared": "^0.5.9-beta-1",
26
26
  "chokidar": "^3.5.2",
27
27
  "colors": "1.4.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@ray-js/types": "^0.5.7-beta-2"
30
+ "@ray-js/types": "^0.5.9-beta-1"
31
31
  },
32
32
  "maintainers": [
33
33
  {
@@ -35,6 +35,6 @@
35
35
  "email": "tuyafe@tuya.com"
36
36
  }
37
37
  ],
38
- "gitHead": "290d921f04a74cf0df8415c91bd33119e6f8e11e",
38
+ "gitHead": "45232c09ae46aee3f29663e455158965ad329ff3",
39
39
  "repository": {}
40
40
  }