@cloudbase/framework-plugin-low-code 0.7.31 → 0.7.34
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/mp/util.d.ts.map +1 -1
- package/lib/builder/mp/util.js +4 -0
- package/lib/builder/mp/wxml.d.ts.map +1 -1
- package/lib/builder/mp/wxml.js +8 -18
- package/lib/builder/service/builder/generate.d.ts.map +1 -1
- package/lib/builder/service/builder/generate.js +12 -23
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +29 -22
- package/lib/weapps-core/types/app.d.ts +1 -0
- package/lib/weapps-core/types/app.d.ts.map +1 -1
- package/lib/weapps-core/utils/file.d.ts +1 -1
- package/lib/weapps-core/utils/formily.d.ts.map +1 -1
- package/lib/weapps-core/utils/formily.js +12 -3
- package/package.json +2 -2
- package/template/html/index.html.ejs +1 -1
- package/template/mp/common/util.js +1 -0
- package/template/mp/common/widget.js +375 -209
- package/template/mp/component/index.js +1 -1
- package/template/mp/page/index.js +1 -1
- package/template/src/handlers/FieldMiddleware/renderer.jsx +6 -3
- package/template/src/handlers/render.jsx +16 -4
- package/template/src/handlers/utils/widgets.js +160 -76
- package/template/src/index.jsx +3 -1
- package/template/src/pages/composite.tpl +17 -11
- package/lib/config/private.d.ts +0 -3
- package/lib/config/private.d.ts.map +0 -1
- package/lib/config/private.js +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,uBAAuB,EAKxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,uBAAuB,EAKxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC,QAAQ,CAAC,OAepF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE;;;EAa1E;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,UA0CnD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAE,EAAE,GAAG,EAAE,aAAa,MAuBxG;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAE,EACnD,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,aAAa,MA6FnB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAE,EAAE,GAAG,EAAE,aAAa,MA2CtG"}
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -6,6 +6,7 @@ const weapp_1 = require("../util/weapp");
|
|
|
6
6
|
const wxml_1 = require("./wxml");
|
|
7
7
|
const mp_1 = require("../config/mp");
|
|
8
8
|
function extractWidgetProps(props) {
|
|
9
|
+
var _a, _b;
|
|
9
10
|
const { classList } = props;
|
|
10
11
|
const staticProps = {
|
|
11
12
|
style: (0, weapps_core_1.toCssStyle)(props.commonStyle, {
|
|
@@ -16,6 +17,9 @@ function extractWidgetProps(props) {
|
|
|
16
17
|
};
|
|
17
18
|
const { data = {} } = props;
|
|
18
19
|
Object.assign(staticProps, generatedDynamicData(data).staticProps);
|
|
20
|
+
if ((_a = props.directives) === null || _a === void 0 ? void 0 : _a.waForKey) {
|
|
21
|
+
staticProps._waForKey = (_b = props.directives) === null || _b === void 0 ? void 0 : _b.waForKey.value;
|
|
22
|
+
}
|
|
19
23
|
return staticProps;
|
|
20
24
|
}
|
|
21
25
|
exports.extractWidgetProps = extractWidgetProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wxml.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/wxml.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"wxml.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/wxml.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,uBAAuB,EAAgB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAU1G,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAkB/C,wBAAgB,YAAY,CAC1B,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAE,EACnD,MAAM,EAAE,MAAM,EACd,cAAc,KAAA,EACd,GAAG,EAAE,aAAa,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,EACxC,eAAe,KAAA,EACf,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,uBAAuB,EAAE,IAAI,KAAA,KAAK,IAAI,UAqS7D;AAyBD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,UAQtG;AAmBD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAE,EACnD,QAAQ,GAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAO;;EAYlD"}
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -25,9 +25,7 @@ const name_mangler_1 = __importDefault(require("../util/name-mangler"));
|
|
|
25
25
|
const error = chalk_1.default.redBright;
|
|
26
26
|
function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nodeTransform) {
|
|
27
27
|
var _a;
|
|
28
|
-
const nameMangler = ctx.isProduction
|
|
29
|
-
? new name_mangler_1.default({ blackList: mp_1.builtinMpTags })
|
|
30
|
-
: undefined;
|
|
28
|
+
const nameMangler = ctx.isProduction ? new name_mangler_1.default({ blackList: mp_1.builtinMpTags }) : undefined;
|
|
31
29
|
const xmlJson = {
|
|
32
30
|
elements: [
|
|
33
31
|
{
|
|
@@ -65,11 +63,11 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
65
63
|
];
|
|
66
64
|
}
|
|
67
65
|
function createXml(widgets, parent = null, parentForNodes = []) {
|
|
68
|
-
var _a;
|
|
66
|
+
var _a, _b;
|
|
69
67
|
const elements = [];
|
|
70
68
|
for (const id in widgets) {
|
|
71
69
|
const { xComponent, xProps, properties, xIndex } = widgets[id];
|
|
72
|
-
const { data: data0 = {}, listeners = [], directives = {}, staticResourceAttribute = ['src']
|
|
70
|
+
const { data: data0 = {}, listeners = [], directives = {}, staticResourceAttribute = ['src'] } = xProps || {};
|
|
73
71
|
const data = Object.assign({}, data0);
|
|
74
72
|
if (directives.waIf && directives.waIf.value === false) {
|
|
75
73
|
continue;
|
|
@@ -114,17 +112,13 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
114
112
|
.join('')}.`;
|
|
115
113
|
const idAttr = curForNodes.length < 1
|
|
116
114
|
? id
|
|
117
|
-
: `{{'${id}'${curForNodes
|
|
118
|
-
.map((forNodeId) => `+ '-' + ${wxmlDataPrefix.forIndex}${forNodeId}`)
|
|
119
|
-
.join('')}}}`;
|
|
115
|
+
: `{{'${id}'${curForNodes.map((forNodeId) => `+ '-' + ${wxmlDataPrefix.forIndex}${forNodeId}`).join('')}}}`;
|
|
120
116
|
if (tagName === 'slot') {
|
|
121
117
|
const slotNode = {
|
|
122
118
|
type: 'element',
|
|
123
119
|
name: tagName,
|
|
124
120
|
attributes: {
|
|
125
|
-
name: data0.name.type && data0.name.type !== 'static'
|
|
126
|
-
? `{{${id}.name}}`
|
|
127
|
-
: data0.name.value,
|
|
121
|
+
name: data0.name.type && data0.name.type !== 'static' ? `{{${id}.name}}` : data0.name.value,
|
|
128
122
|
},
|
|
129
123
|
elements: [],
|
|
130
124
|
_order: xIndex || 0,
|
|
@@ -162,7 +156,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
162
156
|
.map((forNodeId) => `[${wxmlDataPrefix.forIndex}${forNodeId}]`)
|
|
163
157
|
.join('')}`);
|
|
164
158
|
node.attributes['wx:for-index'] = wxmlDataPrefix.forIndex + id;
|
|
165
|
-
node.attributes['wx:key'] = '
|
|
159
|
+
node.attributes['wx:key'] = node.attributes['wx:key'] = ((_b = directives.waForKey) === null || _b === void 0 ? void 0 : _b.value) ? '_key' : '$$i';
|
|
166
160
|
}
|
|
167
161
|
const compSchema = componentProto.dataForm;
|
|
168
162
|
for (const prop in data) {
|
|
@@ -211,9 +205,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
211
205
|
}
|
|
212
206
|
}
|
|
213
207
|
node.elements = node.elements.concat(createXml(properties, node, curForNodes));
|
|
214
|
-
if (tagName === 'swiper' ||
|
|
215
|
-
componentKey === 'weda:Swiper' ||
|
|
216
|
-
componentKey === 'gsd-h5-react:Swiper') {
|
|
208
|
+
if (tagName === 'swiper' || componentKey === 'weda:Swiper' || componentKey === 'gsd-h5-react:Swiper') {
|
|
217
209
|
node.elements = node.elements.map((item, index) => {
|
|
218
210
|
var _a, _b;
|
|
219
211
|
let _c = item.attributes || {}, { ['wx:for']: wxFor, ['wx:for-index']: wxForIndex, ['wx:key']: wxKey, ['wx:if']: wxIf } = _c, itemRestKey = __rest(_c, ['wx:for', 'wx:for-index', 'wx:key', 'wx:if']);
|
|
@@ -304,7 +296,5 @@ exports.getUsedComponents = getUsedComponents;
|
|
|
304
296
|
function getAttrBind(dVale, widgetBind, isStaticResource) {
|
|
305
297
|
const { type, value } = dVale;
|
|
306
298
|
const attrVal = type === weapps_core_1.PropBindType.prop ? value : widgetBind;
|
|
307
|
-
return isStaticResource
|
|
308
|
-
? `{{wxsUtils._getStaticResourceAttribute(${attrVal})}}`
|
|
309
|
-
: `{{${attrVal}}}`;
|
|
299
|
+
return isStaticResource ? `{{wxsUtils._getStaticResourceAttribute(${attrVal})}}` : `{{${attrVal}}}`;
|
|
310
300
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAGxD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EAEb,kBAAkB,EAWlB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAGxD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EAEb,kBAAkB,EAWlB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAIL,SAAS,EACT,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGxF,MAAM,WAAW,cAAe,SAAQ,kBAAkB;CAAG;AAE7D,wBAAsB,wBAAwB,CAAC,cAAc,EAAE,kBAAkB,EAAE,EAAE,WAAW,EAAE,MAAM,iBAuBvG;AAED,wBA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M,EACd,QAAQ,KAAA,EACR,UAAU,EAAE,WAAW,EACvB,aAAa,EAAE,SAAS,EAAE,EAC1B,SAAS,KAAA,iBAoFV"}
|
|
@@ -78,7 +78,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
const fixedDependencies = dependencies;
|
|
80
80
|
const { componentSchemaJson, pluginInstances, listenerInstances: pageListenerInstances, style: PageStyle, data, } = pageInstance;
|
|
81
|
-
const { originComponentList, originActionList
|
|
81
|
+
const { originComponentList, originActionList } = getOriginComponentAndActionList(componentSchemaJson, fixedDependencies);
|
|
82
82
|
const componentsMeta = yield (0, util_1.getComponentsInfo)(appBuildDir, dependencies);
|
|
83
83
|
const originPluginList = getOriginPluginList(pluginInstances, dependencies);
|
|
84
84
|
pullActionToListByInstances(pageListenerInstances, originActionList, fixedDependencies);
|
|
@@ -127,7 +127,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
127
127
|
isComposite: extraData.isComposite,
|
|
128
128
|
compProps: extraData.compProps,
|
|
129
129
|
title: data.navigationBarTitleText || data.title || '',
|
|
130
|
-
reachBottomDistance: data.reachBottomDistance || 0
|
|
130
|
+
reachBottomDistance: data.reachBottomDistance || 0,
|
|
131
131
|
};
|
|
132
132
|
const dest = path_1.default.resolve(appBuildDir, `./pages/${pageInstance.id}/index.jsx`);
|
|
133
133
|
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './src/pages/app.tpl'), {
|
|
@@ -148,7 +148,7 @@ function getOriginComponentAndActionList(componentSchema, fixedDependencies, ori
|
|
|
148
148
|
if (fieldSchema.isObject()) {
|
|
149
149
|
const { 'x-props': xProps } = fieldSchema;
|
|
150
150
|
if (xProps) {
|
|
151
|
-
const { listenerInstances, sourceKey
|
|
151
|
+
const { listenerInstances, sourceKey } = xProps;
|
|
152
152
|
pullComponentToListByInstance(sourceKey, originComponentList, fixedDependencies);
|
|
153
153
|
pullActionToListByInstances(listenerInstances, originActionList, fixedDependencies);
|
|
154
154
|
}
|
|
@@ -236,9 +236,7 @@ exports.pullComponentToListByInstance = pullComponentToListByInstance;
|
|
|
236
236
|
function getVirtualFieldsString(components) {
|
|
237
237
|
const fields = components.reduce((result, component) => {
|
|
238
238
|
const { name, materialName, variableName, isPlainProps } = component;
|
|
239
|
-
result[`${materialName}:${name}`] = `%%%React.forwardRef((props, ref) => <${lodash_1.default.upperFirst(variableName)} ${isPlainProps
|
|
240
|
-
? '{...resolveComponentProps(props, 1)}'
|
|
241
|
-
: '{...resolveComponentProps(props, 0)}'} ref={ref} pageVirtualFields={virtualFields}/>)%%%`;
|
|
239
|
+
result[`${materialName}:${name}`] = `%%%React.forwardRef((props, ref) => <${lodash_1.default.upperFirst(variableName)} ${isPlainProps ? '{...resolveComponentProps(props, 1)}' : '{...resolveComponentProps(props, 0)}'} ref={ref} pageVirtualFields={virtualFields}/>)%%%`;
|
|
242
240
|
return result;
|
|
243
241
|
}, {});
|
|
244
242
|
return JSON.stringify(fields, null, 2).replace(/"%%%(.*?)%%%"/g, function (match, expression) {
|
|
@@ -273,9 +271,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
273
271
|
schema['emitEvents'] = componentInfo.emitEvents.map((item) => item.eventName);
|
|
274
272
|
}
|
|
275
273
|
if (!isSlot(schema) && schema.key) {
|
|
276
|
-
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: (0, weapps_core_1.toCssStyle)(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(schema.parent)
|
|
277
|
-
? (_g = (_f = schema === null || schema === void 0 ? void 0 : schema.parent) === null || _f === void 0 ? void 0 : _f.parent) === null || _g === void 0 ? void 0 : _g.key
|
|
278
|
-
: (_h = schema === null || schema === void 0 ? void 0 : schema.parent) === null || _h === void 0 ? void 0 : _h.key });
|
|
274
|
+
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: (0, weapps_core_1.toCssStyle)(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(schema.parent) ? (_g = (_f = schema === null || schema === void 0 ? void 0 : schema.parent) === null || _f === void 0 ? void 0 : _f.parent) === null || _g === void 0 ? void 0 : _g.key : (_h = schema === null || schema === void 0 ? void 0 : schema.parent) === null || _h === void 0 ? void 0 : _h.key });
|
|
279
275
|
if (dataBinds.length > 0) {
|
|
280
276
|
compDataBinds[schema.key] = generateDataBinds(dataBinds, isComposite);
|
|
281
277
|
}
|
|
@@ -304,8 +300,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
304
300
|
if (propsVaule && Array.isArray(propsVaule)) {
|
|
305
301
|
propsVaule.map((block) => {
|
|
306
302
|
var _a, _b;
|
|
307
|
-
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) &&
|
|
308
|
-
((_b = (_a = block === null || block === void 0 ? void 0 : block.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props']) === null || _b === void 0 ? void 0 : _b.listenerInstances);
|
|
303
|
+
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) && ((_b = (_a = block === null || block === void 0 ? void 0 : block.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props']) === null || _b === void 0 ? void 0 : _b.listenerInstances);
|
|
309
304
|
if (blockInstance) {
|
|
310
305
|
block.selectableBlock['x-props'].listenerInstances = generateListnerInstances(blockInstance, isComposite);
|
|
311
306
|
}
|
|
@@ -333,8 +328,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
333
328
|
if (xProps['dataBinds'] && xProps['dataBinds'].length === 0) {
|
|
334
329
|
delete xProps['dataBinds'];
|
|
335
330
|
}
|
|
336
|
-
if (xProps['listenerInstances'] &&
|
|
337
|
-
xProps['listenerInstances'].length === 0) {
|
|
331
|
+
if (xProps['listenerInstances'] && xProps['listenerInstances'].length === 0) {
|
|
338
332
|
delete xProps['listenerInstances'];
|
|
339
333
|
}
|
|
340
334
|
if (xProps['data']) {
|
|
@@ -345,8 +339,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
345
339
|
if (xPropsData.title === '') {
|
|
346
340
|
delete xPropsData.title;
|
|
347
341
|
}
|
|
348
|
-
if (xPropsData.staticResourceAttribute &&
|
|
349
|
-
xPropsData.staticResourceAttribute.length === 0) {
|
|
342
|
+
if (xPropsData.staticResourceAttribute && xPropsData.staticResourceAttribute.length === 0) {
|
|
350
343
|
delete xPropsData.staticResourceAttribute;
|
|
351
344
|
}
|
|
352
345
|
if ((0, weapps_core_1.isEmptyObj)(xPropsData)) {
|
|
@@ -546,7 +539,7 @@ function getPluginImportStringArr(plugins, pluginImportStringArr = []) {
|
|
|
546
539
|
exports.getPluginImportStringArr = getPluginImportStringArr;
|
|
547
540
|
function getComponentImportStringArr(components, componentImportStringArr = []) {
|
|
548
541
|
components.map((component) => __awaiter(this, void 0, void 0, function* () {
|
|
549
|
-
const { name, materialName, materialVersion, variableName, entries
|
|
542
|
+
const { name, materialName, materialVersion, variableName, entries } = component;
|
|
550
543
|
let importString = '';
|
|
551
544
|
if (entries === null || entries === void 0 ? void 0 : entries.components) {
|
|
552
545
|
importString = `import { ${name} as ${lodash_1.default.upperFirst(variableName)} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.components)}'`;
|
|
@@ -588,7 +581,7 @@ function getActionImportStringArr(originActionList, actionImportStringArr = [])
|
|
|
588
581
|
}
|
|
589
582
|
exports.getActionImportStringArr = getActionImportStringArr;
|
|
590
583
|
function pushActionToImportStringArr(listenerInstance, actionImportStringArr) {
|
|
591
|
-
const { name, materialName, materialVersion, variableName, entries
|
|
584
|
+
const { name, materialName, materialVersion, variableName, entries } = listenerInstance;
|
|
592
585
|
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
593
586
|
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions)
|
|
594
587
|
? `import { ${name} as ${variableName} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.actions)}'`
|
|
@@ -644,9 +637,7 @@ function writeLowCodeFiles(appData, appBuildDir) {
|
|
|
644
637
|
yield Promise.all(appData.codeModules.map((m) => writeCode2file(m, 'global')));
|
|
645
638
|
yield Promise.all((0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList, (page) => __awaiter(this, void 0, void 0, function* () {
|
|
646
639
|
(0, style_1.generateDefaultStyle)(page);
|
|
647
|
-
yield page.codeModules
|
|
648
|
-
.filter((m) => m.name !== '____index____')
|
|
649
|
-
.forEach((m) => writeCode2file(m, page.id));
|
|
640
|
+
yield page.codeModules.filter((m) => m.name !== '____index____').forEach((m) => writeCode2file(m, page.id));
|
|
650
641
|
})));
|
|
651
642
|
function writeCode2file(mod, pageId) {
|
|
652
643
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -785,9 +776,7 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
785
776
|
interpolate: /<%=([\s\S]+?)%>/g,
|
|
786
777
|
})(templatesData[file]);
|
|
787
778
|
const outFile = path_1.default.resolve(appBuildDir, file.replace(/.tpl$/, ''));
|
|
788
|
-
const outTplPath = /.tpl$/.test(file)
|
|
789
|
-
? path_1.default.resolve(appBuildDir, file)
|
|
790
|
-
: null;
|
|
779
|
+
const outTplPath = /.tpl$/.test(file) ? path_1.default.resolve(appBuildDir, file) : null;
|
|
791
780
|
yield fs_extra_1.default.ensureFile(outFile);
|
|
792
781
|
console.log(outFile);
|
|
793
782
|
yield fs_extra_1.default.writeFile(outFile, generatedCode);
|
package/lib/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ declare class LowCodePlugin extends Plugin {
|
|
|
80
80
|
protected _appPath: string;
|
|
81
81
|
protected _authPlugin: any;
|
|
82
82
|
protected _miniprogramePlugin: any;
|
|
83
|
+
protected _miniprogramePluginProjectParam: any;
|
|
83
84
|
protected _webPlugin: any;
|
|
84
85
|
protected _functionPlugin: any;
|
|
85
86
|
protected _productBasePath?: string;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOrE,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAE7D,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAKpD,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,2BAA2B,IAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOrE,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAE7D,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAKpD,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,2BAA2B,IAAK,CAAC;AAuB9C,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAoBnB,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAM5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAE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qB1C,eAAe,CAAC,OAAO,KAAA;IAIjB,gBAAgB;IA8GhB,2BAA2B;IA6D3B,UAAU;IAoBV,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;IAejB,uBAAuB;IAoBvB,yBAAyB;IA0F/B,oBAAoB;CAKrB;AA4BD,eAAO,MAAM,MAAM,sBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -71,6 +71,12 @@ const QRCODE_PATH = './qrcode.jpg';
|
|
|
71
71
|
const LOG_FILE = 'build.log';
|
|
72
72
|
const DEFAULT_CLOUDFUNCTION_ROOT_NAME = 'cloudfunctions';
|
|
73
73
|
const DEFAULT_CLOUDFUNCTION_ROOT_PATH = path_1.default.join(DEFAULT_CLOUDFUNCTION_ROOT_NAME, '/');
|
|
74
|
+
const MP_COMPILE_SETTING = {
|
|
75
|
+
es6: true,
|
|
76
|
+
es7: true,
|
|
77
|
+
minify: true,
|
|
78
|
+
codeProtect: false,
|
|
79
|
+
};
|
|
74
80
|
const DEFAULT_INPUTS = {
|
|
75
81
|
_inputFile: 'input.json',
|
|
76
82
|
debug: false,
|
|
@@ -224,29 +230,20 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
224
230
|
}
|
|
225
231
|
let projectJson = fs_extra_1.default.readJsonSync(path_1.default.resolve(this.api.projectPath, exports.DIST_PATH, 'project.config.json'));
|
|
226
232
|
let { cloudfunctionRoot, miniprogramRoot = './' } = projectJson;
|
|
227
|
-
|
|
228
|
-
es6: true,
|
|
229
|
-
es7: true,
|
|
230
|
-
minify: true,
|
|
231
|
-
codeProtect: false,
|
|
232
|
-
};
|
|
233
|
-
this._miniprogramePlugin = new framework_plugin_mp_1.plugin('miniprograme', this.api, {
|
|
233
|
+
this._miniprogramePluginProjectParam = {
|
|
234
234
|
appid: deployOptions.mpAppId,
|
|
235
235
|
privateKeyPath: `./private.${deployOptions.mpAppId}.key`,
|
|
236
|
-
localPath: exports.DIST_PATH,
|
|
237
236
|
ignores: ['node_modules/**/*', LOG_FILE].concat(cloudfunctionRoot ? [path_1.default.join(cloudfunctionRoot, '**/*')] : []),
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
};
|
|
238
|
+
this._miniprogramePlugin = new framework_plugin_mp_1.plugin('miniprograme', this.api, Object.assign(Object.assign({}, this._miniprogramePluginProjectParam), { localPath: exports.DIST_PATH, deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId ? deployOptions.mode : types_1.DEPLOY_MODE.UPLOAD, uploadOptions: {
|
|
240
239
|
version: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.version) || '1.0.0',
|
|
241
240
|
desc: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.description) || '',
|
|
242
|
-
setting,
|
|
243
|
-
},
|
|
244
|
-
previewOptions: {
|
|
241
|
+
setting: MP_COMPILE_SETTING,
|
|
242
|
+
}, previewOptions: {
|
|
245
243
|
qrcodeOutputPath: path_1.default.resolve(this.api.projectPath, QRCODE_PATH),
|
|
246
244
|
pagePath: (_b = (_a = fs_extra_1.default.readJsonSync(path_1.default.resolve(this.api.projectPath, exports.DIST_PATH, miniprogramRoot, 'app.json'))) === null || _a === void 0 ? void 0 : _a.pages) === null || _b === void 0 ? void 0 : _b[0],
|
|
247
|
-
setting,
|
|
248
|
-
}
|
|
249
|
-
});
|
|
245
|
+
setting: MP_COMPILE_SETTING,
|
|
246
|
+
} }));
|
|
250
247
|
}
|
|
251
248
|
else if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
|
|
252
249
|
this._webPlugin = new framework_plugin_website_1.plugin('web', this.api, {
|
|
@@ -599,6 +596,21 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
599
596
|
this._time("DEPLOY");
|
|
600
597
|
if (this._miniprogramePlugin) {
|
|
601
598
|
yield this._miniprogramePlugin.deploy();
|
|
599
|
+
try {
|
|
600
|
+
const saveZipPath = path_1.default.join(this._productBasePath, 'compiledResult.zip');
|
|
601
|
+
yield mpci.getCompiledResult({
|
|
602
|
+
project: new mpci.Project(Object.assign(Object.assign({}, this._miniprogramePluginProjectParam), { projectPath: this._appPath, type: 'miniProgram' })),
|
|
603
|
+
version: '0.0.0',
|
|
604
|
+
desc: '',
|
|
605
|
+
setting: MP_COMPILE_SETTING,
|
|
606
|
+
onProgressUpdate: () => { },
|
|
607
|
+
}, path_1.default.join(this._productBasePath, 'compiledResult.zip'));
|
|
608
|
+
const { size } = yield fs_extra_1.default.stat(saveZipPath);
|
|
609
|
+
this.api.logger.info('获取小程序包大小', size);
|
|
610
|
+
}
|
|
611
|
+
catch (e) {
|
|
612
|
+
this.api.logger.error('获取小程序包失败', e);
|
|
613
|
+
}
|
|
602
614
|
}
|
|
603
615
|
else if (this._webPlugin) {
|
|
604
616
|
yield this._webPlugin.deploy();
|
|
@@ -685,12 +697,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
685
697
|
mpAnalyzeAndCleanCode(distDir) {
|
|
686
698
|
return __awaiter(this, void 0, void 0, function* () {
|
|
687
699
|
let { deployOptions } = this._resolvedInputs;
|
|
688
|
-
const project = new mpci.Project({
|
|
689
|
-
appid: deployOptions.mpAppId,
|
|
690
|
-
projectPath: distDir,
|
|
691
|
-
type: 'miniProgram',
|
|
692
|
-
privateKeyPath: `./private.${deployOptions.mpAppId}.key`,
|
|
693
|
-
});
|
|
700
|
+
const project = new mpci.Project(Object.assign(Object.assign({}, this._miniprogramePluginProjectParam), { projectPath: distDir, type: 'miniProgram' }));
|
|
694
701
|
const analyseRes = yield mpci.analyseCode(project);
|
|
695
702
|
if (analyseRes) {
|
|
696
703
|
const codeExtensions = new Set(['.wxml', '.wxss', '.wxs', '.js', '.json', '.json', '.ts']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/types/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,U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,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAM5B,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC/B,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC;CACrB;AAED,oBAAY,YAAY;IACtB,KAAK,YAAY;IACjB,QAAQ,aAAa;IACrB,OAAO,aAAa;IACpB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,SAAS,UAAU;IACnB,SAAS,WAAW;IACpB,KAAK,UAAU;CAChB;AAED,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,aAAa,kBAAkB;CAChC;AACD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,UAAU,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -6,7 +6,7 @@ export declare function originJsonToFileList(appData: IWeAppData): (import("../t
|
|
|
6
6
|
code: string;
|
|
7
7
|
pageId: string;
|
|
8
8
|
})[];
|
|
9
|
-
export declare function getExtByType(type: CodeType): ".
|
|
9
|
+
export declare function getExtByType(type: CodeType): ".less" | ".js" | ".json";
|
|
10
10
|
export declare function HACK_FIX_LOWCODE_IN(code?: string): string;
|
|
11
11
|
export declare function HACK_FIX_LOWCODE_OUT(code?: string): string;
|
|
12
12
|
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formily.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/formily.ts"],"names":[],"mappings":"AASA,OAAO,EACL,UAAU,EAEV,UAAU,EAQV,kBAAkB,EACnB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"formily.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/formily.ts"],"names":[],"mappings":"AASA,OAAO,EACL,UAAU,EAEV,UAAU,EAQV,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAUlB,wBAAgB,SAAS,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,UAAU,CAwM3E;AAMD,wBAAgB,WAAW,CAAC,SAAS,EAAE,UAAU,GAAG,kBAAkB,CA+DrE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,MA2GtE"}
|
|
@@ -103,7 +103,7 @@ function serialize(webRuntimeAppData) {
|
|
|
103
103
|
return cmps;
|
|
104
104
|
}
|
|
105
105
|
function readDirectives(cmp) {
|
|
106
|
-
var _a;
|
|
106
|
+
var _a, _b, _c;
|
|
107
107
|
const directives = {};
|
|
108
108
|
if (cmp.data && cmp.data._visible !== true) {
|
|
109
109
|
directives.waIf = {
|
|
@@ -129,12 +129,17 @@ function serialize(webRuntimeAppData) {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
if (directives.waFor && ((_b = cmp.data) === null || _b === void 0 ? void 0 : _b._waForKey)) {
|
|
133
|
+
directives.waForKey = {
|
|
134
|
+
value: (_c = cmp.data) === null || _c === void 0 ? void 0 : _c._waForKey,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
132
137
|
return directives;
|
|
133
138
|
}
|
|
134
139
|
function readDynamicData(cmp) {
|
|
135
140
|
var _a;
|
|
136
141
|
const data = {};
|
|
137
|
-
const ignoredProps = ['_visible', '_waFor'];
|
|
142
|
+
const ignoredProps = ['_visible', '_waFor', '_waForKey'];
|
|
138
143
|
for (const prop in cmp.data) {
|
|
139
144
|
if (ignoredProps.indexOf(prop) > -1) {
|
|
140
145
|
continue;
|
|
@@ -294,7 +299,7 @@ function readCmpInstances(cmps) {
|
|
|
294
299
|
xProps.listenerInstances = readListeners(cmp.xProps.listeners) || [];
|
|
295
300
|
readDynamicData(cmp.xProps.data, xProps, cmp.properties);
|
|
296
301
|
if (cmp.xProps.directives) {
|
|
297
|
-
const { waIf, waFor } = cmp.xProps.directives;
|
|
302
|
+
const { waIf, waFor, waForKey } = cmp.xProps.directives;
|
|
298
303
|
if (waIf) {
|
|
299
304
|
if (waIf.type === 'static' || waIf.type === undefined) {
|
|
300
305
|
xProps.data = xProps.data || {};
|
|
@@ -324,6 +329,10 @@ function readCmpInstances(cmps) {
|
|
|
324
329
|
propertyPath: '_waFor',
|
|
325
330
|
type: 'bind',
|
|
326
331
|
});
|
|
332
|
+
if (waForKey && (waForKey.type === 'static' || waForKey.type === undefined)) {
|
|
333
|
+
xProps.data = xProps.data || {};
|
|
334
|
+
xProps.data._waForKey = waForKey.value;
|
|
335
|
+
}
|
|
327
336
|
}
|
|
328
337
|
}
|
|
329
338
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.34",
|
|
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@cloudbase/cals": "0.3.
|
|
38
|
+
"@cloudbase/cals": "0.3.34",
|
|
39
39
|
"@cloudbase/framework-core": "^1.8.16",
|
|
40
40
|
"@cloudbase/framework-plugin-auth": "^1.8.16",
|
|
41
41
|
"@cloudbase/framework-plugin-mp": "v1.3.6-beta.8",
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
></script>
|
|
451
451
|
<script
|
|
452
452
|
crossorigin="anonymous"
|
|
453
|
-
src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-client@0.2.
|
|
453
|
+
src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-client@0.2.18-alpha.1/dist/web.browser.js"
|
|
454
454
|
></script>
|
|
455
455
|
</body>
|
|
456
456
|
</html>
|