@cloudbase/lowcode-builder 1.9.6 → 1.9.8
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 +2 -2
- package/lib/builder/h5/block2component.d.ts +4 -1
- package/lib/builder/h5/block2component.js +3 -2
- package/lib/builder/h5/generate.d.ts +1 -1
- package/lib/builder/h5/generate.js +2 -1
- package/lib/builder/mp/index.js +8 -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 +3 -3
- package/package.json +2 -2
- package/template/mp/datasources/config.js.tpl +8 -4
- package/template/package.json +1 -1
|
@@ -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.11',
|
|
17
|
+
'@cloudbase/weda-cloud-sdk': '1.0.87',
|
|
18
18
|
};
|
|
19
19
|
const COMPONENT_DEPS = {
|
|
20
20
|
'@cloudbase/lowcode-render': '^1.1.4',
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { RUNTIME } from '../../types';
|
|
2
|
-
export declare function buildBlock(buildDir: any, dependencies: any, runtime?: RUNTIME): Promise<
|
|
2
|
+
export declare function buildBlock(buildDir: any, dependencies: any, runtime?: RUNTIME): Promise<{
|
|
3
|
+
buildDir: any;
|
|
4
|
+
componentsList: any;
|
|
5
|
+
}>;
|
|
@@ -43,8 +43,9 @@ async function buildBlock(buildDir, dependencies, runtime = types_1.RUNTIME.NONE
|
|
|
43
43
|
const officialDependence = dependencies.find((lib) => lib.name === config_1.OFFICIAL_LIB_KEY);
|
|
44
44
|
const componentDeps = (0, config_1.generateLibDependencies)('h5', officialDependence === null || officialDependence === void 0 ? void 0 : officialDependence.version);
|
|
45
45
|
processedDependencies.push(officialDependence);
|
|
46
|
+
let componentsList;
|
|
46
47
|
try {
|
|
47
|
-
await (0, generate_1.generateBlockFiles)({
|
|
48
|
+
componentsList = await (0, generate_1.generateBlockFiles)({
|
|
48
49
|
dependencies: processedDependencies,
|
|
49
50
|
appBuildDir: buildDir,
|
|
50
51
|
componentDeps,
|
|
@@ -53,6 +54,6 @@ async function buildBlock(buildDir, dependencies, runtime = types_1.RUNTIME.NONE
|
|
|
53
54
|
catch (error) {
|
|
54
55
|
throw error;
|
|
55
56
|
}
|
|
56
|
-
return buildDir;
|
|
57
|
+
return { buildDir, componentsList };
|
|
57
58
|
}
|
|
58
59
|
exports.buildBlock = buildBlock;
|
|
@@ -7,7 +7,7 @@ import { ICommonBuildContext } from '../mp/BuildContext';
|
|
|
7
7
|
* 该函数从 @govcloud/generate 取到需要的模版文件
|
|
8
8
|
*/
|
|
9
9
|
export declare function generateProjectFiles(buildData: BuildAppProps): Promise<void>;
|
|
10
|
-
export declare function generateBlockFiles(buildData: any): Promise<
|
|
10
|
+
export declare function generateBlockFiles(buildData: any): Promise<string[]>;
|
|
11
11
|
export declare function generateHTML({ buildContext, appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
12
12
|
/**
|
|
13
13
|
* 由于存量兜底逻辑存在
|
|
@@ -29,7 +29,7 @@ exports.generateProjectFiles = generateProjectFiles;
|
|
|
29
29
|
async function generateBlockFiles(buildData) {
|
|
30
30
|
const { dependencies, appBuildDir, componentDeps } = buildData;
|
|
31
31
|
const fileCodeMap = {};
|
|
32
|
-
await (0, lowcode_generator_1.generateCompositeComponent)(dependencies, './', fileCodeMap, componentDeps);
|
|
32
|
+
const componentsList = await (0, lowcode_generator_1.generateCompositeComponent)(dependencies, './', fileCodeMap, componentDeps);
|
|
33
33
|
try {
|
|
34
34
|
await Promise.all(Object.keys(fileCodeMap).map(async (filePath) => {
|
|
35
35
|
await (0, generateFiles_1.writeFile)(path_1.default.join(appBuildDir || '', filePath), fileCodeMap[filePath].code);
|
|
@@ -38,6 +38,7 @@ async function generateBlockFiles(buildData) {
|
|
|
38
38
|
catch (error) {
|
|
39
39
|
throw error;
|
|
40
40
|
}
|
|
41
|
+
return componentsList;
|
|
41
42
|
}
|
|
42
43
|
exports.generateBlockFiles = generateBlockFiles;
|
|
43
44
|
async function generateHTML({ buildContext, appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
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;
|
|
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,7 @@ 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),
|
|
246
247
|
},
|
|
247
248
|
'datasources/datasource-profiles.js.tpl': {
|
|
248
249
|
datasourceProfiles: (0, util_3.JsonToStringWithVariableName)([], { EOL: false }),
|
|
@@ -311,8 +312,8 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
311
312
|
projectConfigJson.setting = {
|
|
312
313
|
...projectConfigJson.setting,
|
|
313
314
|
...projConfig.setting,
|
|
314
|
-
packNpmRelationList: ((
|
|
315
|
-
? (0, mp_config_1.mergePackNpmRelationList)(projConfig.setting.packNpmRelationList, (
|
|
315
|
+
packNpmRelationList: ((_l = projConfig.setting) === null || _l === void 0 ? void 0 : _l.packNpmRelationList) || ((_m = projectConfigJson.setting) === null || _m === void 0 ? void 0 : _m.packNpmRelationList)
|
|
316
|
+
? (0, mp_config_1.mergePackNpmRelationList)(projConfig.setting.packNpmRelationList, (_o = projectConfigJson.setting) === null || _o === void 0 ? void 0 : _o.packNpmRelationList)
|
|
316
317
|
: undefined,
|
|
317
318
|
};
|
|
318
319
|
const wedaRoot = path_1.default.posix.join('./', projectConfigJson.miniprogramRoot || '/', projectConfigJson.wedaRoot || '');
|
|
@@ -332,7 +333,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
332
333
|
}
|
|
333
334
|
const appJsonPath = path_1.default.join(miniprogramRoot, 'app.json');
|
|
334
335
|
const appJson = await fs.readJson(appJsonPath);
|
|
335
|
-
appJson.subpackages = (0, mp_config_1.mergeSubPackages)(((
|
|
336
|
+
appJson.subpackages = (0, mp_config_1.mergeSubPackages)(((_q = (_p = appJson.subpackages) === null || _p === void 0 ? void 0 : _p.filter) === null || _q === void 0 ? void 0 : _q.call(_p, (item) => item.name !== 'wd-sys-module' && item.name !== 'wd-sys-materials')) || [], appConfig.subpackages);
|
|
336
337
|
await (0, generateFiles_1.writeFile)(appJsonPath, JSON.stringify(appJson, undefined, 2));
|
|
337
338
|
}
|
|
338
339
|
else {
|
|
@@ -631,7 +632,7 @@ async function generatePkg(ctx, { cals, weapp }, appRoot, pageConfigs, cssVarMap
|
|
|
631
632
|
}
|
|
632
633
|
}
|
|
633
634
|
async function generateFramework(ctx, { cals, weapp: appData }, outDir, options) {
|
|
634
|
-
var _a, _b, _c;
|
|
635
|
+
var _a, _b, _c, _d, _e;
|
|
635
636
|
let fileData = {};
|
|
636
637
|
if (appData.mpPkgUrl) {
|
|
637
638
|
/**
|
|
@@ -684,6 +685,7 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
|
|
|
684
685
|
label: (appData === null || appData === void 0 ? void 0 : appData.label) || '',
|
|
685
686
|
version: (_a = options === null || options === void 0 ? void 0 : options.deployOptions) === null || _a === void 0 ? void 0 : _a.version,
|
|
686
687
|
loginConfigVersion: (_b = cals.extra) === null || _b === void 0 ? void 0 : _b.loginConfigVersion,
|
|
688
|
+
pureAnonymousLogin: !!((_d = (_c = cals.extra) === null || _c === void 0 ? void 0 : _c.access) === null || _d === void 0 ? void 0 : _d.pureAnonymousLogin),
|
|
687
689
|
basename: ctx.wedaRoot,
|
|
688
690
|
pages: appData.pageInstanceList
|
|
689
691
|
.sort((item) => (item.isHome ? -1 : 1))
|
|
@@ -699,7 +701,7 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
|
|
|
699
701
|
});
|
|
700
702
|
}),
|
|
701
703
|
}),
|
|
702
|
-
appQuery: (0, util_2.createTemplateQuery)(ctx, (
|
|
704
|
+
appQuery: (0, util_2.createTemplateQuery)(ctx, (_e = appData.dataset) === null || _e === void 0 ? void 0 : _e.query),
|
|
703
705
|
/**
|
|
704
706
|
* @deprecated
|
|
705
707
|
*/
|
|
@@ -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,
|