@cloudbase/framework-plugin-low-code 0.7.2-beta.0 → 0.7.2-beta.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/config/common.js +1 -1
- package/lib/builder/config/index.js +2 -2
- package/lib/builder/config/mp.js +1 -1
- package/lib/builder/core/copy.js +3 -3
- package/lib/builder/core/generate.js +11 -11
- package/lib/builder/core/index.js +13 -13
- package/lib/builder/core/material.js +6 -6
- package/lib/builder/core/plugin.js +3 -3
- package/lib/builder/core/prepare.js +2 -2
- package/lib/builder/core/webpack.js +5 -5
- package/lib/builder/mp/index.d.ts.map +1 -1
- package/lib/builder/mp/index.js +50 -49
- package/lib/builder/mp/lowcode.js +4 -4
- package/lib/builder/mp/materials.js +16 -16
- package/lib/builder/mp/mixMode.js +12 -12
- package/lib/builder/mp/mp_config.js +11 -11
- package/lib/builder/mp/util.js +6 -6
- package/lib/builder/mp/wxml.js +4 -4
- package/lib/builder/service/builder/copy.js +11 -11
- package/lib/builder/service/builder/generate.js +56 -52
- package/lib/builder/service/builder/index.js +2 -2
- package/lib/builder/service/builder/plugin.js +2 -2
- package/lib/builder/service/builder/webpack.js +24 -23
- package/lib/builder/types/common.js +1 -0
- package/lib/builder/util/common.d.ts.map +1 -1
- package/lib/builder/util/common.js +8 -6
- package/lib/builder/util/console.js +1 -1
- package/lib/builder/util/generateFiles.js +2 -2
- package/lib/builder/util/index.js +1 -1
- package/lib/builder/util/junk.js +4 -2
- package/lib/builder/util/mp.js +1 -1
- package/lib/builder/util/net.js +1 -1
- package/lib/builder/util/style.js +1 -1
- package/lib/builder/util/weapp.js +1 -1
- package/lib/generate.js +2 -2
- package/lib/generator/config/index.js +2 -2
- package/lib/generator/core/generate.js +36 -34
- package/lib/generator/core/index.js +4 -4
- package/lib/generator/core/material.js +14 -14
- package/lib/generator/types/common.js +6 -3
- package/lib/generator/util/common.d.ts.map +1 -1
- package/lib/generator/util/common.js +1 -1
- package/lib/generator/util/index.js +1 -1
- package/lib/generator/util/style.js +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +104 -66
- package/lib/utils/common.d.ts +1 -1
- package/lib/utils/common.d.ts.map +1 -1
- package/lib/utils/common.js +2 -2
- package/lib/utils/dataSource.js +2 -2
- package/lib/utils/index.js +1 -1
- package/lib/utils/postProcess.js +3 -3
- package/lib/weapps-core/config/index.js +1 -1
- package/lib/weapps-core/index.js +2 -2
- package/lib/weapps-core/types/index.js +1 -1
- package/lib/weapps-core/utils/appbuild.js +6 -3
- package/lib/weapps-core/utils/common.js +3 -2
- package/lib/weapps-core/utils/formily.js +37 -37
- package/lib/weapps-core/utils/index.js +1 -1
- package/lib/weapps-core/utils/style.js +15 -15
- package/package.json +1 -1
- package/template/mp/app/weapps-api.js +13 -5
- package/template/mp/app.js +59 -48
- package/template/mp/common/util.js +6 -4
- package/template/mp/common/weapp-page.js +2 -2
- package/template/src/app/global-api.js +15 -3
- package/template/src/handlers/utils/common.js +26 -20
- package/template/src/index.jsx +3 -2
|
@@ -20,7 +20,7 @@ const generateFiles_1 = require("../util/generateFiles");
|
|
|
20
20
|
function writeCode2file(mod, lowcodeRootDir, opts = {}, themeCode, ctx) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const { pageId = 'global', appDir, comp } = opts;
|
|
23
|
-
const file = path_1.default.join(lowcodeRootDir, weapps_core_1.getCodeModuleFilePath(pageId, mod, { style: '.wxss' }));
|
|
23
|
+
const file = path_1.default.join(lowcodeRootDir, (0, weapps_core_1.getCodeModuleFilePath)(pageId, mod, { style: '.wxss' }));
|
|
24
24
|
let code = mod.code;
|
|
25
25
|
if (mod.type !== 'style' && mod.type !== 'theme') {
|
|
26
26
|
if (appDir) {
|
|
@@ -43,16 +43,16 @@ function writeCode2file(mod, lowcodeRootDir, opts = {}, themeCode, ctx) {
|
|
|
43
43
|
else {
|
|
44
44
|
code = `${themeCode ? themeCode : ''}\n${code}`;
|
|
45
45
|
if (comp) {
|
|
46
|
-
code = `.${weapps_core_1.getCompositedComponentClass(comp)} {\n${code}\n}`;
|
|
46
|
+
code = `.${(0, weapps_core_1.getCompositedComponentClass)(comp)} {\n${code}\n}`;
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
code = yield style_1.processLessToRpx(`${code}`);
|
|
49
|
+
code = yield (0, style_1.processLessToRpx)(`${code}`);
|
|
50
50
|
}
|
|
51
51
|
catch (e) {
|
|
52
52
|
console.error('processLess Error', e);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
yield generateFiles_1.writeFile(file, code);
|
|
55
|
+
yield (0, generateFiles_1.writeFile)(file, code);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
exports.writeCode2file = writeCode2file;
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -53,7 +53,7 @@ function installMaterials(projDir, usedComps, weapps, ctx) {
|
|
|
53
53
|
const weappsList = ctx.isMixMode
|
|
54
54
|
? weapps
|
|
55
55
|
: weapps.filter((item) => !item.rootPath);
|
|
56
|
-
const localPkg = util_2.getCurrentPackageJson();
|
|
56
|
+
const localPkg = (0, util_2.getCurrentPackageJson)();
|
|
57
57
|
yield Promise.all(materialLibs
|
|
58
58
|
.filter((lib) => !lib.isComposite && usedComps[lib.name])
|
|
59
59
|
.map((lib) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -68,7 +68,7 @@ function installMaterials(projDir, usedComps, weapps, ctx) {
|
|
|
68
68
|
yield downloadMaterial(mpPkgUrl, materialsSrcDir);
|
|
69
69
|
}
|
|
70
70
|
function libUpdated(libDir, version) {
|
|
71
|
-
const meta = util_4.readComponentLibMata(libDir);
|
|
71
|
+
const meta = (0, util_4.readComponentLibMata)(libDir);
|
|
72
72
|
if (!meta) {
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
@@ -111,7 +111,7 @@ function installMaterials(projDir, usedComps, weapps, ctx) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const libMeta = util_4.readComponentLibMata(targetDir);
|
|
114
|
+
const libMeta = (0, util_4.readComponentLibMata)(targetDir);
|
|
115
115
|
if (!lib.components) {
|
|
116
116
|
lib.components = Object.keys((libMeta === null || libMeta === void 0 ? void 0 : libMeta.components) || {}).map((name) => {
|
|
117
117
|
var _a;
|
|
@@ -157,7 +157,7 @@ function installMaterials(projDir, usedComps, weapps, ctx) {
|
|
|
157
157
|
});
|
|
158
158
|
compositedLibs.map((lib) => __awaiter(this, void 0, void 0, function* () {
|
|
159
159
|
console.log('Generate composited library ' + lib.name);
|
|
160
|
-
yield util_4.writeLibCommonRes2file(lib, path.join(ctx.projDir, config_1.materialsDirName, lib.name, 'libCommonRes'));
|
|
160
|
+
yield (0, util_4.writeLibCommonRes2file)(lib, path.join(ctx.projDir, config_1.materialsDirName, lib.name, 'libCommonRes'));
|
|
161
161
|
return lib.components.map((cmp) => {
|
|
162
162
|
weappsList.forEach((app) => {
|
|
163
163
|
generateCompositeComponent(cmp, Object.assign({}, ctx), lib.compLibCommonResource);
|
|
@@ -184,7 +184,7 @@ function extractUsedCompsRecursively(comps, checkedComps, compositedLibs, output
|
|
|
184
184
|
if (checkedComps.indexOf(cmp) > -1)
|
|
185
185
|
return;
|
|
186
186
|
checkedComps.push(cmp);
|
|
187
|
-
const cmpsUsedByThisComp = wxml_1.getUsedComponents(cmp.componentInstances);
|
|
187
|
+
const cmpsUsedByThisComp = (0, wxml_1.getUsedComponents)(cmp.componentInstances);
|
|
188
188
|
const libs = Object.keys(cmpsUsedByThisComp);
|
|
189
189
|
libs.forEach((libName) => {
|
|
190
190
|
if (!usedComps[libName]) {
|
|
@@ -204,7 +204,7 @@ function downloadMaterial(zipUrl, dstFolder) {
|
|
|
204
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
205
|
if (fs.existsSync(path.join(dstFolder, 'meta.json')))
|
|
206
206
|
return;
|
|
207
|
-
yield net_1.downloadZip(zipUrl, dstFolder);
|
|
207
|
+
yield (0, net_1.downloadZip)(zipUrl, dstFolder);
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
function generateCompositeComponent(compositedComp, ctx, compLibCommonResource) {
|
|
@@ -212,16 +212,16 @@ function generateCompositeComponent(compositedComp, ctx, compLibCommonResource)
|
|
|
212
212
|
const { materialName } = compositedComp;
|
|
213
213
|
const outDir = path.join(ctx.projDir, ctx.rootPath || '', config_1.materialsDirName, materialName, compositedComp.name);
|
|
214
214
|
console.log(`Generating composited component ${materialName}:${compositedComp.name} to ${outDir}`);
|
|
215
|
-
const wxmlDataPrefix = mp_1.getWxmlDataPrefix(!ctx.isProduction);
|
|
215
|
+
const wxmlDataPrefix = (0, mp_1.getWxmlDataPrefix)(!ctx.isProduction);
|
|
216
216
|
const usingComponents = {};
|
|
217
217
|
const cmpContainer = Object.values(compositedComp.componentInstances)[0];
|
|
218
|
-
const wxml = wxml_1.generateWxml(compositedComp.componentInstances, 'Component ' + materialName + ':' + compositedComp.name, wxmlDataPrefix, Object.assign(Object.assign({}, ctx), { isPage: false }), usingComponents, (cmp, node) => {
|
|
218
|
+
const wxml = (0, wxml_1.generateWxml)(compositedComp.componentInstances, 'Component ' + materialName + ':' + compositedComp.name, wxmlDataPrefix, Object.assign(Object.assign({}, ctx), { isPage: false }), usingComponents, (cmp, node) => {
|
|
219
219
|
if (cmp === cmpContainer) {
|
|
220
220
|
const { attributes } = node;
|
|
221
|
-
const classAttrName = mp_1.getClassAttrName(node.name);
|
|
221
|
+
const classAttrName = (0, mp_1.getClassAttrName)(node.name);
|
|
222
222
|
const oldClass = attributes[classAttrName];
|
|
223
223
|
attributes[classAttrName] =
|
|
224
|
-
weapps_core_1.getCompositedComponentClass(compositedComp) +
|
|
224
|
+
(0, weapps_core_1.getCompositedComponentClass)(compositedComp) +
|
|
225
225
|
' ' +
|
|
226
226
|
oldClass +
|
|
227
227
|
' {{className}}';
|
|
@@ -246,13 +246,13 @@ function generateCompositeComponent(compositedComp, ctx, compLibCommonResource)
|
|
|
246
246
|
handlers: compositedComp.lowCodes
|
|
247
247
|
.filter((m) => m.type === 'handler-fn' && m.name !== '____index____')
|
|
248
248
|
.map((m) => m.name),
|
|
249
|
-
eventHandlers: util_3.createEventHanlders(compositedComp.componentInstances, weapps_core_1.COMPONENT_API_PREFIX, ctx),
|
|
249
|
+
eventHandlers: (0, util_3.createEventHanlders)(compositedComp.componentInstances, weapps_core_1.COMPONENT_API_PREFIX, ctx),
|
|
250
250
|
emitEvents: compositedComp.emitEvents.map((evt) => evt.eventName),
|
|
251
|
-
widgetProps: util_3.createWidgetProps(compositedComp.componentInstances, ctx),
|
|
251
|
+
widgetProps: (0, util_3.createWidgetProps)(compositedComp.componentInstances, ctx),
|
|
252
252
|
compApi: weapps_core_1.COMPONENT_API_PREFIX,
|
|
253
253
|
jsonSchemaType2jsClass: mp_1.jsonSchemaType2jsClass,
|
|
254
254
|
key: compositedComp.materialName + ':' + compositedComp.name,
|
|
255
|
-
dataBinds: util_3.createDataBinds(compositedComp.componentInstances, ctx),
|
|
255
|
+
dataBinds: (0, util_3.createDataBinds)(compositedComp.componentInstances, ctx),
|
|
256
256
|
debug: !ctx.isProduction,
|
|
257
257
|
stringifyObj: util_1.inspect,
|
|
258
258
|
formEvents: Object.keys(formEvents).length > 0 ? formEvents : null,
|
|
@@ -264,7 +264,7 @@ function generateCompositeComponent(compositedComp, ctx, compLibCommonResource)
|
|
|
264
264
|
},
|
|
265
265
|
'index.wxss': {},
|
|
266
266
|
};
|
|
267
|
-
yield generateFiles_1.default(pageFileData, templateDir + '/component', outDir, ctx);
|
|
267
|
+
yield (0, generateFiles_1.default)(pageFileData, templateDir + '/component', outDir, ctx);
|
|
268
268
|
const codes = [...compositedComp.lowCodes];
|
|
269
269
|
if (!codes.find((m) => m.name === 'index')) {
|
|
270
270
|
codes.push({
|
|
@@ -284,7 +284,7 @@ function generateCompositeComponent(compositedComp, ctx, compLibCommonResource)
|
|
|
284
284
|
${compLibCommonResource.theme.class || ''}
|
|
285
285
|
`;
|
|
286
286
|
}
|
|
287
|
-
return lowcode_1.writeCode2file(mod, path.join(outDir, 'lowcode'), { comp: compositedComp }, themeCode, ctx);
|
|
287
|
+
return (0, lowcode_1.writeCode2file)(mod, path.join(outDir, 'lowcode'), { comp: compositedComp }, themeCode, ctx);
|
|
288
288
|
});
|
|
289
289
|
});
|
|
290
290
|
}
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -43,7 +43,7 @@ const webpack_1 = require("../service/builder/webpack");
|
|
|
43
43
|
function handleMixMode({ apps = [], generateMpPath, miniprogramRoot, plugins = [], }) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
yield handleSubApps();
|
|
46
|
-
yield webpack_1.installDependencies(miniprogramRoot);
|
|
46
|
+
yield (0, webpack_1.installDependencies)(miniprogramRoot);
|
|
47
47
|
yield handlePlugins();
|
|
48
48
|
function handleMainApp() {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -117,7 +117,7 @@ function handleMixMode({ apps = [], generateMpPath, miniprogramRoot, plugins = [
|
|
|
117
117
|
}
|
|
118
118
|
const packageJosnPath = path_1.default.join(subAppPath, 'package.json');
|
|
119
119
|
if (fs_extra_1.default.existsSync(packageJosnPath)) {
|
|
120
|
-
mergeDependencies = Object.assign(Object.assign({}, mergeDependencies), (yield mp_1.mergePackageDependiences(mergeDependencies, yield fs_extra_1.default.readJson(packageJosnPath))));
|
|
120
|
+
mergeDependencies = Object.assign(Object.assign({}, mergeDependencies), (yield (0, mp_1.mergePackageDependiences)(mergeDependencies, yield fs_extra_1.default.readJson(packageJosnPath))));
|
|
121
121
|
modifiedPackageJosn = true;
|
|
122
122
|
}
|
|
123
123
|
yield Promise.all([
|
|
@@ -131,21 +131,21 @@ function handleMixMode({ apps = [], generateMpPath, miniprogramRoot, plugins = [
|
|
|
131
131
|
].map((name) => {
|
|
132
132
|
let clearPath = path_1.default.join(subAppPath, name);
|
|
133
133
|
return name.includes('.')
|
|
134
|
-
? generateFiles_1.removeFile(clearPath)
|
|
135
|
-
: generateFiles_1.cleanDir(clearPath, []);
|
|
134
|
+
? (0, generateFiles_1.removeFile)(clearPath)
|
|
135
|
+
: (0, generateFiles_1.cleanDir)(clearPath, []);
|
|
136
136
|
}));
|
|
137
137
|
})));
|
|
138
138
|
if (modifiedAppJson) {
|
|
139
|
-
yield fs_extra_1.writeFile(rootAppJosnPath, JSON.stringify(rootAppJosn, undefined, 2));
|
|
139
|
+
yield (0, fs_extra_1.writeFile)(rootAppJosnPath, JSON.stringify(rootAppJosn, undefined, 2));
|
|
140
140
|
}
|
|
141
141
|
if (modifiedPackageJosn) {
|
|
142
|
-
yield fs_extra_1.writeFile(rootPackageJosnPath, JSON.stringify(Object.assign(Object.assign({}, rootPackageJson), mp_1.mergePackageDependiences(mergeDependencies, rootPackageJson)), undefined, 2));
|
|
142
|
+
yield (0, fs_extra_1.writeFile)(rootPackageJosnPath, JSON.stringify(Object.assign(Object.assign({}, rootPackageJson), (0, mp_1.mergePackageDependiences)(mergeDependencies, rootPackageJson)), undefined, 2));
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
function handlePlugins() {
|
|
147
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
const mpPlugins = (yield plugin_1.getPluginType(generateMpPath, plugins)).filter((item) => item.type === 'mp');
|
|
148
|
+
const mpPlugins = (yield (0, plugin_1.getPluginType)(generateMpPath, plugins)).filter((item) => item.type === 'mp');
|
|
149
149
|
return Promise.all(mpPlugins.map((plugin) => __awaiter(this, void 0, void 0, function* () {
|
|
150
150
|
const pluginModule = plugin.module;
|
|
151
151
|
const pluginNodeModuleDir = path_1.default.resolve(generateMpPath, 'node_modules', pluginModule);
|
|
@@ -161,15 +161,15 @@ function handleMixMode({ apps = [], generateMpPath, miniprogramRoot, plugins = [
|
|
|
161
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
162
|
const baseAppJsonPath = path_1.default.join(generateMpPath, 'app.json');
|
|
163
163
|
const mergeAppJsonPath = path_1.default.join(miniprogramRoot, 'app.json');
|
|
164
|
-
yield mp_1.mergePages(baseAppJsonPath, mergeAppJsonPath);
|
|
165
|
-
yield mp_1.mergeSubPackages(baseAppJsonPath, mergeAppJsonPath);
|
|
164
|
+
yield (0, mp_1.mergePages)(baseAppJsonPath, mergeAppJsonPath);
|
|
165
|
+
yield (0, mp_1.mergeSubPackages)(baseAppJsonPath, mergeAppJsonPath);
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
function handlePkgJson() {
|
|
169
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
170
|
const basePkgJsonPath = path_1.default.join(generateMpPath, 'package.json');
|
|
171
171
|
const mergePkgJsonPath = path_1.default.join(miniprogramRoot, 'package.json');
|
|
172
|
-
yield mp_1.mergePackageJson(basePkgJsonPath, mergePkgJsonPath);
|
|
172
|
+
yield (0, mp_1.mergePackageJson)(basePkgJsonPath, mergePkgJsonPath);
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
});
|
|
@@ -209,7 +209,7 @@ function removeDirs(dirs) {
|
|
|
209
209
|
}
|
|
210
210
|
function readDirs(dirPath) {
|
|
211
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
-
const isDirectory = (source) => fs_extra_1.lstatSync(source).isDirectory();
|
|
212
|
+
const isDirectory = (source) => (0, fs_extra_1.lstatSync)(source).isDirectory();
|
|
213
213
|
return ((yield fs_extra_1.default.readdir(dirPath)) || []).filter((name) => isDirectory(path_1.default.join(dirPath, name)));
|
|
214
214
|
});
|
|
215
215
|
}
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -47,7 +47,7 @@ function generateMpConfig(weapps, ctx) {
|
|
|
47
47
|
useExtendedLib: { weui: true },
|
|
48
48
|
};
|
|
49
49
|
const { miniprogramPlugins = [] } = ctx;
|
|
50
|
-
const projConfig = lodash_1.merge({}, mp_1.defaultProjConfig, {
|
|
50
|
+
const projConfig = (0, lodash_1.merge)({}, mp_1.defaultProjConfig, {
|
|
51
51
|
projectname: 'WeDa-' + ctx.appId,
|
|
52
52
|
});
|
|
53
53
|
const pageConfigs = weapps.map((app) => {
|
|
@@ -56,15 +56,15 @@ function generateMpConfig(weapps, ctx) {
|
|
|
56
56
|
const kbConfig = (_a = app.lowCodes) === null || _a === void 0 ? void 0 : _a.find((m) => m.name === config_1.MP_CONFIG_MODULE_NAME);
|
|
57
57
|
if (kbConfig) {
|
|
58
58
|
const { pagesConfigJson = {} } = eval(`(${kbConfig.code.replace(/export\s+default/, '')})`);
|
|
59
|
-
lodash_1.merge(pageConfig, pagesConfigJson);
|
|
59
|
+
(0, lodash_1.merge)(pageConfig, pagesConfigJson);
|
|
60
60
|
}
|
|
61
|
-
lodash_1.merge(pageConfig, getAppPagesConfig((app === null || app === void 0 ? void 0 : app.pageInstanceList) || []));
|
|
61
|
+
(0, lodash_1.merge)(pageConfig, getAppPagesConfig((app === null || app === void 0 ? void 0 : app.pageInstanceList) || []));
|
|
62
62
|
return pageConfig;
|
|
63
63
|
});
|
|
64
64
|
const kbConfig = (_a = weapps[0].lowCodes) === null || _a === void 0 ? void 0 : _a.find((m) => m.name === config_1.MP_CONFIG_MODULE_NAME);
|
|
65
65
|
if (kbConfig) {
|
|
66
66
|
const { projectConfigJson = {}, appJson = {} } = eval(`(${kbConfig.code.replace(/export\s+default/, '')})`);
|
|
67
|
-
lodash_1.merge(projConfig, projectConfigJson);
|
|
67
|
+
(0, lodash_1.merge)(projConfig, projectConfigJson);
|
|
68
68
|
const matertialMetaIgnores = ctx.materialLibs
|
|
69
69
|
.filter((lib) => !lib.isComposite)
|
|
70
70
|
.reduce((arr, lib) => {
|
|
@@ -75,10 +75,10 @@ function generateMpConfig(weapps, ctx) {
|
|
|
75
75
|
if (appJson.tabBar) {
|
|
76
76
|
parseTabConfig(appJson.tabBar, ctx.projDir);
|
|
77
77
|
}
|
|
78
|
-
lodash_1.merge(appConfig, appJson);
|
|
78
|
+
(0, lodash_1.merge)(appConfig, appJson);
|
|
79
79
|
}
|
|
80
80
|
const _b = weapps[0].appConfig || {}, { tradingCapability } = _b, mainAppConfig = __rest(_b, ["tradingCapability"]);
|
|
81
|
-
lodash_1.merge(appConfig, mainAppConfig, extractPages(weapps, pageConfigs));
|
|
81
|
+
(0, lodash_1.merge)(appConfig, mainAppConfig, extractPages(weapps, pageConfigs));
|
|
82
82
|
if (tradingCapability) {
|
|
83
83
|
const tradePluginKey = `weda-mini-shop-plugin`;
|
|
84
84
|
const pluginMeta = {
|
|
@@ -102,7 +102,7 @@ function generateMpConfig(weapps, ctx) {
|
|
|
102
102
|
miniprogramPlugins.forEach((plugin) => {
|
|
103
103
|
var _a, _b;
|
|
104
104
|
if (!((_b = (_a = appConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b[plugin.name])) {
|
|
105
|
-
lodash_1.set(appConfig, `plugins.${plugin.name}`, {
|
|
105
|
+
(0, lodash_1.set)(appConfig, `plugins.${plugin.name}`, {
|
|
106
106
|
version: plugin.version,
|
|
107
107
|
provider: plugin.pluginAppId,
|
|
108
108
|
});
|
|
@@ -122,9 +122,9 @@ function extractPages(weapps, pageConfigs) {
|
|
|
122
122
|
if (rootPath) {
|
|
123
123
|
subpackages.push(subPackage);
|
|
124
124
|
}
|
|
125
|
-
weapps_core_1.loopDealWithFn(weapp.pageInstanceList || [], (page) => {
|
|
125
|
+
(0, weapps_core_1.loopDealWithFn)(weapp.pageInstanceList || [], (page) => {
|
|
126
126
|
const pageConfig = pageConfigs[index];
|
|
127
|
-
const pageFileName = lodash_1.get(pageConfig, `${page.id}.pageFileName`, 'index');
|
|
127
|
+
const pageFileName = (0, lodash_1.get)(pageConfig, `${page.id}.pageFileName`, 'index');
|
|
128
128
|
if (rootPath) {
|
|
129
129
|
subPackage.pages.push(`pages/${page.id}/${pageFileName}`);
|
|
130
130
|
}
|
|
@@ -177,7 +177,7 @@ function parseTabConfig(tabBar, projDir) {
|
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
const iconPath = 'assets/tab' + index + '/' + filename + path.extname(iconUrl);
|
|
180
|
-
net_1.downloadFile(iconUrl, projDir + '/' + iconPath).catch((e) => {
|
|
180
|
+
(0, net_1.downloadFile)(iconUrl, projDir + '/' + iconPath).catch((e) => {
|
|
181
181
|
console.error(chalk_1.default.red(`Fail to download tabBar icon from ${iconUrl}`), e);
|
|
182
182
|
});
|
|
183
183
|
return iconPath;
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -8,7 +8,7 @@ const mp_1 = require("../config/mp");
|
|
|
8
8
|
function extractWidgetProps(props) {
|
|
9
9
|
const { classList } = props;
|
|
10
10
|
const staticProps = {
|
|
11
|
-
style: weapps_core_1.toCssStyle(props.commonStyle, {
|
|
11
|
+
style: (0, weapps_core_1.toCssStyle)(props.commonStyle, {
|
|
12
12
|
toRpx: true,
|
|
13
13
|
toRem: false,
|
|
14
14
|
}),
|
|
@@ -85,7 +85,7 @@ function generateDataBind(bind) {
|
|
|
85
85
|
exports.generateDataBind = generateDataBind;
|
|
86
86
|
function createWidgetProps(widgets, ctx) {
|
|
87
87
|
const widgetProps = {};
|
|
88
|
-
weapp_1.walkThroughWidgets(widgets, (id, widget, parentId) => {
|
|
88
|
+
(0, weapp_1.walkThroughWidgets)(widgets, (id, widget, parentId) => {
|
|
89
89
|
var _a;
|
|
90
90
|
const { xComponent } = widget;
|
|
91
91
|
const xProps = widget.xProps || {};
|
|
@@ -108,7 +108,7 @@ function createWidgetProps(widgets, ctx) {
|
|
|
108
108
|
exports.createWidgetProps = createWidgetProps;
|
|
109
109
|
function createEventHanlders(widgets, componentApi, ctx) {
|
|
110
110
|
const eventHanlders = {};
|
|
111
|
-
weapp_1.walkThroughWidgets(widgets, (id, widget, parentId) => {
|
|
111
|
+
(0, weapp_1.walkThroughWidgets)(widgets, (id, widget, parentId) => {
|
|
112
112
|
var _a, _b, _c;
|
|
113
113
|
const { xComponent } = widget;
|
|
114
114
|
const xProps = widget.xProps || {};
|
|
@@ -147,7 +147,7 @@ function createEventHanlders(widgets, componentApi, ctx) {
|
|
|
147
147
|
}
|
|
148
148
|
listeners.forEach((l) => {
|
|
149
149
|
var _a, _b, _c, _d;
|
|
150
|
-
const handlerName = wxml_1.getMpEventHanlderName(id, l.trigger, l);
|
|
150
|
+
const handlerName = (0, wxml_1.getMpEventHanlderName)(id, l.trigger, l);
|
|
151
151
|
eventHanlders[handlerName] = eventHanlders[handlerName] || [];
|
|
152
152
|
const params = generatedDynamicData(l.data);
|
|
153
153
|
let handler = (_a = l.handler) === null || _a === void 0 ? void 0 : _a.name;
|
|
@@ -175,7 +175,7 @@ function createEventHanlders(widgets, componentApi, ctx) {
|
|
|
175
175
|
});
|
|
176
176
|
});
|
|
177
177
|
if ((_c = compProto === null || compProto === void 0 ? void 0 : compProto.compConfig) === null || _c === void 0 ? void 0 : _c.isDataContainer) {
|
|
178
|
-
const customName = wxml_1.getMpEventHanlderName(id, 'onDataChange', {});
|
|
178
|
+
const customName = (0, wxml_1.getMpEventHanlderName)(id, 'onDataChange', {});
|
|
179
179
|
eventHanlders[customName] = [{
|
|
180
180
|
key: `wa${Date.now().toString().slice(-8)}`,
|
|
181
181
|
handler: `({event}) => {
|
|
@@ -192,7 +192,7 @@ function createEventHanlders(widgets, componentApi, ctx) {
|
|
|
192
192
|
exports.createEventHanlders = createEventHanlders;
|
|
193
193
|
function createDataBinds(widgets, ctx) {
|
|
194
194
|
const dataBinds = {};
|
|
195
|
-
weapp_1.walkThroughWidgets(widgets, (id, widget, parentId) => {
|
|
195
|
+
(0, weapp_1.walkThroughWidgets)(widgets, (id, widget, parentId) => {
|
|
196
196
|
var _a;
|
|
197
197
|
const { xComponent } = widget;
|
|
198
198
|
const xProps = widget.xProps || {};
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -101,7 +101,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
101
101
|
console.error(error(`Component(${xComponent.name}) not found in lib(${xComponent.moduleName}). ${helpMsg}`));
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
|
-
const { tagName, path } = materials_1.getWxmlTag(xComponent, ctx, nameMangler);
|
|
104
|
+
const { tagName, path } = (0, materials_1.getWxmlTag)(xComponent, ctx, nameMangler);
|
|
105
105
|
if (path) {
|
|
106
106
|
usingComponents[tagName] = path;
|
|
107
107
|
}
|
|
@@ -142,7 +142,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
142
142
|
attributes: {
|
|
143
143
|
id: idAttr,
|
|
144
144
|
style: `{{${attrPrefix}style}}`,
|
|
145
|
-
[mp_1.getClassAttrName(tagName)]: `{{${attrPrefix}className}}`,
|
|
145
|
+
[(0, mp_1.getClassAttrName)(tagName)]: `{{${attrPrefix}className}}`,
|
|
146
146
|
},
|
|
147
147
|
elements: [],
|
|
148
148
|
_order: xIndex || 0,
|
|
@@ -245,7 +245,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, nod
|
|
|
245
245
|
}
|
|
246
246
|
return elements.sort((a, b) => a._order - b._order);
|
|
247
247
|
}
|
|
248
|
-
return xml_js_1.js2xml(xmlJson, {
|
|
248
|
+
return (0, xml_js_1.js2xml)(xmlJson, {
|
|
249
249
|
spaces: '\t',
|
|
250
250
|
});
|
|
251
251
|
}
|
|
@@ -286,7 +286,7 @@ function getEventBindSep(tagName) {
|
|
|
286
286
|
return mp_1.nativeCompWhiteList.includes(tagName.toLowerCase()) ? '' : ':';
|
|
287
287
|
}
|
|
288
288
|
function getUsedComponents(widgets, usedCmps = {}) {
|
|
289
|
-
weapp_1.walkThroughWidgets(widgets, (id, widget) => {
|
|
289
|
+
(0, weapp_1.walkThroughWidgets)(widgets, (id, widget) => {
|
|
290
290
|
const { xComponent } = widget;
|
|
291
291
|
if (!xComponent)
|
|
292
292
|
return;
|
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -46,13 +46,13 @@ function copyEntryFile(appBuildDir, appContent, adminPortalKey) {
|
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
47
|
const entryFilePath = path_1.default.resolve(config_1.appTemplateDir, './src/index.jsx');
|
|
48
48
|
const content = yield fs_extra_1.default.readFile(entryFilePath);
|
|
49
|
-
yield fs_extra_1.default.writeFile(path_1.default.join(appBuildDir, 'src/index.jsx'), lodash_template_1.default(content + '')(Object.assign({ adminPortalKey, yyptAppKey: '', reportUrl: '', stopReport: false }, appContent)), { flag: 'w' });
|
|
49
|
+
yield fs_extra_1.default.writeFile(path_1.default.join(appBuildDir, 'src/index.jsx'), (0, lodash_template_1.default)(content + '')(Object.assign({ adminPortalKey, yyptAppKey: '', reportUrl: '', stopReport: false }, appContent)), { flag: 'w' });
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
exports.copyEntryFile = copyEntryFile;
|
|
53
53
|
function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDir) {
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const localPkg = util_1.getCurrentPackageJson();
|
|
55
|
+
const localPkg = (0, util_1.getCurrentPackageJson)();
|
|
56
56
|
yield Promise.all(dependencies.map((componentLib) => __awaiter(this, void 0, void 0, function* () {
|
|
57
57
|
var _a, _b, _c, _d, _e;
|
|
58
58
|
const { name, version } = componentLib;
|
|
@@ -76,7 +76,7 @@ function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDir) {
|
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
try {
|
|
79
|
-
const meta = util_1.readComponentLibMata(librariesDir);
|
|
79
|
+
const meta = (0, util_1.readComponentLibMata)(librariesDir);
|
|
80
80
|
if (meta === null || meta === void 0 ? void 0 : meta.schemaVersion) {
|
|
81
81
|
componentLib['schemaVersion'] = meta === null || meta === void 0 ? void 0 : meta.schemaVersion;
|
|
82
82
|
}
|
|
@@ -87,7 +87,7 @@ function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDir) {
|
|
|
87
87
|
}
|
|
88
88
|
catch (e) { }
|
|
89
89
|
try {
|
|
90
|
-
const packageJson = fs_extra_1.readJsonSync(path_1.default.join(materialDir, 'package.json'));
|
|
90
|
+
const packageJson = (0, fs_extra_1.readJsonSync)(path_1.default.join(materialDir, 'package.json'));
|
|
91
91
|
if ((_c = (_b = packageJson.weda) === null || _b === void 0 ? void 0 : _b.platform) === null || _c === void 0 ? void 0 : _c.web) {
|
|
92
92
|
const entries = (_e = (_d = packageJson.weda) === null || _d === void 0 ? void 0 : _d.platform) === null || _e === void 0 ? void 0 : _e.web;
|
|
93
93
|
componentLib['entries'] = {
|
|
@@ -116,16 +116,16 @@ function genCompositeComponentLibraries(dependencies = [], appBuildDir, material
|
|
|
116
116
|
yield Promise.all(components.map((component) => __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
let compItem = component;
|
|
118
118
|
compItem.materialName = name;
|
|
119
|
-
const wrapperClass = weapps_core_1.getCompositedComponentClass(compItem);
|
|
119
|
+
const wrapperClass = (0, weapps_core_1.getCompositedComponentClass)(compItem);
|
|
120
120
|
const componentSchemaJson = {
|
|
121
121
|
type: 'object',
|
|
122
|
-
properties: weapps_core_1.readCmpInstances(compItem.componentInstances),
|
|
122
|
+
properties: (0, weapps_core_1.readCmpInstances)(compItem.componentInstances),
|
|
123
123
|
};
|
|
124
|
-
const { widgets, dataBinds, componentSchema } = generate_1.getComponentSchemaString(componentSchemaJson, true, componentsInfoMap, wrapperClass);
|
|
124
|
+
const { widgets, dataBinds, componentSchema } = (0, generate_1.getComponentSchemaString)(componentSchemaJson, true, componentsInfoMap, wrapperClass);
|
|
125
125
|
const templateData = {
|
|
126
126
|
id: compItem.id,
|
|
127
127
|
name: compItem.name,
|
|
128
|
-
defaultProps: json_schema_defaults_1.default({
|
|
128
|
+
defaultProps: (0, json_schema_defaults_1.default)({
|
|
129
129
|
type: 'object',
|
|
130
130
|
properties: compItem.dataForm || {},
|
|
131
131
|
}),
|
|
@@ -168,14 +168,14 @@ function genCompositeComponentLibraries(dependencies = [], appBuildDir, material
|
|
|
168
168
|
widgets,
|
|
169
169
|
dataBinds,
|
|
170
170
|
componentSchema,
|
|
171
|
-
pageListenerInstances: generate_1.getListenersString(compItem.listeners, true),
|
|
171
|
+
pageListenerInstances: (0, generate_1.getListenersString)(compItem.listeners, true),
|
|
172
172
|
materialName: name,
|
|
173
173
|
};
|
|
174
174
|
const dest = path_1.default.resolve(librariesDir, `./components/${compItem.name}/index.jsx`);
|
|
175
175
|
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './src/pages/composite.tpl'), {
|
|
176
176
|
encoding: 'utf8',
|
|
177
177
|
});
|
|
178
|
-
const jsx = lodash_template_1.default(template)(templateData);
|
|
178
|
+
const jsx = (0, lodash_template_1.default)(template)(templateData);
|
|
179
179
|
yield fs_extra_1.default.ensureFile(dest);
|
|
180
180
|
yield fs_extra_1.default.writeFile(dest, jsx);
|
|
181
181
|
})));
|