@cloudbase/lowcode-builder 1.5.6 → 1.6.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.
- package/lib/builder/core/index.d.ts +1 -0
- package/lib/builder/core/index.js +6 -4
- package/lib/builder/h5/index.d.ts +4 -3
- package/lib/builder/h5/index.js +5 -2
- package/lib/builder/mp/BuildContext.d.ts +4 -0
- package/lib/builder/mp/index.d.ts +3 -3
- package/lib/builder/mp/index.js +13 -10
- package/lib/builder/mp/lowcode.js +4 -2
- package/lib/builder/mp/util.js +2 -2
- package/package.json +3 -3
- package/template/html/index.html.ejs +1 -1
- package/template/mp/app/weapps-api.js +1 -2
- package/template/mp/common/weapp-page.js +20 -0
- package/template/mp/package.json +15 -15
- package/template/mp/page/api.js +5 -2
- package/template/mp/page/index.js +1 -1
|
@@ -67,7 +67,9 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
67
67
|
console.error('无效的应用配置');
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
if (!deployOptions.mode) {
|
|
71
|
+
deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
|
|
72
|
+
}
|
|
71
73
|
let appBuildDir = (output === null || output === void 0 ? void 0 : output.path) || (runtime === types_1.RUNTIME.CI ? (_a = (0, util_1.getCompileDirs)('app')) === null || _a === void 0 ? void 0 : _a.appBuildDir : (_b = (0, util_1.getCompileDirs)(appKey)) === null || _b === void 0 ? void 0 : _b.appBuildDir);
|
|
72
74
|
const buildContext = {
|
|
73
75
|
projDir: appBuildDir,
|
|
@@ -138,7 +140,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
138
140
|
weapps: apps,
|
|
139
141
|
buildContext: mpBuildContext,
|
|
140
142
|
plugins,
|
|
141
|
-
|
|
143
|
+
deployOptions,
|
|
142
144
|
options: {
|
|
143
145
|
isCrossAccount: resourceAppId !== deployOptions.targetMpAppId,
|
|
144
146
|
mpAppId: deployOptions.mpAppId || '',
|
|
@@ -189,7 +191,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
189
191
|
mode,
|
|
190
192
|
devTool,
|
|
191
193
|
runtime,
|
|
192
|
-
|
|
194
|
+
deployOptions,
|
|
193
195
|
ignoreInstall,
|
|
194
196
|
cdnEndpoints,
|
|
195
197
|
});
|
|
@@ -331,5 +333,5 @@ function normalizeCals(cals, { buildTypeList, envId, deployOptions, appId, getWe
|
|
|
331
333
|
return cals;
|
|
332
334
|
}
|
|
333
335
|
function _getWebRootPath({ appId, deployOptions }) {
|
|
334
|
-
return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.
|
|
336
|
+
return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD ? `/${appId}/production/` : `/${appId}/preview/`;
|
|
335
337
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { II18nConfig, IExtraData } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
2
2
|
import { BuildType, WebpackModeType } from '../types/common';
|
|
3
|
-
import {
|
|
3
|
+
import { RUNTIME } from '../../types';
|
|
4
4
|
import { IPlatformApp } from '@cloudbase/cals';
|
|
5
5
|
import { ICDN_ENDPOINTS_COFIG } from '../config';
|
|
6
6
|
import { IBuildContext } from '../mp/BuildContext';
|
|
7
|
-
|
|
7
|
+
import { IBuildWedaApp } from '../core';
|
|
8
|
+
export declare function buildH5App({ buildContext, i18nConfig, extraData, cals, buildTypeList, subAppCalsList, mode, devTool, runtime, deployOptions, ignoreInstall, cdnEndpoints, }: {
|
|
8
9
|
buildContext: Omit<IBuildContext, 'mainAppData'>;
|
|
9
10
|
cals: IPlatformApp;
|
|
10
11
|
subAppCalsList: IPlatformApp[];
|
|
@@ -14,7 +15,7 @@ export declare function buildH5App({ buildContext, i18nConfig, extraData, cals,
|
|
|
14
15
|
mode: WebpackModeType;
|
|
15
16
|
devTool: string;
|
|
16
17
|
runtime?: RUNTIME;
|
|
17
|
-
|
|
18
|
+
deployOptions?: IBuildWedaApp['deployOptions'];
|
|
18
19
|
ignoreInstall?: boolean;
|
|
19
20
|
cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
|
|
20
21
|
}): Promise<string>;
|
package/lib/builder/h5/index.js
CHANGED
|
@@ -45,9 +45,12 @@ const config_1 = require("../config");
|
|
|
45
45
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
46
46
|
const junk = __importStar(require("../util/junk"));
|
|
47
47
|
const url_1 = require("url");
|
|
48
|
-
async function buildH5App({ buildContext, i18nConfig, extraData, cals, buildTypeList = [common_1.BuildType.WEB], subAppCalsList, mode, devTool, runtime = types_1.RUNTIME.NONE,
|
|
48
|
+
async function buildH5App({ buildContext, i18nConfig, extraData, cals, buildTypeList = [common_1.BuildType.WEB], subAppCalsList, mode, devTool, runtime = types_1.RUNTIME.NONE, deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, ignoreInstall = false, cdnEndpoints, }) {
|
|
49
49
|
var _a, _b, _c;
|
|
50
50
|
const { projDir: buildDir, domain, materialLibs: dependencies, appId: appKey, isPrivateMode } = buildContext;
|
|
51
|
+
if (!deployOptions.mode) {
|
|
52
|
+
deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
|
|
53
|
+
}
|
|
51
54
|
try {
|
|
52
55
|
const { materialsDir } = runtime === types_1.RUNTIME.CI ? (0, util_1.getCompileDirs)(appKey) : (0, util_1.getCompileDirs)('app');
|
|
53
56
|
const h5BuildDir = path_1.default.join(buildDir, 'h5');
|
|
@@ -111,7 +114,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals, buildType
|
|
|
111
114
|
buildTypeList,
|
|
112
115
|
isSandbox: false,
|
|
113
116
|
runtime,
|
|
114
|
-
|
|
117
|
+
deployOptions,
|
|
115
118
|
_indexPage,
|
|
116
119
|
isPrivateMode,
|
|
117
120
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IWeAppData, IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
2
2
|
import { IBuildContext } from './BuildContext';
|
|
3
|
-
import { DEPLOY_MODE } from '../../types';
|
|
4
3
|
import { BuildType, IAppUsedComp, IUsedComps } from '../types/common';
|
|
5
|
-
|
|
4
|
+
import { IBuildWedaApp } from '../core';
|
|
5
|
+
export declare function generateWxMp({ buildContext, weapps, plugins, deployOptions, options, buildTypeList, ignoreInstall, }: {
|
|
6
6
|
buildContext: IBuildContext;
|
|
7
7
|
weapps: IWeAppData[];
|
|
8
8
|
plugins: IPlugin[];
|
|
9
|
-
|
|
9
|
+
deployOptions: Required<IBuildWedaApp>['deployOptions'];
|
|
10
10
|
options: {
|
|
11
11
|
mpAppId: string;
|
|
12
12
|
resourceAppId?: string;
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -54,7 +54,7 @@ const cals_1 = require("@cloudbase/cals");
|
|
|
54
54
|
const templateDir = `${config_1.appTemplateDir}/mp/`;
|
|
55
55
|
const em = chalk_1.default.blue.bold;
|
|
56
56
|
const error = chalk_1.default.redBright;
|
|
57
|
-
async function generateWxMp({ buildContext, weapps, plugins,
|
|
57
|
+
async function generateWxMp({ buildContext, weapps, plugins, deployOptions, options, buildTypeList, ignoreInstall = false, }) {
|
|
58
58
|
var _a;
|
|
59
59
|
const { appId, projDir, materialLibs: materials, isProduction, mainAppData, domain, isPrivateMode = false, endpointType = '', isBrowserMpBuilder = false, } = buildContext;
|
|
60
60
|
const operationLabel = em('Wexin MiniProgram Generated');
|
|
@@ -83,11 +83,11 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
83
83
|
const projectConfigJsonPath = path_1.default.join(projDir, mainAppData.rootPath || '', 'project.config.json');
|
|
84
84
|
let projectConfigJson = await fs.readJSON(projectConfigJsonPath);
|
|
85
85
|
const miniprogramRoot = path_1.default.join(projDir, projectConfigJson.miniprogramRoot || '/');
|
|
86
|
-
await generateFramework(buildContext, mainAppData, miniprogramRoot);
|
|
86
|
+
await generateFramework(buildContext, mainAppData, miniprogramRoot, { deployOptions });
|
|
87
87
|
// #3 生成主包根路径文件
|
|
88
88
|
let appFileData = {};
|
|
89
89
|
if (weapps.find((item) => !item.mpPkgUrl)) {
|
|
90
|
-
await generateFramework(buildContext, mainAppData, miniprogramRoot);
|
|
90
|
+
await generateFramework(buildContext, mainAppData, miniprogramRoot, { deployOptions });
|
|
91
91
|
// 有了 framework app 之后,并且是源码的方式,追加 app 引用
|
|
92
92
|
if (mainAppData.mpPkgUrl) {
|
|
93
93
|
let appJsPath = path_1.default.join(miniprogramRoot, 'app.js');
|
|
@@ -181,7 +181,7 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
181
181
|
envID: mainAppData.envId,
|
|
182
182
|
appID: appId,
|
|
183
183
|
resourceAppid: !!options.isCrossAccount ? options.resourceAppId : '',
|
|
184
|
-
isProd:
|
|
184
|
+
isProd: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD,
|
|
185
185
|
clientID: (_a = mainAppData.extra) === null || _a === void 0 ? void 0 : _a.clientId,
|
|
186
186
|
},
|
|
187
187
|
'datasources/datasource-profiles.js.tpl': {
|
|
@@ -206,7 +206,7 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
206
206
|
rootPath: app.rootPath,
|
|
207
207
|
};
|
|
208
208
|
await generatePkg(subpackageBuildCtx, app, subpackageRootPath, pageConfigs[index]);
|
|
209
|
-
await generateFramework(subpackageBuildCtx, app, subpackageRootPath);
|
|
209
|
+
await generateFramework(subpackageBuildCtx, app, subpackageRootPath, { deployOptions });
|
|
210
210
|
// 生成package.json
|
|
211
211
|
let packageJsonPath = path_1.default.join(subpackageRootPath, 'package.json');
|
|
212
212
|
if (!fs.existsSync(packageJsonPath)) {
|
|
@@ -311,7 +311,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
311
311
|
console.log(`Generating ${em('page')} files`);
|
|
312
312
|
(0, generateFiles_1.cleanDir)(path_1.default.join(appRoot, 'pages'), []);
|
|
313
313
|
await Promise.all(weapp.pageInstanceList.map(async (page) => {
|
|
314
|
-
var _a, _b;
|
|
314
|
+
var _a, _b, _c, _d, _e, _f;
|
|
315
315
|
// # Generating page
|
|
316
316
|
const rootPath = weapp.rootPath || '';
|
|
317
317
|
const usingComponents = {};
|
|
@@ -331,11 +331,12 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
331
331
|
[`index.js|${pageFileName}.js`]: {
|
|
332
332
|
pageUUID: rootPath ? `${rootPath}/${page.id}` : page.id,
|
|
333
333
|
pageName: page.id,
|
|
334
|
+
pageTitle: ((_b = (_a = page === null || page === void 0 ? void 0 : page.data) === null || _a === void 0 ? void 0 : _a.navigationBarTitleText) === null || _b === void 0 ? void 0 : _b.value) || ((_d = (_c = page === null || page === void 0 ? void 0 : page.data) === null || _c === void 0 ? void 0 : _c.title) === null || _d === void 0 ? void 0 : _d.value),
|
|
334
335
|
pageSource: page.data.src || '',
|
|
335
336
|
eventHanlders: (0, util_2.createEventHanlders)(ctx, componentInstances, 'this', page),
|
|
336
337
|
dataBinds: (0, util_2.createDataBinds)(ctx, componentInstances),
|
|
337
338
|
pageAttributes: {
|
|
338
|
-
...(((
|
|
339
|
+
...(((_e = page.data) === null || _e === void 0 ? void 0 : _e.appShareMessage) ? { appShareMessage: page.data.appShareMessage.value } : {}),
|
|
339
340
|
},
|
|
340
341
|
debug: ctx.debugMode,
|
|
341
342
|
stringifyObj: util_1.inspect,
|
|
@@ -351,7 +352,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
351
352
|
content: wxml,
|
|
352
353
|
},
|
|
353
354
|
[`index.wxss|${pageFileName}.wxss`]: {
|
|
354
|
-
subWxss: rootPath && !((
|
|
355
|
+
subWxss: rootPath && !((_f = ctx.mainAppData) === null || _f === void 0 ? void 0 : _f.mpPkgUrl)
|
|
355
356
|
? `@import "${path_1.default.posix.relative(`/${rootPath}/pages/${page.id}`, '/lowcode')}/style.wxss";`
|
|
356
357
|
: '',
|
|
357
358
|
content: (0, weapps_core_1.toCssText)((0, cals_1.processCommonStyle2CSSProperties)(page.commonStyle, {
|
|
@@ -367,7 +368,8 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
367
368
|
await writeLowCodeFiles(ctx, weapp, appRoot);
|
|
368
369
|
}
|
|
369
370
|
}
|
|
370
|
-
async function generateFramework(ctx, appData, outDir) {
|
|
371
|
+
async function generateFramework(ctx, appData, outDir, options) {
|
|
372
|
+
var _a;
|
|
371
373
|
let fileData = {};
|
|
372
374
|
if (appData.mpPkgUrl) {
|
|
373
375
|
if (!appData.rootPath) {
|
|
@@ -403,12 +405,13 @@ async function generateFramework(ctx, appData, outDir) {
|
|
|
403
405
|
...fileData,
|
|
404
406
|
'app/app-global.js': {},
|
|
405
407
|
'app/weapps-api.js': {
|
|
406
|
-
appId: ctx.appId,
|
|
407
408
|
subLevelPath: appData.rootPath ? `${path_1.default.posix.relative(`${appData.rootPath}`, '')}/` : '',
|
|
408
409
|
subPackageName: appData.rootPath || '',
|
|
409
410
|
importor,
|
|
410
411
|
appConfig: (0, util_3.JsonToStringWithVariableName)({
|
|
411
412
|
id: ctx.appId,
|
|
413
|
+
label: (appData === null || appData === void 0 ? void 0 : appData.label) || '',
|
|
414
|
+
version: (_a = options === null || options === void 0 ? void 0 : options.deployOptions) === null || _a === void 0 ? void 0 : _a.version,
|
|
412
415
|
envId: appData.envId,
|
|
413
416
|
envVersion: (ctx === null || ctx === void 0 ? void 0 : ctx.isProduction) ? 'production' : 'preview',
|
|
414
417
|
pages: appData.pageInstanceList
|
|
@@ -19,9 +19,11 @@ async function writeCode2file(ctx, mod, lowcodeRootDir, opts = {}, themeCode) {
|
|
|
19
19
|
const baseDir = path_1.default.relative(path_1.default.dirname(file), appDir).replace(/\\/g, '/');
|
|
20
20
|
// 子包混合模式需要添加相对索引到根目录
|
|
21
21
|
const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? `${path_1.default.relative(ctx.rootPath, '')}/` : '';
|
|
22
|
-
let weappsApiPrefix = [
|
|
22
|
+
let weappsApiPrefix = [
|
|
23
|
+
`import { app, $app${pageId !== 'global' ? '' : ', $w'} } from '${relativeRoot}${baseDir}/app/weapps-api';`,
|
|
24
|
+
]; // windows compatibility
|
|
23
25
|
if (pageId !== 'global') {
|
|
24
|
-
weappsApiPrefix.push(`import { $page } from '${baseDir}/pages/${pageId}/api'
|
|
26
|
+
weappsApiPrefix.push(`import { $page, $w } from '${baseDir}/pages/${pageId}/api';`);
|
|
25
27
|
}
|
|
26
28
|
code = `${weappsApiPrefix.join('\n')}\n${code}`;
|
|
27
29
|
}
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -299,7 +299,7 @@ function createDataBinds(ctx, widgets) {
|
|
|
299
299
|
}
|
|
300
300
|
if (style) {
|
|
301
301
|
const styleExpression = _waDisplay
|
|
302
|
-
? `{...widgetProps.${id}.style, ...(\n${style === null || style === void 0 ? void 0 : style.expression}\n)
|
|
302
|
+
? `((display)=>{ const style = {...widgetProps.${id}.style, ...(\n${style === null || style === void 0 ? void 0 : style.expression}\n)}; if(!display) {style.display = "none"}; return style })((()=>{${_waDisplay === null || _waDisplay === void 0 ? void 0 : _waDisplay.imports}\n return (\n${_waDisplay === null || _waDisplay === void 0 ? void 0 : _waDisplay.expression}\n)})())`
|
|
303
303
|
: `{...widgetProps.${id}.style, ...(\n${style === null || style === void 0 ? void 0 : style.expression}\n)}`;
|
|
304
304
|
dataBinds[id].style = {
|
|
305
305
|
...style,
|
|
@@ -307,7 +307,7 @@ function createDataBinds(ctx, widgets) {
|
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
else if (_waDisplay) {
|
|
310
|
-
const styleExpression = `{...widgetProps.${id}.style
|
|
310
|
+
const styleExpression = `((display)=>{ const style = {...widgetProps.${id}.style}; if(!display) {style.display = "none"}; return style })((\n${_waDisplay === null || _waDisplay === void 0 ? void 0 : _waDisplay.expression}\n))`;
|
|
311
311
|
dataBinds[id].style = {
|
|
312
312
|
..._waDisplay,
|
|
313
313
|
expression: processCssUnit === 'rpx' ? `px2rpx(${styleExpression})` : styleExpression,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
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",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cloudbase/cals": "^0.
|
|
42
|
-
"@cloudbase/lowcode-generator": "^1.
|
|
41
|
+
"@cloudbase/cals": "^1.0.2",
|
|
42
|
+
"@cloudbase/lowcode-generator": "^1.6.3",
|
|
43
43
|
"axios": "^0.21.0",
|
|
44
44
|
"browserfs": "^1.4.3",
|
|
45
45
|
"browserify-zlib": "^0.2.0",
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
crossorigin
|
|
544
544
|
src="<%=
|
|
545
545
|
cdnEndpoints.cdngo
|
|
546
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
546
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.750df8ba8cd4da81b585.bundle.js"
|
|
547
547
|
></script>
|
|
548
548
|
</body>
|
|
549
549
|
</html>
|
|
@@ -11,12 +11,14 @@ import {
|
|
|
11
11
|
} from '../datasources/index';
|
|
12
12
|
import { runWatchers } from './watch';
|
|
13
13
|
import { getMpEventHandlerName } from './util';
|
|
14
|
+
import { $w as baseAPI } from '../app/app-global';
|
|
14
15
|
|
|
15
16
|
const wxApp = getApp()
|
|
16
17
|
|
|
17
18
|
export function createPage(
|
|
18
19
|
id,
|
|
19
20
|
uuid,
|
|
21
|
+
title,
|
|
20
22
|
widgetProps,
|
|
21
23
|
index = {},
|
|
22
24
|
lifecycle,
|
|
@@ -63,6 +65,22 @@ export function createPage(
|
|
|
63
65
|
return {};
|
|
64
66
|
}
|
|
65
67
|
};
|
|
68
|
+
|
|
69
|
+
// 更新设备信息 窗口信息
|
|
70
|
+
result['onResize'] = (res) => {
|
|
71
|
+
let device = baseAPI.device;
|
|
72
|
+
if(!device) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
const width = res?.size?.windowWidth;
|
|
76
|
+
const height = res?.size?.windowHeight;
|
|
77
|
+
if (width !== device?.viewport?.width || height !== device?.viewport?.height) {
|
|
78
|
+
device.viewport = {
|
|
79
|
+
width,
|
|
80
|
+
height
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
66
84
|
return result;
|
|
67
85
|
}
|
|
68
86
|
|
|
@@ -197,6 +215,8 @@ export function createPage(
|
|
|
197
215
|
id,
|
|
198
216
|
uuid,
|
|
199
217
|
state: observable(pageState),
|
|
218
|
+
path: this.route,
|
|
219
|
+
label: title,
|
|
200
220
|
widgets: {},
|
|
201
221
|
});
|
|
202
222
|
$page = pageContext;
|
package/template/mp/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"@cloudbase/js-sdk": "2.5.6-beta.1",<%
|
|
2
|
+
"name": "lcap-<%= appId%>",
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"scripts": {},
|
|
5
|
+
"dependencies": {<% if(importJSSDK) {%>
|
|
6
|
+
"@cloudbase/js-sdk": "2.5.6-beta.1",<%
|
|
7
|
+
} %>
|
|
7
8
|
"@cloudbase/oauth": "0.1.1-alpha.5",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
"@cloudbase/weda-client": "1.0.0",
|
|
10
|
+
"@cloudbase/weda-cloud-sdk": "1.0.26",
|
|
11
|
+
"mobx": "^5.15.4",
|
|
12
|
+
"lodash.get": "^4.4.2",
|
|
13
|
+
"lodash.set": "^4.3.2",
|
|
14
|
+
"miniprogram-gesture": "^1.0.6",
|
|
15
|
+
"miniprogram-api-promise": "^1.0.4"<% Object.keys(extraDeps).map(depName => {%>,
|
|
16
|
+
"<%= depName%>": "<%= extraDeps[depName]%>"<%
|
|
16
17
|
})%>
|
|
17
|
-
|
|
18
|
+
}
|
|
18
19
|
}
|
|
19
|
-
|
package/template/mp/page/api.js
CHANGED
|
@@ -8,8 +8,11 @@ export const $w = new Proxy(
|
|
|
8
8
|
baseAPI,
|
|
9
9
|
{
|
|
10
10
|
get(target, prop) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* 使用当前实例进行覆盖
|
|
13
|
+
*/
|
|
14
|
+
if (prop === '$page' || prop === 'page') {
|
|
15
|
+
return $page;
|
|
13
16
|
}
|
|
14
17
|
// 尝试代理页面级别组件实例
|
|
15
18
|
const pageWidget = $page.widgets?.[prop];
|
|
@@ -33,4 +33,4 @@ const dataBinds = {<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
|
|
|
33
33
|
},<%}) %>
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
createPage('<%= pageName %>', '<%= pageUUID %>', widgetProps, {}, lifecyle, state, computed, evtListeners, dataBinds, app, handlers, $page, <%= pageAttributes?JSON.stringify(pageAttributes):'{}' %>)
|
|
36
|
+
createPage('<%= pageName %>', '<%= pageUUID %>','<%= pageTitle %>', widgetProps, {}, lifecyle, state, computed, evtListeners, dataBinds, app, handlers, $page, <%= pageAttributes?JSON.stringify(pageAttributes):'{}' %>)
|