@cloudbase/lowcode-builder 1.9.7 → 1.9.9
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 +3 -3
- package/lib/builder/mp/index.js +9 -6
- package/lib/builder/mp/materials.js +1 -1
- package/lib/builder/mp/util.d.ts +1 -1
- package/lib/builder/mp/util.js +5 -3
- package/lib/builder.web.js +2 -2
- package/package.json +2 -2
- package/template/html/index.html.ejs +3 -3
- package/template/mp/app/weapps-api.js +2 -0
- package/template/mp/datasources/config.js.tpl +23 -5
- package/template/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateSystemPackageDependencies = exports.generateLibDependencies = exports.generatePackageDependencies = void 0;
|
|
4
4
|
const cals_1 = require("@cloudbase/cals");
|
|
5
|
-
const CLOUDBASE_VERSION = '2.8.
|
|
5
|
+
const CLOUDBASE_VERSION = '2.8.21-beta.0';
|
|
6
6
|
const BASE_DEPS = {
|
|
7
7
|
'miniprogram-gesture': '^1.0.6',
|
|
8
8
|
mobx: '^5',
|
|
@@ -13,8 +13,8 @@ const BASE_DEPS = {
|
|
|
13
13
|
* 注意锁版本
|
|
14
14
|
*/
|
|
15
15
|
const CLOUDBASE_DEPS = {
|
|
16
|
-
'@cloudbase/weda-client': '1.1.
|
|
17
|
-
'@cloudbase/weda-cloud-sdk': '1.0.
|
|
16
|
+
'@cloudbase/weda-client': '1.1.12',
|
|
17
|
+
'@cloudbase/weda-cloud-sdk': '1.0.89',
|
|
18
18
|
};
|
|
19
19
|
const COMPONENT_DEPS = {
|
|
20
20
|
'@cloudbase/lowcode-render': '^1.1.4',
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -112,7 +112,7 @@ async function generateWedaRootCommonFile({ buildContext, buildTypeList, localWe
|
|
|
112
112
|
}
|
|
113
113
|
exports.generateWedaRootCommonFile = generateWedaRootCommonFile;
|
|
114
114
|
async function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, options, buildTypeList, ignoreInstall = false, cdnEndpoints = {}, mpConfig = {}, }) {
|
|
115
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
115
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
116
116
|
const operationLabel = em('Wexin MiniProgram Generated');
|
|
117
117
|
console.time(operationLabel);
|
|
118
118
|
console.log(`Generating ${em('Wexin MiniProgram')} to ${_buildContext.projDir}`);
|
|
@@ -243,6 +243,8 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
243
243
|
? JSON.stringify(buildContext.privatelinkConfig, undefined, 2)
|
|
244
244
|
: undefined,
|
|
245
245
|
defaultLoginType: buildContext.__defaultLoginType__,
|
|
246
|
+
pureAnonymousLogin: !!((_k = (_j = calses[0]) === null || _j === void 0 ? void 0 : _j.extra) === null || _k === void 0 ? void 0 : _k.pureAnonymousLogin),
|
|
247
|
+
publicPage: (_m = (_l = calses[0]) === null || _l === void 0 ? void 0 : _l.extra) === null || _m === void 0 ? void 0 : _m.publicPage,
|
|
246
248
|
},
|
|
247
249
|
'datasources/datasource-profiles.js.tpl': {
|
|
248
250
|
datasourceProfiles: (0, util_3.JsonToStringWithVariableName)([], { EOL: false }),
|
|
@@ -311,8 +313,8 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
311
313
|
projectConfigJson.setting = {
|
|
312
314
|
...projectConfigJson.setting,
|
|
313
315
|
...projConfig.setting,
|
|
314
|
-
packNpmRelationList: ((
|
|
315
|
-
? (0, mp_config_1.mergePackNpmRelationList)(projConfig.setting.packNpmRelationList, (
|
|
316
|
+
packNpmRelationList: ((_o = projConfig.setting) === null || _o === void 0 ? void 0 : _o.packNpmRelationList) || ((_p = projectConfigJson.setting) === null || _p === void 0 ? void 0 : _p.packNpmRelationList)
|
|
317
|
+
? (0, mp_config_1.mergePackNpmRelationList)(projConfig.setting.packNpmRelationList, (_q = projectConfigJson.setting) === null || _q === void 0 ? void 0 : _q.packNpmRelationList)
|
|
316
318
|
: undefined,
|
|
317
319
|
};
|
|
318
320
|
const wedaRoot = path_1.default.posix.join('./', projectConfigJson.miniprogramRoot || '/', projectConfigJson.wedaRoot || '');
|
|
@@ -332,7 +334,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
332
334
|
}
|
|
333
335
|
const appJsonPath = path_1.default.join(miniprogramRoot, 'app.json');
|
|
334
336
|
const appJson = await fs.readJson(appJsonPath);
|
|
335
|
-
appJson.subpackages = (0, mp_config_1.mergeSubPackages)(((
|
|
337
|
+
appJson.subpackages = (0, mp_config_1.mergeSubPackages)(((_s = (_r = appJson.subpackages) === null || _r === void 0 ? void 0 : _r.filter) === null || _s === void 0 ? void 0 : _s.call(_r, (item) => item.name !== 'wd-sys-module' && item.name !== 'wd-sys-materials')) || [], appConfig.subpackages);
|
|
336
338
|
await (0, generateFiles_1.writeFile)(appJsonPath, JSON.stringify(appJson, undefined, 2));
|
|
337
339
|
}
|
|
338
340
|
else {
|
|
@@ -631,7 +633,7 @@ async function generatePkg(ctx, { cals, weapp }, appRoot, pageConfigs, cssVarMap
|
|
|
631
633
|
}
|
|
632
634
|
}
|
|
633
635
|
async function generateFramework(ctx, { cals, weapp: appData }, outDir, options) {
|
|
634
|
-
var _a, _b, _c;
|
|
636
|
+
var _a, _b, _c, _d, _e;
|
|
635
637
|
let fileData = {};
|
|
636
638
|
if (appData.mpPkgUrl) {
|
|
637
639
|
/**
|
|
@@ -684,6 +686,7 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
|
|
|
684
686
|
label: (appData === null || appData === void 0 ? void 0 : appData.label) || '',
|
|
685
687
|
version: (_a = options === null || options === void 0 ? void 0 : options.deployOptions) === null || _a === void 0 ? void 0 : _a.version,
|
|
686
688
|
loginConfigVersion: (_b = cals.extra) === null || _b === void 0 ? void 0 : _b.loginConfigVersion,
|
|
689
|
+
pureAnonymousLogin: !!((_d = (_c = cals.extra) === null || _c === void 0 ? void 0 : _c.access) === null || _d === void 0 ? void 0 : _d.pureAnonymousLogin),
|
|
687
690
|
basename: ctx.wedaRoot,
|
|
688
691
|
pages: appData.pageInstanceList
|
|
689
692
|
.sort((item) => (item.isHome ? -1 : 1))
|
|
@@ -699,7 +702,7 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
|
|
|
699
702
|
});
|
|
700
703
|
}),
|
|
701
704
|
}),
|
|
702
|
-
appQuery: (0, util_2.createTemplateQuery)(ctx, (
|
|
705
|
+
appQuery: (0, util_2.createTemplateQuery)(ctx, (_e = appData.dataset) === null || _e === void 0 ? void 0 : _e.query),
|
|
703
706
|
/**
|
|
704
707
|
* @deprecated
|
|
705
708
|
*/
|
|
@@ -262,7 +262,7 @@ async function generateCompositeComponent(compositeCtx, compositedComp, lowcalWe
|
|
|
262
262
|
datasetProfile: (0, util_1.JsonToStringWithVariableName)((0, lowcode_generator_1.generateDynamicDataset)(compositedComp.dataset || {}), {
|
|
263
263
|
EOL: true,
|
|
264
264
|
}),
|
|
265
|
-
query: (0, util_2.createTemplateQuery)(compositeCtx, (_a = compositedComp.dataset) === null || _a === void 0 ? void 0 : _a.query) || {},
|
|
265
|
+
query: (0, util_2.createTemplateQuery)(compositeCtx, (_a = compositedComp.dataset) === null || _a === void 0 ? void 0 : _a.query, true) || {},
|
|
266
266
|
eventFlows: (0, util_2.createTemplateEventFlows)(compositeCtx, compositedComp.eventFlows) || [],
|
|
267
267
|
nativeMode: mode === 'lib' ? 1 : 0,
|
|
268
268
|
},
|
package/lib/builder/mp/util.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare function generateDataContainerListeners(): {
|
|
|
24
24
|
}[];
|
|
25
25
|
export declare function createTemplateQuery(ctx: IMpCommonBuildContext, query?: {
|
|
26
26
|
[key: string]: IQueryData;
|
|
27
|
-
}): {};
|
|
27
|
+
}, isComposite?: boolean): {};
|
|
28
28
|
export declare function createTemplateEventFlows(ctx: IMpCommonBuildContext, eventFlows?: any[]): any[];
|
|
29
29
|
export declare function generateArgsDynamicValueFromData(args?: {
|
|
30
30
|
[prop: string]: IDynamicValue;
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -211,15 +211,17 @@ function generateDataContainerListeners() {
|
|
|
211
211
|
];
|
|
212
212
|
}
|
|
213
213
|
exports.generateDataContainerListeners = generateDataContainerListeners;
|
|
214
|
-
function createTemplateQuery(ctx, query = {}) {
|
|
214
|
+
function createTemplateQuery(ctx, query = {}, isComposite = false) {
|
|
215
215
|
return Object.entries(query).reduce((map, [key, item]) => {
|
|
216
|
-
var _a, _b;
|
|
216
|
+
var _a, _b, _c, _d;
|
|
217
217
|
const { listeners = [], handler, data, args, ...rest } = item;
|
|
218
218
|
const { staticProps, boundProps } = generatedDynamicData(generateArgsDynamicValueFromData(args, data) || {}, undefined, false);
|
|
219
219
|
map[key] = {
|
|
220
220
|
...rest,
|
|
221
221
|
handler: item.type === cals_1.EQueryType.GeneralFunc
|
|
222
|
-
?
|
|
222
|
+
? isComposite
|
|
223
|
+
? `(__data__,__params__,$comp,$w) => (\n${(_b = (_a = handler['code']) === null || _a === void 0 ? void 0 : _a.replace) === null || _b === void 0 ? void 0 : _b.call(_a, /;\s*$/, '')}\n)({params:__params__,data:__data__,$comp,$w})`
|
|
224
|
+
: `(__data__,__params__) => (\n${(_d = (_c = handler['code']) === null || _c === void 0 ? void 0 : _c.replace) === null || _d === void 0 ? void 0 : _d.call(_c, /;\s*$/, '')}\n)({params:__params__,data:__data__})`
|
|
223
225
|
: `(...args) => $app.${handler === null || handler === void 0 ? void 0 : handler.name}(...args)`,
|
|
224
226
|
data: staticProps,
|
|
225
227
|
dataBinds: boundProps,
|