@cloudbase/lowcode-builder 1.8.99 → 1.8.101
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/index.d.ts +4 -0
- package/lib/builder/config/index.js +8 -1
- package/lib/builder/core/index.d.ts +2 -1
- package/lib/builder/core/index.js +15 -4
- package/lib/builder/h5/index.js +2 -1
- package/lib/builder/mp/BuildContext.d.ts +5 -0
- package/lib/builder/mp/index.js +47 -28
- package/lib/builder.web.js +8 -8
- package/package.json +3 -3
- package/template/html/index.html.ejs +1 -1
- package/template/mp/app/weapps-api.js +2 -0
- package/template/mp/common/weapp-page.js +61 -21
- package/template/mp/datasources/config.js.tpl +7 -1
- package/template/mp/package.json +1 -1
- package/template/mp/packages/$wd_system/index.js.tpl +2 -1
- package/template/mp/packages/$wd_system/package.json +7 -3
- package/template/mp/packages/$wd_system/privatelink/cloudbase.privatelink.vender.js +2 -0
- package/template/mp/packages/$wd_system/privatelink/cloudbase.privatelink.vm.js +1 -0
- package/template/mp/packages/$wd_system/privatelink/index.js +19 -0
- package/template/mp/packages/$wd_system/privatelink/pollyfill.js +36 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.101",
|
|
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,8 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/core": "7.21.4",
|
|
49
49
|
"@babel/preset-env": "7.21.4",
|
|
50
|
-
"@cloudbase/cals": "^1.0.
|
|
51
|
-
"@cloudbase/lowcode-generator": "^1.8.
|
|
50
|
+
"@cloudbase/cals": "^1.0.81",
|
|
51
|
+
"@cloudbase/lowcode-generator": "^1.8.30",
|
|
52
52
|
"axios": "^0.21.0",
|
|
53
53
|
"browserfs": "^1.4.3",
|
|
54
54
|
"browserify-zlib": "^0.2.0",
|
|
@@ -549,7 +549,7 @@
|
|
|
549
549
|
crossorigin
|
|
550
550
|
src="<%=
|
|
551
551
|
cdnEndpoints.cdngo
|
|
552
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
552
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.3699f460d2b6314f711e.bundle.js"
|
|
553
553
|
></script>
|
|
554
554
|
</body>
|
|
555
555
|
</html>
|
|
@@ -6,6 +6,7 @@ import { createComputed, formatEnum, enumOptions } from '<%= subLevelPath %>../c
|
|
|
6
6
|
import { generateDatasetQuery } from '<%= subLevelPath %>../common/query'
|
|
7
7
|
|
|
8
8
|
import appGlobal from '<%= subLevelPath %>../app/app-global'
|
|
9
|
+
import { default as cloudConfig } from '<%= subLevelPath %>../datasources/config'
|
|
9
10
|
import { createDataset } from '<%= subLevelPath %>../common/cloud-sdk'
|
|
10
11
|
|
|
11
12
|
import lodashGet from 'lodash.get';
|
|
@@ -87,6 +88,7 @@ function createGlboalApi() {
|
|
|
87
88
|
const mpApp = createMpApp({
|
|
88
89
|
appConfig: {
|
|
89
90
|
staticResourceDomain: config.domain,
|
|
91
|
+
privatelink: cloudConfig.privatelink,
|
|
90
92
|
...(<%= appConfig %>)
|
|
91
93
|
},
|
|
92
94
|
});
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
setConfig,
|
|
20
20
|
} from './cloud-sdk';
|
|
21
21
|
import { runWatchers, watchAndSyncDatasetState2Local } from './watch';
|
|
22
|
-
import { getWedaAPI } from '@cloudbase/weda-client';
|
|
22
|
+
import { getWedaAPI, urlJoinParams } from '@cloudbase/weda-client';
|
|
23
23
|
import { Event } from './event-emitter';
|
|
24
24
|
import { mergeDynamic2StaticData, patchWdigetPropsWithEvtListeners } from './util';
|
|
25
25
|
import { styleToCss } from './style';
|
|
@@ -28,7 +28,32 @@ export const PAGE_ROOT_SYMBOL = Symbol('@@page_route@@')
|
|
|
28
28
|
|
|
29
29
|
const wxApp = getApp();
|
|
30
30
|
|
|
31
|
-
function
|
|
31
|
+
function resolveParticialPageData(ctx, key, data = {}, dataBinds = {}) {
|
|
32
|
+
const reg = new RegExp(`^${key}`)
|
|
33
|
+
let merge = { [key]: data[key] }
|
|
34
|
+
const pickedDataBinds = {}
|
|
35
|
+
for (const key in dataBinds) {
|
|
36
|
+
if (reg.test(key)) {
|
|
37
|
+
pickedDataBinds[key] = dataBinds[key]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
merge = mergeDynamic2StaticData(merge, pickedDataBinds, {
|
|
42
|
+
codeContext: {
|
|
43
|
+
/**
|
|
44
|
+
* $page 或 $comp 实例
|
|
45
|
+
*/
|
|
46
|
+
instance: ctx.app?.__internal__?.activePage,
|
|
47
|
+
},
|
|
48
|
+
$w: ctx.app?.__internal__?.activePage?.__internal__?.$w,
|
|
49
|
+
})
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.warn('分享设置绑定计算错误:', e)
|
|
52
|
+
}
|
|
53
|
+
return merge
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function extractLifecycles(ctx, lifecycle, appShareMessage, shareTimeline, dataBinds, resetShare = true) {
|
|
32
57
|
const result = {};
|
|
33
58
|
Object.keys(lifecycle).map((name) => {
|
|
34
59
|
result[name] = function () {
|
|
@@ -41,20 +66,7 @@ function extractLifecycles(ctx, lifecycle, appShareMessage, dataBinds, resetShar
|
|
|
41
66
|
if (res?.from === 'button' && res?.target?.dataset?.weda_share_info) {
|
|
42
67
|
return res?.target?.dataset?.weda_share_info;
|
|
43
68
|
} else if (res?.from === 'menu' && appShareMessage?.enable) {
|
|
44
|
-
let mergedData = { appShareMessage }
|
|
45
|
-
try {
|
|
46
|
-
mergedData = mergeDynamic2StaticData({ appShareMessage }, dataBinds, {
|
|
47
|
-
codeContext: {
|
|
48
|
-
/**
|
|
49
|
-
* $page 或 $comp 实例
|
|
50
|
-
*/
|
|
51
|
-
instance: ctx.app?.__internal__?.activePage,
|
|
52
|
-
},
|
|
53
|
-
$w: ctx.app?.__internal__?.activePage?.__internal__?.$w,
|
|
54
|
-
})
|
|
55
|
-
} catch(e) {
|
|
56
|
-
console.warn('分享设置绑定计算错误:', e)
|
|
57
|
-
}
|
|
69
|
+
let mergedData = resolveParticialPageData(ctx, 'appShareMessage', { appShareMessage }, dataBinds);
|
|
58
70
|
|
|
59
71
|
let { pageId, params, imageUrl, title, packageName } = mergedData.appShareMessage || {};
|
|
60
72
|
const url = ctx.app?.__internal__?.generatePageUrl({
|
|
@@ -80,6 +92,32 @@ function extractLifecycles(ctx, lifecycle, appShareMessage, dataBinds, resetShar
|
|
|
80
92
|
};
|
|
81
93
|
}
|
|
82
94
|
|
|
95
|
+
if (shareTimeline?.enable || lifecycle?.['onShareTimeline']) {
|
|
96
|
+
result['onShareTimeline'] = () => {
|
|
97
|
+
if (shareTimeline?.enable) {
|
|
98
|
+
let mergedData = resolveParticialPageData(ctx, 'shareTimeline', { shareTimeline }, dataBinds);
|
|
99
|
+
|
|
100
|
+
let { params, imageUrl, title } = mergedData.shareTimeline || {};
|
|
101
|
+
const query = urlJoinParams('/fake', Array.isArray(params) ? params.reduce((map, { key, value }) => {
|
|
102
|
+
map[key] = value
|
|
103
|
+
return map
|
|
104
|
+
}, {}) : params).replace(/^\/fake\?/, '')
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
query,
|
|
108
|
+
imageUrl: ctx.app?.__internal__?.resolveStaticResourceUrl?.(imageUrl) || imageUrl,
|
|
109
|
+
title,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
return lifecycle?.['onShareTimeline']?.() || {};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.log(error);
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
83
121
|
// 更新设备信息 窗口信息
|
|
84
122
|
result['onResize'] = (res) => {
|
|
85
123
|
const { $w } = getWedaAPI()
|
|
@@ -143,11 +181,13 @@ export function createPage({
|
|
|
143
181
|
attached() {
|
|
144
182
|
this._disposers = [];
|
|
145
183
|
const $page = this._getInstance();
|
|
146
|
-
const instance = $page.__internal__.mpInstance?.()
|
|
184
|
+
const instance = $page.__internal__.mpInstance?.(true)
|
|
147
185
|
if( instance !== this ){
|
|
148
186
|
const currentMpInstance = this
|
|
149
|
-
$page.__internal__.mpInstance = () => {
|
|
150
|
-
|
|
187
|
+
$page.__internal__.mpInstance = (disableLog) => {
|
|
188
|
+
if (!disableLog) {
|
|
189
|
+
console.warn('debug 获取当前 mp page 实例,禁止在生产环境使用');
|
|
190
|
+
}
|
|
151
191
|
return currentMpInstance
|
|
152
192
|
}
|
|
153
193
|
}
|
|
@@ -205,7 +245,7 @@ export function createPage({
|
|
|
205
245
|
},
|
|
206
246
|
detached() {
|
|
207
247
|
const $page = this._getInstance();
|
|
208
|
-
const instance = $page.__internal__.mpInstance?.()
|
|
248
|
+
const instance = $page.__internal__.mpInstance?.(true)
|
|
209
249
|
if( instance === this ){
|
|
210
250
|
$page.__internal__.mpInstance = () => null
|
|
211
251
|
}
|
|
@@ -228,7 +268,7 @@ export function createPage({
|
|
|
228
268
|
_disposers: [],
|
|
229
269
|
|
|
230
270
|
/** page lifecycles **/
|
|
231
|
-
...extractLifecycles({ app }, lifecycle, pageAttributes?.appShareMessage, pageRootDataBinds, resetShare),
|
|
271
|
+
...extractLifecycles({ app }, lifecycle, pageAttributes?.appShareMessage, pageAttributes?.shareTimeline, pageRootDataBinds, resetShare),
|
|
232
272
|
...evtHandlers,
|
|
233
273
|
...mergeRenderer,
|
|
234
274
|
async beforePageCustomLaunch(query) {
|
|
@@ -35,7 +35,13 @@ const CLOUD_CONFIG = {
|
|
|
35
35
|
/**
|
|
36
36
|
* 是否是处于私有化版本
|
|
37
37
|
*/
|
|
38
|
-
isPrivate: config.isPrivate
|
|
38
|
+
isPrivate: config.isPrivate,
|
|
39
|
+
privatelink: <%= privatelink || 'undefined' %>,
|
|
40
|
+
getPrivatelinkAdapter: async function() {
|
|
41
|
+
return require.async('../packages/$wd_system/index.js').then(({ tcbPrivatelinkAdapter }) => {
|
|
42
|
+
return tcbPrivatelinkAdapter
|
|
43
|
+
})
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
export default CLOUD_CONFIG
|
package/template/mp/package.json
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
"name": "wd-system-sub-package",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"scripts": {},
|
|
5
|
-
"dependencies":
|
|
6
|
-
"aegis-mp-sdk": "~1.38.1"
|
|
7
|
-
|
|
5
|
+
"dependencies": <%= JSON.stringify({
|
|
6
|
+
...(cdnEndpoints.aegis && { "aegis-mp-sdk": "~1.38.1" }),
|
|
7
|
+
...(privatelink && {
|
|
8
|
+
"polyfill-crypto.getrandomvalues": "^1.0.0",
|
|
9
|
+
"cloudbase-adapter-privatelink": "0.0.1"
|
|
10
|
+
}),
|
|
11
|
+
}, undefined, 2) %>
|
|
8
12
|
}
|