@ray-js/build-plugin-router 0.5.10 → 0.6.0
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/lib/index.js +12 -5
- 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
|
40
|
+
var _a;
|
41
41
|
const routesConfigFile = api.searchJSFile('src/routes.config');
|
42
42
|
const { target } = api.options;
|
43
43
|
if (!routesConfigFile) {
|
@@ -47,11 +47,18 @@ function PluginRouter(api) {
|
|
47
47
|
const routesConfig = api.requireJSFile(routesConfigFile);
|
48
48
|
const globalConfig = globalConfigFile ? api.requireJSFile(globalConfigFile, '*') : {};
|
49
49
|
// TODO: 小程序端统一生成 app.config 需要过滤 targets 的描述页面对象
|
50
|
-
if (!['tuya', 'wechat'].includes(target)) {
|
50
|
+
if (!['tuya', 'wechat', 'thing'].includes(target)) {
|
51
51
|
return this.generateWebRoutes(routesConfig);
|
52
52
|
}
|
53
|
-
|
54
|
-
|
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
|
}
|
@@ -112,7 +119,7 @@ function PluginRouter(api) {
|
|
112
119
|
});
|
113
120
|
return config;
|
114
121
|
},
|
115
|
-
|
122
|
+
getThingAppConfigData(routesConfig, globalConfig) {
|
116
123
|
const { routes, tabBar } = routesConfig;
|
117
124
|
const pages = routes.map((r) => r.path.replace(/^\//, ''));
|
118
125
|
const tabBarConfig = {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/build-plugin-router",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.6.0",
|
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.
|
25
|
-
"@ray-js/shared": "^0.
|
24
|
+
"@ray-js/plugin-utils": "^0.6.0",
|
25
|
+
"@ray-js/shared": "^0.6.0",
|
26
26
|
"chokidar": "^3.5.2",
|
27
27
|
"colors": "1.4.0"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
|
-
"@ray-js/types": "^0.
|
30
|
+
"@ray-js/types": "^0.6.0"
|
31
31
|
},
|
32
32
|
"maintainers": [
|
33
33
|
{
|
@@ -35,6 +35,6 @@
|
|
35
35
|
"email": "tuyafe@tuya.com"
|
36
36
|
}
|
37
37
|
],
|
38
|
-
"gitHead": "
|
38
|
+
"gitHead": "d7e74c750c02eda67af6e54da93aad14d001acb3",
|
39
39
|
"repository": {}
|
40
40
|
}
|