@cloudbase/lowcode-builder 1.8.109 → 1.9.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/builder/config/dependencies.d.ts +2 -1
- package/lib/builder/config/dependencies.js +8 -6
- package/lib/builder/core/index.js +3 -2
- package/lib/builder/mp/index.js +10 -2
- package/lib/builder/mp/materials.js +2 -2
- package/lib/builder/mp/util.js +3 -3
- package/lib/builder/mp/wxml.js +1 -1
- package/lib/builder.web.js +7 -7
- package/lib/utils/transform.js +40 -32
- package/package.json +4 -4
- package/template/html/index.html.ejs +3 -3
- package/template/mp/packages/$wd_system/pages/login/index.wxml +5 -5
package/lib/utils/transform.js
CHANGED
|
@@ -4,8 +4,38 @@ 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, _b, _c;
|
|
7
|
+
var _a, _b, _c, _d, _e;
|
|
8
8
|
const { IIFE = false } = options;
|
|
9
|
+
const funTransformParams = {
|
|
10
|
+
cwd: __dirname,
|
|
11
|
+
sourceType: 'script',
|
|
12
|
+
comments: false,
|
|
13
|
+
// minified: true,
|
|
14
|
+
presets: [
|
|
15
|
+
[
|
|
16
|
+
'@babel/preset-env',
|
|
17
|
+
{
|
|
18
|
+
targets: {
|
|
19
|
+
/**
|
|
20
|
+
* 支持 proxy 的版本
|
|
21
|
+
* 低于这个版本完全无法支持
|
|
22
|
+
*/
|
|
23
|
+
// browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
|
|
24
|
+
/**
|
|
25
|
+
* 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
|
|
26
|
+
* 但是不包涵 options chain
|
|
27
|
+
* 基本上是 es2019
|
|
28
|
+
*/
|
|
29
|
+
browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
|
|
30
|
+
},
|
|
31
|
+
include: [
|
|
32
|
+
// es2015
|
|
33
|
+
'@babel/plugin-transform-arrow-functions',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
],
|
|
38
|
+
};
|
|
9
39
|
/**
|
|
10
40
|
* 如果 trim 完为空
|
|
11
41
|
* 则原样不用再编译了
|
|
@@ -25,37 +55,15 @@ function BabelTransform(code, options = {}) {
|
|
|
25
55
|
catch (e) { }
|
|
26
56
|
try {
|
|
27
57
|
const simpleWrapped = `(\n${code || 'undefined'}\n)`;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
targets: {
|
|
38
|
-
/**
|
|
39
|
-
* 支持 proxy 的版本
|
|
40
|
-
* 低于这个版本完全无法支持
|
|
41
|
-
*/
|
|
42
|
-
// browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
|
|
43
|
-
/**
|
|
44
|
-
* 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
|
|
45
|
-
* 但是不包涵 options chain
|
|
46
|
-
* 基本上是 es2019
|
|
47
|
-
*/
|
|
48
|
-
browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
|
|
49
|
-
},
|
|
50
|
-
include: [
|
|
51
|
-
// es2015
|
|
52
|
-
'@babel/plugin-transform-arrow-functions',
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
],
|
|
57
|
-
}) || {};
|
|
58
|
-
const res = ((_c = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _c === void 0 ? void 0 : _c.call(expression, /;$/, '')) || code;
|
|
58
|
+
let { code: expression } = (0, core_1.transformSync)(simpleWrapped, funTransformParams) || {};
|
|
59
|
+
let res = (_c = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _c === void 0 ? void 0 : _c.call(expression, /;(\s*)$/g, '');
|
|
60
|
+
const formatPattern = /^\(|\)$|\n|\s/g;
|
|
61
|
+
const formatRes = res === null || res === void 0 ? void 0 : res.replace(formatPattern, '');
|
|
62
|
+
const formatCode = code === null || code === void 0 ? void 0 : code.replace(formatPattern, '');
|
|
63
|
+
if (formatRes !== formatCode && IIFE) {
|
|
64
|
+
expression = (_d = ((0, core_1.transformSync)(`(()=>${simpleWrapped})()`, funTransformParams) || {})) === null || _d === void 0 ? void 0 : _d.code;
|
|
65
|
+
res = ((_e = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _e === void 0 ? void 0 : _e.call(expression, /;$/, '')) || code;
|
|
66
|
+
}
|
|
59
67
|
if (expression) {
|
|
60
68
|
new Function(`return (\n${res}\n)`);
|
|
61
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/core": "7.21.4",
|
|
49
49
|
"@babel/preset-env": "7.21.4",
|
|
50
|
-
"@cloudbase/cals": "^1.1.
|
|
50
|
+
"@cloudbase/cals": "^1.1.11",
|
|
51
51
|
"@cloudbase/lowcode-generator": "^1.8.34",
|
|
52
52
|
"axios": "^0.21.0",
|
|
53
53
|
"browserfs": "^1.4.3",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/lodash.get": "^4.4.6",
|
|
77
77
|
"@types/lodash.template": "^4.5.0",
|
|
78
78
|
"@types/node": "^13.9.8",
|
|
79
|
-
"@types/react": "
|
|
79
|
+
"@types/react": "17.0.45",
|
|
80
80
|
"@types/webpack": "^4.41.22",
|
|
81
81
|
"@types/weixin-app": "^2.9.0",
|
|
82
82
|
"cross-env": "^7.0.3",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"ts-loader": "^8.3.0",
|
|
85
85
|
"ts-node": "^10.4.0",
|
|
86
86
|
"tsc-watch": "^6.0.4",
|
|
87
|
-
"typescript": "
|
|
87
|
+
"typescript": "4.7.4",
|
|
88
88
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
89
89
|
"webpack-cli": "^4.9.1",
|
|
90
90
|
"webpack-dev-server": "^4.7.3",
|
|
@@ -458,7 +458,7 @@
|
|
|
458
458
|
<script type="module" src="/src/index.jsx"></script>
|
|
459
459
|
<% } %> <% if(!isAdminPortal){ %>
|
|
460
460
|
<script src="<%= wedaPrivateConfigEndpoint ? wedaPrivateConfigEndpoint : '' %>/weda-config/weda-private.js"></script>
|
|
461
|
-
<script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.5.
|
|
461
|
+
<script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.5.46-beta.0/cloudbase.full.js?v=1"></script>
|
|
462
462
|
<script
|
|
463
463
|
crossorigin
|
|
464
464
|
src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/cloudbase-adapter-privatelink@0.0.2/dist/index.js"
|
|
@@ -522,7 +522,7 @@
|
|
|
522
522
|
crossorigin="anonymous"
|
|
523
523
|
src="<%=
|
|
524
524
|
cdnEndpoints.cdngo
|
|
525
|
-
%>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.
|
|
525
|
+
%>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.67/dist/h5.browser.js"
|
|
526
526
|
></script>
|
|
527
527
|
<script
|
|
528
528
|
crossorigin
|
|
@@ -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.6a48660bec73516bd718.bundle.js"
|
|
555
555
|
></script>
|
|
556
556
|
</body>
|
|
557
557
|
</html>
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
</view>
|
|
64
64
|
</view>
|
|
65
65
|
</view>
|
|
66
|
-
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);text-align:center;
|
|
67
|
-
|
|
66
|
+
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);text-align:center;" wx:if="{{settingData.agreement.items[0].enable}}" data-index="0" bind:tap="showAgreement">
|
|
67
|
+
<text>《{{settingData.agreement.items[0].label}}》</text>
|
|
68
68
|
</text>
|
|
69
69
|
<text style="white-space: pre-warp; display:flex;align-items:center;white-space:pre-line;" class="weda-text weda-ui" wx:if="{{settingData.agreement.items[0].enable && settingData.agreement.items[1].enable}}">
|
|
70
|
-
|
|
70
|
+
<text>和</text>
|
|
71
71
|
</text>
|
|
72
|
-
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);
|
|
73
|
-
|
|
72
|
+
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);" data-index="1" wx:if="{{settingData.agreement.items[1].enable}}" bind:tap="showAgreement">
|
|
73
|
+
<text>《{{settingData.agreement.items[1].label}}》</text>
|
|
74
74
|
</text>
|
|
75
75
|
</view>
|
|
76
76
|
</view>
|