@cloudbase/lowcode-builder 1.8.32 → 1.8.33
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/dist/builder.web.js +10 -10
- package/lib/builder/config/index.d.ts +2 -2
- package/lib/builder/config/index.js +2 -2
- package/lib/builder/core/index.d.ts +2 -1
- package/lib/builder/core/index.js +2 -1
- package/lib/builder/h5/index.js +2 -1
- package/lib/builder/mp/BuildContext.d.ts +4 -0
- package/lib/builder/mp/index.js +6 -2
- package/lib/builder/mp/wxml.js +20 -4
- package/lib/builder.web.js +10 -10
- package/lib/utils/transform.js +19 -2
- package/package.json +4 -4
- package/template/.DS_Store +0 -0
- package/template/html/index.html.ejs +1 -1
- package/template/mp/.DS_Store +0 -0
- package/template/mp/common/.DS_Store +0 -0
- package/template/mp/common/event-emitter.js +3 -0
- package/template/mp/common/flow.js +2 -2
- package/template/mp/common/{loading → info}/index.js +8 -1
- package/template/mp/common/info/index.wxml +13 -0
- package/template/mp/common/util.js +52 -2
- package/template/mp/common/weapp-page.js +21 -1
- package/template/mp/common/loading/index.wxml +0 -8
- /package/template/mp/common/{loading → info}/index.json +0 -0
- /package/template/mp/common/{loading → info}/index.wxss +0 -0
package/lib/utils/transform.js
CHANGED
|
@@ -4,8 +4,25 @@ exports.BabelTransform = void 0;
|
|
|
4
4
|
/* eslint-disable no-new-func */
|
|
5
5
|
const core_1 = require("@babel/core");
|
|
6
6
|
function BabelTransform(code, options = {}) {
|
|
7
|
-
var _a;
|
|
7
|
+
var _a, _b, _c;
|
|
8
8
|
const { IIFE = false } = options;
|
|
9
|
+
/**
|
|
10
|
+
* 如果 trim 完为空
|
|
11
|
+
* 则原样不用再编译了
|
|
12
|
+
*/
|
|
13
|
+
if (!((_a = code === null || code === void 0 ? void 0 : code.trim) === null || _a === void 0 ? void 0 : _a.call(code))) {
|
|
14
|
+
return code;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
/**
|
|
18
|
+
* 如果是基础字面量的话
|
|
19
|
+
* 可以直接使用原值,不用过babel
|
|
20
|
+
*/
|
|
21
|
+
if (typeof code === 'string' && JSON.parse((_b = code === null || code === void 0 ? void 0 : code.trim) === null || _b === void 0 ? void 0 : _b.call(code))) {
|
|
22
|
+
return code;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (e) { }
|
|
9
26
|
try {
|
|
10
27
|
const simpleWrapped = `(\n${code || 'undefined'}\n)`;
|
|
11
28
|
const { code: expression } = (0, core_1.transformSync)(IIFE ? `(()=>${simpleWrapped})()` : simpleWrapped, {
|
|
@@ -38,7 +55,7 @@ function BabelTransform(code, options = {}) {
|
|
|
38
55
|
],
|
|
39
56
|
],
|
|
40
57
|
}) || {};
|
|
41
|
-
const res = ((
|
|
58
|
+
const res = ((_c = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _c === void 0 ? void 0 : _c.call(expression, /;$/, '')) || code;
|
|
42
59
|
if (expression) {
|
|
43
60
|
new Function(`return (\n${res}\n)`);
|
|
44
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.33",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/core": "7.12.3",
|
|
43
43
|
"@babel/preset-env": "7.12.1",
|
|
44
|
-
"@cloudbase/cals": "^1.0.
|
|
45
|
-
"@cloudbase/lowcode-generator": "^1.8.
|
|
44
|
+
"@cloudbase/cals": "^1.0.21",
|
|
45
|
+
"@cloudbase/lowcode-generator": "^1.8.12",
|
|
46
46
|
"axios": "^0.21.0",
|
|
47
47
|
"browserfs": "^1.4.3",
|
|
48
48
|
"browserify-zlib": "^0.2.0",
|
|
@@ -84,4 +84,4 @@
|
|
|
84
84
|
"webpack-dev-server": "^4.7.3",
|
|
85
85
|
"worker-loader": "^3.0.8"
|
|
86
86
|
}
|
|
87
|
-
}
|
|
87
|
+
}
|
|
Binary file
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
crossorigin
|
|
552
552
|
src="<%=
|
|
553
553
|
cdnEndpoints.cdngo
|
|
554
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
554
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.6e7ca58f90bb6d1c7831.bundle.js"
|
|
555
555
|
></script>
|
|
556
556
|
</body>
|
|
557
557
|
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -68,6 +68,7 @@ export class Event {
|
|
|
68
68
|
*/
|
|
69
69
|
_isCapturePhase; /* : boolean; */
|
|
70
70
|
origin /* : Event */;
|
|
71
|
+
originEvent /* ?: React.SyntheticEvent */;
|
|
71
72
|
constructor(
|
|
72
73
|
{
|
|
73
74
|
type = '',
|
|
@@ -76,6 +77,7 @@ export class Event {
|
|
|
76
77
|
target = undefined,
|
|
77
78
|
_isCapturePhase = false,
|
|
78
79
|
origin,
|
|
80
|
+
originEvent = undefined,
|
|
79
81
|
} /* : IEventProps*/,
|
|
80
82
|
) {
|
|
81
83
|
function proxyWrapper(target, key) {
|
|
@@ -97,6 +99,7 @@ export class Event {
|
|
|
97
99
|
this.currentTarget = proxyWrapper(currentTarget, 'currentTarget');
|
|
98
100
|
this.target = proxyWrapper(target, 'target');
|
|
99
101
|
this.origin = proxyWrapper(origin, 'origin');
|
|
102
|
+
this.originEvent = originEvent;
|
|
100
103
|
|
|
101
104
|
this._isCapturePhase = _isCapturePhase;
|
|
102
105
|
return new Proxy(this, {
|
|
@@ -41,13 +41,13 @@ export class EventFlow {
|
|
|
41
41
|
currentTarget: target,
|
|
42
42
|
}),
|
|
43
43
|
);
|
|
44
|
-
// const emit = (trigger, eventData,
|
|
44
|
+
// const emit = (trigger, eventData, originEvent?) =>
|
|
45
45
|
// generateEmit($w, target)(
|
|
46
46
|
// trigger,
|
|
47
47
|
// this._listenerInstances,
|
|
48
48
|
// eventData,
|
|
49
49
|
// forContext,
|
|
50
|
-
//
|
|
50
|
+
// originEvent,
|
|
51
51
|
// scopeContext,
|
|
52
52
|
// dataContext,
|
|
53
53
|
// $w.page.id,
|
|
@@ -3,6 +3,7 @@ Component({
|
|
|
3
3
|
* 组件的属性列表
|
|
4
4
|
*/
|
|
5
5
|
properties: {
|
|
6
|
+
type: String,
|
|
6
7
|
message: String
|
|
7
8
|
},
|
|
8
9
|
|
|
@@ -23,7 +24,13 @@ Component({
|
|
|
23
24
|
lifetimes: {
|
|
24
25
|
attached() {
|
|
25
26
|
setTimeout(() => {
|
|
26
|
-
|
|
27
|
+
const data = {
|
|
28
|
+
visible: true
|
|
29
|
+
}
|
|
30
|
+
if(this.data.type === 'loading') {
|
|
31
|
+
data.message = '登录鉴权中...'
|
|
32
|
+
}
|
|
33
|
+
this.setData(data)
|
|
27
34
|
}, 100)
|
|
28
35
|
},
|
|
29
36
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<view id="loading" class="weda-loading-container" wx:if="{{visible}}">
|
|
2
|
+
<view class="logo">
|
|
3
|
+
<image
|
|
4
|
+
style="width:50px;height:50px"
|
|
5
|
+
wx:if="{{type !== 'loading'}}"
|
|
6
|
+
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PG1hc2sgaWQ9ImEiIHN0eWxlPSJtYXNrLXR5cGU6YWxwaGEiIG1hc2tVbml0cz0idXNlclNwYWNlT25Vc2UiIHg9IjAiIHk9IjIiIHdpZHRoPSIxMC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|
+
{{message}}
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
@@ -120,6 +120,7 @@ export function createEventHandlers(
|
|
|
120
120
|
handlerName: '',
|
|
121
121
|
event: {
|
|
122
122
|
...event,
|
|
123
|
+
originEvent: undefined
|
|
123
124
|
},
|
|
124
125
|
},
|
|
125
126
|
];
|
|
@@ -155,6 +156,7 @@ export function createEventHandlers(
|
|
|
155
156
|
event: {
|
|
156
157
|
...event,
|
|
157
158
|
detail: res,
|
|
159
|
+
originEvent: undefined
|
|
158
160
|
},
|
|
159
161
|
});
|
|
160
162
|
}
|
|
@@ -478,7 +480,7 @@ export async function checkAuth(app, appId, $page) {
|
|
|
478
480
|
if (loginPage?.id === $page.id) {
|
|
479
481
|
return true;
|
|
480
482
|
}
|
|
481
|
-
|
|
483
|
+
wx.showNavigationBarLoading();
|
|
482
484
|
const requestList = [getAccessPermission(app, appId, $page.id)];
|
|
483
485
|
// 暂时先认为有登录页则自定义登录功能开启且生效
|
|
484
486
|
if (loginPage) {
|
|
@@ -486,7 +488,6 @@ export async function checkAuth(app, appId, $page) {
|
|
|
486
488
|
}
|
|
487
489
|
try {
|
|
488
490
|
const [accessData, authConfig] = await Promise.all(requestList);
|
|
489
|
-
app.hideNavigationBarLoading();
|
|
490
491
|
|
|
491
492
|
const isAnonymousUser = await checkAnonymous();
|
|
492
493
|
|
|
@@ -519,6 +520,8 @@ export async function checkAuth(app, appId, $page) {
|
|
|
519
520
|
showCancel: false,
|
|
520
521
|
});
|
|
521
522
|
return false;
|
|
523
|
+
} finally {
|
|
524
|
+
wx.hideNavigationBarLoading();
|
|
522
525
|
}
|
|
523
526
|
}
|
|
524
527
|
|
|
@@ -716,3 +719,50 @@ export function processStaticResourceAttribute(data, replacer, property) {
|
|
|
716
719
|
console.error('处理静态资源失败:', e);
|
|
717
720
|
}
|
|
718
721
|
}
|
|
722
|
+
|
|
723
|
+
<% if(expirationStartTimesnap){ %>
|
|
724
|
+
function formatLifecycle(time) {
|
|
725
|
+
let str = '';
|
|
726
|
+
const times = [time / 1000, 0, 0, 0];
|
|
727
|
+
const unit = ['秒', '分', '小时', '天'];
|
|
728
|
+
const delta = [1, 60, 60, 24];
|
|
729
|
+
for (let i = 1; i < times.length; i++) {
|
|
730
|
+
if (times[i - 1]) {
|
|
731
|
+
times[i] = Math.floor(times[i - 1] / delta[i]);
|
|
732
|
+
times[i - 1] = times[i - 1] % delta[i];
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
for (let i = times.length - 1; i >= 0; i--) {
|
|
736
|
+
if (times[i]) {
|
|
737
|
+
str += times[i]+unit[i];
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
return str;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const PROMISE = new Promise((resolve,reject)=>{
|
|
744
|
+
wx.request({
|
|
745
|
+
url: 'https://comp-public-1303824488.file.myqcloud.com/release_config/runtime/exp_runtime.json',
|
|
746
|
+
success: res => resolve(res.data),
|
|
747
|
+
fail: reject
|
|
748
|
+
})
|
|
749
|
+
})
|
|
750
|
+
<% } %>
|
|
751
|
+
|
|
752
|
+
export async function getExpiredMessage(createdTime = 0) {
|
|
753
|
+
<% if(expirationStartTimesnap){ %>
|
|
754
|
+
try {
|
|
755
|
+
if (createdTime) {
|
|
756
|
+
const json = await PROMISE;
|
|
757
|
+
const { expLifeime = Infinity } = json;
|
|
758
|
+
if (Date.now() - createdTime > expLifeime) {
|
|
759
|
+
return `该版本为体验版,需要再次发布激活,每次发布应用活跃时间为${formatLifecycle(
|
|
760
|
+
expLifeime,
|
|
761
|
+
)}。您也可以升级为正式版本,无应用活跃时间限制。`;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
} catch (e) {
|
|
765
|
+
console.error('检查应用存活周期失败', e);
|
|
766
|
+
}
|
|
767
|
+
<% } %>
|
|
768
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
getMpEventHandlerName,
|
|
7
7
|
generateDatasetQuery,
|
|
8
8
|
generateEventFlows,
|
|
9
|
+
getExpiredMessage
|
|
9
10
|
} from './util';
|
|
10
11
|
import { createWidgets, createInitData, disposeWidget, getWidget } from './widget';
|
|
11
12
|
import mergeRenderer from './merge-renderer';
|
|
@@ -98,6 +99,7 @@ export function createPage({
|
|
|
98
99
|
data: {
|
|
99
100
|
...createInitData(widgetProps, dataBinds),
|
|
100
101
|
_isCheckingAtuh: false,
|
|
102
|
+
_expiredMessage: '',
|
|
101
103
|
weDaHasLogin: false,
|
|
102
104
|
},
|
|
103
105
|
lifetimes: {
|
|
@@ -122,6 +124,13 @@ export function createPage({
|
|
|
122
124
|
widget._methods = {};
|
|
123
125
|
};
|
|
124
126
|
this._disposers.push(...this.initMergeRenderer($page.widgets));
|
|
127
|
+
getExpiredMessage(<%= expirationStartTimesnap %>).then(message => {
|
|
128
|
+
if (message) {
|
|
129
|
+
this.setData({
|
|
130
|
+
_expiredMessage: message
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
})
|
|
125
134
|
},
|
|
126
135
|
detached() {
|
|
127
136
|
const $page = this._getInstance();
|
|
@@ -283,7 +292,18 @@ export function createPage({
|
|
|
283
292
|
app.utils.set($page.dataset.state, keyPath, userSetState[keyPath]);
|
|
284
293
|
});
|
|
285
294
|
};
|
|
286
|
-
$page.setParams = (
|
|
295
|
+
$page.setParams = (_params) => {
|
|
296
|
+
const params = Array.isArray(_params)
|
|
297
|
+
? _params.reduce((map, meta) => {
|
|
298
|
+
let { key, value } = meta;
|
|
299
|
+
if (key.startsWith('$page.')) {
|
|
300
|
+
key = key.replace(/^\$page\./, '');
|
|
301
|
+
}
|
|
302
|
+
map[key] = value;
|
|
303
|
+
return map;
|
|
304
|
+
}, {})
|
|
305
|
+
: _params;
|
|
306
|
+
|
|
287
307
|
Object.keys(params).forEach((keyPath) => {
|
|
288
308
|
app.utils.set($page.dataset?.params, keyPath, params[keyPath]);
|
|
289
309
|
});
|
|
File without changes
|
|
File without changes
|