@cloudbase/lowcode-builder 1.9.2 → 1.9.3
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.js +1 -1
- package/lib/builder/core/index.d.ts +2 -1
- package/lib/builder/core/index.js +4 -3
- package/lib/builder/mp/BuildContext.d.ts +5 -0
- package/lib/builder/mp/index.js +1 -2
- package/lib/builder/mp/util.js +4 -3
- package/lib/builder.web.js +2 -2
- package/package.json +2 -2
- package/template/html/index.html.ejs +1 -1
- package/template/mp/app/weapps-api.js +2 -0
- package/template/mp/common/util.js +0 -5
- package/template/mp/datasources/config.js.tpl +2 -1
|
@@ -14,7 +14,7 @@ const BASE_DEPS = {
|
|
|
14
14
|
const CLOUDBASE_DEPS = {
|
|
15
15
|
'@cloudbase/oauth': '0.1.1-alpha.15',
|
|
16
16
|
'@cloudbase/weda-client': '1.1.6',
|
|
17
|
-
'@cloudbase/weda-cloud-sdk': '1.0.
|
|
17
|
+
'@cloudbase/weda-cloud-sdk': '1.0.76',
|
|
18
18
|
};
|
|
19
19
|
function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, uin, }) {
|
|
20
20
|
const deps = {};
|
|
@@ -54,6 +54,7 @@ export interface IBuildWedaApp extends IBaseAppProps {
|
|
|
54
54
|
projectConfigJson?: Record<string, any>;
|
|
55
55
|
};
|
|
56
56
|
privatelinkConfig?: Record<string, any>;
|
|
57
|
+
__defaultLoginType__?: 'openId' | 'anonymous';
|
|
57
58
|
}
|
|
58
59
|
export declare function buildWedaConfig({ output, domain, isPrivateMode, endpointType, buildTypeList, }: {
|
|
59
60
|
output: Required<IBuildWedaApp['output']>;
|
|
@@ -62,7 +63,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
|
|
|
62
63
|
endpointType?: IBuildWedaApp['endpointType'];
|
|
63
64
|
buildTypeList?: IBuildWedaApp['buildTypeList'];
|
|
64
65
|
}): Promise<void>;
|
|
65
|
-
export declare function buildWedaApp({ cals, subAppCalsList: _subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions,
|
|
66
|
+
export declare function buildWedaApp({ cals, subAppCalsList: _subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints: _cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, enableAd, account, mpConfig, privatelinkConfig, __defaultLoginType__, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
66
67
|
export declare function cleanComponentDir(): Promise<void>;
|
|
67
68
|
export declare const version: any;
|
|
68
69
|
export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
|
|
@@ -58,10 +58,10 @@ async function buildWedaConfig({ output, domain = undefined, isPrivateMode = und
|
|
|
58
58
|
await (0, index_1.generateConfig)(data, outDir);
|
|
59
59
|
}
|
|
60
60
|
exports.buildWedaConfig = buildWedaConfig;
|
|
61
|
-
async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW },
|
|
61
|
+
async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, plugins = [], extraData = {
|
|
62
62
|
isComposite: false,
|
|
63
63
|
compProps: {},
|
|
64
|
-
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints: _cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, privatelinkConfig = undefined, }, cb) {
|
|
64
|
+
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints: _cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, privatelinkConfig = undefined, __defaultLoginType__ = 'anonymous', }, cb) {
|
|
65
65
|
var _a, _b, _c, _d, _e, _f;
|
|
66
66
|
const cdnEndpoints = (0, config_1.generateCdnEndpoints)(_cdnEndpoints);
|
|
67
67
|
if (!cals) {
|
|
@@ -191,12 +191,13 @@ async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], depend
|
|
|
191
191
|
enableLoading: (_e = cals === null || cals === void 0 ? void 0 : cals.extra) === null || _e === void 0 ? void 0 : _e.enableLoading,
|
|
192
192
|
enableAsyncMaterials: (_f = cals.extra) === null || _f === void 0 ? void 0 : _f.enableAsyncMaterials,
|
|
193
193
|
disablePageComponentInvoke,
|
|
194
|
+
__defaultLoginType__,
|
|
194
195
|
// enableAsyncMaterials: true,
|
|
195
196
|
};
|
|
196
197
|
const result = await (0, index_1.generateWxMp)({
|
|
198
|
+
buildContext: mpBuildContext,
|
|
197
199
|
weapps: apps,
|
|
198
200
|
calses,
|
|
199
|
-
buildContext: mpBuildContext,
|
|
200
201
|
plugins,
|
|
201
202
|
deployOptions,
|
|
202
203
|
options: {
|
|
@@ -109,4 +109,9 @@ export interface IBuildContext extends IAppCommonBuildContext, IMpCommonBuildCon
|
|
|
109
109
|
* app.json文件window配置
|
|
110
110
|
*/
|
|
111
111
|
defaultAppWindowConfig?: IDefaultAppWindowConfig;
|
|
112
|
+
/**
|
|
113
|
+
* 内部定义,请勿使用
|
|
114
|
+
* 如必须使用 @rohyang
|
|
115
|
+
*/
|
|
116
|
+
__defaultLoginType__?: 'openId' | 'anonymous';
|
|
112
117
|
}
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -243,6 +243,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
243
243
|
privatelink: buildContext.privatelinkConfig
|
|
244
244
|
? JSON.stringify(buildContext.privatelinkConfig, undefined, 2)
|
|
245
245
|
: undefined,
|
|
246
|
+
defaultLoginType: buildContext.__defaultLoginType__,
|
|
246
247
|
},
|
|
247
248
|
'datasources/datasource-profiles.js.tpl': {
|
|
248
249
|
datasourceProfiles: (0, util_3.JsonToStringWithVariableName)([], { EOL: false }),
|
|
@@ -672,10 +673,8 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
|
|
|
672
673
|
subPackageName: appData.rootPath || '',
|
|
673
674
|
importor,
|
|
674
675
|
appConfig: (0, util_3.JsonToStringWithVariableName)({
|
|
675
|
-
id: ctx.appId,
|
|
676
676
|
label: (appData === null || appData === void 0 ? void 0 : appData.label) || '',
|
|
677
677
|
version: (_a = options === null || options === void 0 ? void 0 : options.deployOptions) === null || _a === void 0 ? void 0 : _a.version,
|
|
678
|
-
envId: appData.envId,
|
|
679
678
|
loginConfigVersion: (_b = cals.extra) === null || _b === void 0 ? void 0 : _b.loginConfigVersion,
|
|
680
679
|
basename: ctx.wedaRoot,
|
|
681
680
|
pages: appData.pageInstanceList
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -213,12 +213,13 @@ function generateDataContainerListeners() {
|
|
|
213
213
|
exports.generateDataContainerListeners = generateDataContainerListeners;
|
|
214
214
|
function createTemplateQuery(ctx, query = {}) {
|
|
215
215
|
return Object.entries(query).reduce((map, [key, item]) => {
|
|
216
|
+
var _a, _b;
|
|
216
217
|
const { listeners = [], handler, data, args, ...rest } = item;
|
|
217
218
|
const { staticProps, boundProps } = generatedDynamicData(generateArgsDynamicValueFromData(args, data) || {}, undefined, false);
|
|
218
219
|
map[key] = {
|
|
219
220
|
...rest,
|
|
220
221
|
handler: item.type === cals_1.EQueryType.GeneralFunc
|
|
221
|
-
? `(__data__,__params__) => (${handler['code']})({params:__params__,data:__data__})`
|
|
222
|
+
? `(__data__,__params__) => (${(_b = (_a = handler['code']) === null || _a === void 0 ? void 0 : _a.replace) === null || _b === void 0 ? void 0 : _b.call(_a, /;\s*$/, '')})({params:__params__,data:__data__})`
|
|
222
223
|
: `(...args) => $app.${handler === null || handler === void 0 ? void 0 : handler.name}(...args)`,
|
|
223
224
|
data: staticProps,
|
|
224
225
|
dataBinds: boundProps,
|
|
@@ -250,7 +251,7 @@ function getListenersHandlers(ctx, listeners = [], id, componentApi) {
|
|
|
250
251
|
const { enableAsyncMaterials = false } = ctx;
|
|
251
252
|
const eventHandlers = {};
|
|
252
253
|
listeners.forEach((l) => {
|
|
253
|
-
var _a, _b, _c, _d, _e;
|
|
254
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
254
255
|
const handlerName = (0, wxml_1.getMpEventHandlerName)(id, l.trigger, l);
|
|
255
256
|
const sourceKey = `${((_a = l.handler) === null || _a === void 0 ? void 0 : _a.moduleName) || ''}:${((_b = l.handler) === null || _b === void 0 ? void 0 : _b.name) || ''}`;
|
|
256
257
|
eventHandlers[handlerName] = eventHandlers[handlerName] || [];
|
|
@@ -304,7 +305,7 @@ function getListenersHandlers(ctx, listeners = [], id, componentApi) {
|
|
|
304
305
|
break;
|
|
305
306
|
}
|
|
306
307
|
case weapps_core_1.ActionType.GeneralFunc: {
|
|
307
|
-
handler = `function({event, $w, params}) { return (\n${((_e = l.handler) === null || _e === void 0 ? void 0 : _e.code) || '()=>{}'}\n)({event}) }`;
|
|
308
|
+
handler = `function({event, $w, params}) { return (\n${((_g = (_f = (_e = l.handler) === null || _e === void 0 ? void 0 : _e.code) === null || _f === void 0 ? void 0 : _f.replace) === null || _g === void 0 ? void 0 : _g.call(_f, /;\s*$/, '')) || '()=>{}'}\n)({event}) }`;
|
|
308
309
|
break;
|
|
309
310
|
}
|
|
310
311
|
}
|