@cloudbase/framework-plugin-low-code 0.6.52 → 0.6.55
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.js +47 -47
- 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.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/index.js +1 -1
- package/lib/generator/util/style.js +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +81 -76
- 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/file.d.ts +1 -1
- 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/html/index.html.ejs +8 -2
- package/template/mp/app/weapps-api.js +9 -0
- package/template/mp/common/weapp-page.js +11 -0
- package/template/mp/common/weapp-sdk.js +35 -0
- package/template/src/app/global-api.js +3 -0
- package/template/webpack/web.prod.js +6 -2
|
@@ -67,7 +67,7 @@ function generateAllPageJsxFile(pageInstanceList, appBuildDir, rootPath, depende
|
|
|
67
67
|
compProps: {},
|
|
68
68
|
}, buildTypeList) {
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
yield Promise.all(weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependencies, extraData, buildTypeList)));
|
|
70
|
+
yield Promise.all((0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependencies, extraData, buildTypeList)));
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
exports.generateAllPageJsxFile = generateAllPageJsxFile;
|
|
@@ -79,7 +79,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
79
79
|
const fixedDependencies = dependencies;
|
|
80
80
|
const { componentSchemaJson, pluginInstances, listenerInstances: pageListenerInstances, style: PageStyle, data, } = pageInstance;
|
|
81
81
|
const { originComponentList, originActionList, } = getOriginComponentAndActionList(componentSchemaJson, fixedDependencies);
|
|
82
|
-
const componentsMeta = yield util_1.getComponentsInfo(appBuildDir, dependencies);
|
|
82
|
+
const componentsMeta = yield (0, util_1.getComponentsInfo)(appBuildDir, dependencies);
|
|
83
83
|
const originPluginList = getOriginPluginList(pluginInstances, dependencies);
|
|
84
84
|
pullActionToListByInstances(pageListenerInstances, originActionList, fixedDependencies);
|
|
85
85
|
const originEntryMap = {};
|
|
@@ -108,7 +108,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
108
108
|
const actionImportStringArr = getActionImportStringArr(originActionList);
|
|
109
109
|
const pluginImportStringArr = getPluginImportStringArr(originPluginList);
|
|
110
110
|
const { widgets, dataBinds, componentSchema } = getComponentSchemaString(componentSchemaJson, false, componentsMeta);
|
|
111
|
-
const pageStyleString = weapps_core_1.toCssText(weapps_core_1.toCssStyle(PageStyle), common_1.buildAsWebByBuildType(buildTypeList) ? 'body' : 'page');
|
|
111
|
+
const pageStyleString = (0, weapps_core_1.toCssText)((0, weapps_core_1.toCssStyle)(PageStyle), (0, common_1.buildAsWebByBuildType)(buildTypeList) ? 'body' : 'page');
|
|
112
112
|
const templateData = {
|
|
113
113
|
pageUUID: rootPath ? `${rootPath}/${pageInstance.id}` : pageInstance.id,
|
|
114
114
|
pageName: pageInstance.id,
|
|
@@ -131,7 +131,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
131
131
|
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './src/pages/app.tpl'), {
|
|
132
132
|
encoding: 'utf8',
|
|
133
133
|
});
|
|
134
|
-
const jsx = lodash_template_1.default(template)(templateData);
|
|
134
|
+
const jsx = (0, lodash_template_1.default)(template)(templateData);
|
|
135
135
|
yield fs_extra_1.default.ensureFile(dest);
|
|
136
136
|
yield fs_extra_1.default.writeFile(dest, jsx);
|
|
137
137
|
const pageStyleDest = path_1.default.resolve(appBuildDir, `./pages/${pageInstance.id}/index.less`);
|
|
@@ -168,7 +168,7 @@ function getOriginPluginList(pluginInstances = [], dependencies = [], originPlug
|
|
|
168
168
|
pluginInstances.map((instance) => {
|
|
169
169
|
var _a;
|
|
170
170
|
const { sourceKey } = instance;
|
|
171
|
-
const { materialName, name, variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
171
|
+
const { materialName, name, variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
172
172
|
const pluginKey = `${materialName}_${name}`;
|
|
173
173
|
const isExist = originPluginList.find((item) => item.key === pluginKey);
|
|
174
174
|
if (isExist) {
|
|
@@ -192,7 +192,7 @@ function pullActionToListByInstances(listenerInstances, originActionList, fixedD
|
|
|
192
192
|
}
|
|
193
193
|
listenerInstances.map((pageListenerInstance) => {
|
|
194
194
|
const { sourceKey, type } = pageListenerInstance;
|
|
195
|
-
const { materialName, name, variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
195
|
+
const { materialName, name, variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
196
196
|
const material = fixedDependencies.find((m) => m.name === materialName);
|
|
197
197
|
const actionKey = `${materialName}_${name}`;
|
|
198
198
|
const isExistAction = originActionList.find((item) => item.key === actionKey);
|
|
@@ -211,7 +211,7 @@ function pullActionToListByInstances(listenerInstances, originActionList, fixedD
|
|
|
211
211
|
}
|
|
212
212
|
exports.pullActionToListByInstances = pullActionToListByInstances;
|
|
213
213
|
function pullComponentToListByInstance(sourceKey, originComponentList, fixedDependencies) {
|
|
214
|
-
const { materialName, name, variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
214
|
+
const { materialName, name, variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
215
215
|
const componentKey = `${materialName}_${name}`;
|
|
216
216
|
const isExistComponent = originComponentList.find((item) => item.key === componentKey);
|
|
217
217
|
if (!isExistComponent) {
|
|
@@ -249,11 +249,11 @@ function isSlot(comp) {
|
|
|
249
249
|
}
|
|
250
250
|
exports.isSlot = isSlot;
|
|
251
251
|
function getComponentSchemaString(componentSchema, isComposite = false, componentsInfoMap = {}, wrapperClass) {
|
|
252
|
-
const componentInputProps = util_1.getInputProps(componentsInfoMap) || {};
|
|
253
|
-
const copyJson = util_1.simpleDeepClone(componentSchema);
|
|
252
|
+
const componentInputProps = (0, util_1.getInputProps)(componentsInfoMap) || {};
|
|
253
|
+
const copyJson = (0, util_1.simpleDeepClone)(componentSchema);
|
|
254
254
|
const compWidgets = {};
|
|
255
255
|
const compDataBinds = {};
|
|
256
|
-
const componentSchemaJson = util_1.deepDealSchema(copyJson, (schema) => {
|
|
256
|
+
const componentSchemaJson = (0, util_1.deepDealSchema)(copyJson, (schema) => {
|
|
257
257
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
258
258
|
const { 'x-props': xProps = {}, properties } = schema;
|
|
259
259
|
const { dataBinds = [], commonStyle = {}, data = {}, classNameList = [], sourceKey, styleBind, classNameListBind, staticResourceAttribute = [], } = xProps;
|
|
@@ -271,8 +271,9 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
271
271
|
schema['emitEvents'] = componentInfo.emitEvents.map((item) => item.eventName);
|
|
272
272
|
}
|
|
273
273
|
if (!isSlot(schema) && schema.key) {
|
|
274
|
-
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: weapps_core_1.toCssStyle(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(schema.parent)
|
|
275
|
-
? (_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
|
|
274
|
+
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: (0, weapps_core_1.toCssStyle)(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(schema.parent)
|
|
275
|
+
? (_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
|
|
276
|
+
: (_h = schema === null || schema === void 0 ? void 0 : schema.parent) === null || _h === void 0 ? void 0 : _h.key });
|
|
276
277
|
if (dataBinds.length > 0) {
|
|
277
278
|
compDataBinds[schema.key] = generateDataBinds(dataBinds, isComposite);
|
|
278
279
|
}
|
|
@@ -290,7 +291,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
290
291
|
compDataBinds[schema.key] = Object.assign(Object.assign({}, (compDataBinds[schema.key] || {})), generateDataBinds([classNameListBind], isComposite));
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
|
-
if (properties && weapps_core_1.isEmptyObj(properties)) {
|
|
294
|
+
if (properties && (0, weapps_core_1.isEmptyObj)(properties)) {
|
|
294
295
|
delete schema.properties;
|
|
295
296
|
}
|
|
296
297
|
delete schema.type;
|
|
@@ -301,7 +302,8 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
301
302
|
if (propsVaule && Array.isArray(propsVaule)) {
|
|
302
303
|
propsVaule.map((block) => {
|
|
303
304
|
var _a, _b;
|
|
304
|
-
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) &&
|
|
305
|
+
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) &&
|
|
306
|
+
((_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);
|
|
305
307
|
if (blockInstance) {
|
|
306
308
|
block.selectableBlock['x-props'].listenerInstances = generateListnerInstances(blockInstance, isComposite);
|
|
307
309
|
}
|
|
@@ -318,12 +320,12 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
318
320
|
xProps['classNameList'].push(wrapperClass);
|
|
319
321
|
}
|
|
320
322
|
}
|
|
321
|
-
xProps['commonStyle'] = weapps_core_1.toCssStyle(xProps['commonStyle']);
|
|
323
|
+
xProps['commonStyle'] = (0, weapps_core_1.toCssStyle)(xProps['commonStyle']);
|
|
322
324
|
xProps['staticResourceAttribute'] = staticResourceAttribute;
|
|
323
|
-
if (weapps_core_1.isEmptyObj(xProps['commonStyle'])) {
|
|
325
|
+
if ((0, weapps_core_1.isEmptyObj)(xProps['commonStyle'])) {
|
|
324
326
|
delete xProps['commonStyle'];
|
|
325
327
|
}
|
|
326
|
-
if (weapps_core_1.isEmptyObj(xProps['style'])) {
|
|
328
|
+
if ((0, weapps_core_1.isEmptyObj)(xProps['style'])) {
|
|
327
329
|
delete xProps['style'];
|
|
328
330
|
}
|
|
329
331
|
if (xProps['dataBinds'] && xProps['dataBinds'].length === 0) {
|
|
@@ -345,7 +347,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
345
347
|
xPropsData.staticResourceAttribute.length === 0) {
|
|
346
348
|
delete xPropsData.staticResourceAttribute;
|
|
347
349
|
}
|
|
348
|
-
if (weapps_core_1.isEmptyObj(xPropsData)) {
|
|
350
|
+
if ((0, weapps_core_1.isEmptyObj)(xPropsData)) {
|
|
349
351
|
delete xProps['data'];
|
|
350
352
|
}
|
|
351
353
|
}
|
|
@@ -387,9 +389,9 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
387
389
|
}
|
|
388
390
|
});
|
|
389
391
|
return {
|
|
390
|
-
widgets: util_1.JsonToStringWithVariableName(compWidgets),
|
|
391
|
-
dataBinds: util_1.JsonToStringWithVariableName(compDataBinds),
|
|
392
|
-
componentSchema: util_1.JsonToStringWithVariableName(componentSchemaJson),
|
|
392
|
+
widgets: (0, util_1.JsonToStringWithVariableName)(compWidgets),
|
|
393
|
+
dataBinds: (0, util_1.JsonToStringWithVariableName)(compDataBinds),
|
|
394
|
+
componentSchema: (0, util_1.JsonToStringWithVariableName)(componentSchemaJson),
|
|
393
395
|
};
|
|
394
396
|
}
|
|
395
397
|
exports.getComponentSchemaString = getComponentSchemaString;
|
|
@@ -477,7 +479,7 @@ function generateListnerInstances(listenerInstances, isComposite = false) {
|
|
|
477
479
|
};
|
|
478
480
|
if (listener.type === weapps_core_1.ActionType.Material) {
|
|
479
481
|
const { sourceKey } = listener;
|
|
480
|
-
const { variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
482
|
+
const { variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
481
483
|
generatedListener.instanceFunction = `${config_1.REPLACE_SIGN}${variableName}${config_1.REPLACE_SIGN}`;
|
|
482
484
|
}
|
|
483
485
|
else if (listener.type === weapps_core_1.ActionType.Platform) {
|
|
@@ -502,7 +504,7 @@ function generateListnerInstances(listenerInstances, isComposite = false) {
|
|
|
502
504
|
generatedListener.instanceFunction = `${config_1.REPLACE_SIGN}handler.${((_e = listener.handler) === null || _e === void 0 ? void 0 : _e.name) || listener.jsCode}${config_1.REPLACE_SIGN}`;
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
|
-
if (!weapps_core_1.isEmptyObj(listener.data)) {
|
|
507
|
+
if (!(0, weapps_core_1.isEmptyObj)(listener.data)) {
|
|
506
508
|
generatedListener.data = listener.data;
|
|
507
509
|
}
|
|
508
510
|
if (listener.dataBinds && listener.dataBinds.length > 0) {
|
|
@@ -512,20 +514,20 @@ function generateListnerInstances(listenerInstances, isComposite = false) {
|
|
|
512
514
|
});
|
|
513
515
|
}
|
|
514
516
|
function getListenersString(listeners = [], isComposite = false) {
|
|
515
|
-
return util_1.JsonToStringWithVariableName(generateListnerInstances(listeners, isComposite));
|
|
517
|
+
return (0, util_1.JsonToStringWithVariableName)(generateListnerInstances(listeners, isComposite));
|
|
516
518
|
}
|
|
517
519
|
exports.getListenersString = getListenersString;
|
|
518
520
|
function getPluginInstancesString(instances) {
|
|
519
521
|
if (!instances || !instances.length) {
|
|
520
522
|
return '[]';
|
|
521
523
|
}
|
|
522
|
-
const copyInstances = util_1.simpleDeepClone(instances);
|
|
524
|
+
const copyInstances = (0, util_1.simpleDeepClone)(instances);
|
|
523
525
|
copyInstances.map((itemInstance) => {
|
|
524
526
|
const { sourceKey } = itemInstance;
|
|
525
|
-
const { variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
527
|
+
const { variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
526
528
|
itemInstance.instanceFunction = `${config_1.REPLACE_SIGN}${variableName}${config_1.REPLACE_SIGN}`;
|
|
527
529
|
});
|
|
528
|
-
return util_1.JsonToStringWithVariableName(copyInstances);
|
|
530
|
+
return (0, util_1.JsonToStringWithVariableName)(copyInstances);
|
|
529
531
|
}
|
|
530
532
|
exports.getPluginInstancesString = getPluginInstancesString;
|
|
531
533
|
function getPluginImportStringArr(plugins, pluginImportStringArr = []) {
|
|
@@ -548,7 +550,7 @@ function getComponentImportStringArr(components, componentImportStringArr = [])
|
|
|
548
550
|
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)}'`;
|
|
549
551
|
}
|
|
550
552
|
else if (entries === null || entries === void 0 ? void 0 : entries.entry) {
|
|
551
|
-
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
553
|
+
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
552
554
|
importString = `const { ${name}: ${lodash_1.default.upperFirst(variableName)} } = ${componentsLibVariableName}.components`;
|
|
553
555
|
}
|
|
554
556
|
else {
|
|
@@ -564,7 +566,7 @@ exports.getComponentImportStringArr = getComponentImportStringArr;
|
|
|
564
566
|
function getEntryImportStringArr(materialInfoList = [], entryImportStringArr = []) {
|
|
565
567
|
materialInfoList.forEach(({ materialName, version, entries }) => {
|
|
566
568
|
if (!((entries === null || entries === void 0 ? void 0 : entries.actions) && (entries === null || entries === void 0 ? void 0 : entries.components)) && (entries === null || entries === void 0 ? void 0 : entries.entry)) {
|
|
567
|
-
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
569
|
+
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
568
570
|
const importComponentLibString = `import ${componentsLibVariableName} from '${path_1.default.posix.join(`libraries/${materialName}@${version}`, entries === null || entries === void 0 ? void 0 : entries.entry)}'`;
|
|
569
571
|
if (!entryImportStringArr.includes(importComponentLibString)) {
|
|
570
572
|
entryImportStringArr.push(importComponentLibString);
|
|
@@ -585,9 +587,11 @@ function getActionImportStringArr(originActionList, actionImportStringArr = [])
|
|
|
585
587
|
exports.getActionImportStringArr = getActionImportStringArr;
|
|
586
588
|
function pushActionToImportStringArr(listenerInstance, actionImportStringArr) {
|
|
587
589
|
const { name, materialName, materialVersion, variableName, entries, } = listenerInstance;
|
|
588
|
-
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
589
|
-
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions)
|
|
590
|
-
|
|
590
|
+
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
591
|
+
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions)
|
|
592
|
+
? `import { ${name} as ${variableName} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.actions)}'`
|
|
593
|
+
: (entries === null || entries === void 0 ? void 0 : entries.entry)
|
|
594
|
+
? `const { ${name}: ${variableName} } = ${componentsLibVariableName}.actions`
|
|
591
595
|
: `import ${variableName} from 'libraries/${materialName}@${materialVersion}/actions/${name}'`;
|
|
592
596
|
if (actionImportStringArr.includes(importString)) {
|
|
593
597
|
return;
|
|
@@ -604,7 +608,7 @@ function generateRouterFile(allAppDataList, appBuildDir, basename = '', buildTyp
|
|
|
604
608
|
const { pageInstanceList, rootPath = '' } = data;
|
|
605
609
|
const pageFilePath = rootPath ? `packages/${rootPath}/` : '';
|
|
606
610
|
mountApis.push(`import '${pageFilePath}app/mountAppApis';`);
|
|
607
|
-
weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => {
|
|
611
|
+
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
608
612
|
const pageId = [rootPath, pageInstance.id].filter((i) => i).join('_');
|
|
609
613
|
if (pageInstance.isHome && !rootPath) {
|
|
610
614
|
routerRenders.push(`<Route from="/" exact children={() => <Redirect to="/${pageId}" />} />`);
|
|
@@ -616,7 +620,7 @@ function generateRouterFile(allAppDataList, appBuildDir, basename = '', buildTyp
|
|
|
616
620
|
const routerTemplate = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './src/router/index.tpl'), {
|
|
617
621
|
encoding: 'utf8',
|
|
618
622
|
});
|
|
619
|
-
const routerIndexStr = lodash_template_1.default(routerTemplate)({
|
|
623
|
+
const routerIndexStr = (0, lodash_template_1.default)(routerTemplate)({
|
|
620
624
|
routerImports: routerImports.join('\n'),
|
|
621
625
|
routerRenders: routerRenders.join('\n'),
|
|
622
626
|
mountApis: mountApis.join('\n'),
|
|
@@ -632,19 +636,19 @@ function writeLowCodeFiles(appData, appBuildDir) {
|
|
|
632
636
|
return __awaiter(this, void 0, void 0, function* () {
|
|
633
637
|
const lowcodeRootDir = path_1.default.join(appBuildDir, 'lowcode');
|
|
634
638
|
console.log(chalk_1.default.blue.bold('Writing lowcode files:'));
|
|
635
|
-
generateFiles_1.cleanDir(lowcodeRootDir, []);
|
|
636
|
-
style_1.generateDefaultTheme(appData);
|
|
639
|
+
(0, generateFiles_1.cleanDir)(lowcodeRootDir, []);
|
|
640
|
+
(0, style_1.generateDefaultTheme)(appData);
|
|
637
641
|
const themeCode = appData.codeModules.find((mod) => mod.type === 'theme');
|
|
638
642
|
yield Promise.all(appData.codeModules.map((m) => writeCode2file(m, 'global')));
|
|
639
|
-
yield Promise.all(weapps_core_1.loopDealWithFn(appData.pageInstanceList, (page) => __awaiter(this, void 0, void 0, function* () {
|
|
640
|
-
style_1.generateDefaultStyle(page);
|
|
643
|
+
yield Promise.all((0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList, (page) => __awaiter(this, void 0, void 0, function* () {
|
|
644
|
+
(0, style_1.generateDefaultStyle)(page);
|
|
641
645
|
yield page.codeModules
|
|
642
646
|
.filter((m) => m.name !== '____index____')
|
|
643
647
|
.forEach((m) => writeCode2file(m, page.id));
|
|
644
648
|
})));
|
|
645
649
|
function writeCode2file(mod, pageId) {
|
|
646
650
|
return __awaiter(this, void 0, void 0, function* () {
|
|
647
|
-
const file = path_1.default.join(lowcodeRootDir, weapps_core_1.getCodeModuleFilePath(pageId, mod));
|
|
651
|
+
const file = path_1.default.join(lowcodeRootDir, (0, weapps_core_1.getCodeModuleFilePath)(pageId, mod));
|
|
648
652
|
let weappsApiPrefix = '';
|
|
649
653
|
if (mod.type !== 'theme') {
|
|
650
654
|
weappsApiPrefix =
|
|
@@ -657,7 +661,7 @@ function writeLowCodeFiles(appData, appBuildDir) {
|
|
|
657
661
|
console.log(chalk_1.default.green(file));
|
|
658
662
|
let code = mod.code;
|
|
659
663
|
if (mod.type === 'style') {
|
|
660
|
-
code = yield style_1.processLess(((themeCode === null || themeCode === void 0 ? void 0 : themeCode.code) || style_1.defaultThemeCode) + code);
|
|
664
|
+
code = yield (0, style_1.processLess)(((themeCode === null || themeCode === void 0 ? void 0 : themeCode.code) || style_1.defaultThemeCode) + code);
|
|
661
665
|
}
|
|
662
666
|
yield fs_extra_1.default.ensureFile(file);
|
|
663
667
|
yield fs_extra_1.default.writeFile(file, weappsApiPrefix + os_1.default.EOL + code);
|
|
@@ -671,7 +675,7 @@ function writeLowCodeFilesForCompositeComp(compositeGroups, appBuildDir) {
|
|
|
671
675
|
const lowcodeRootDir = path_1.default.join(appBuildDir, 'src', 'lowcode', 'composite');
|
|
672
676
|
console.log(chalk_1.default.blue.bold('Writing composite component lowcode files:'));
|
|
673
677
|
yield Promise.all(compositeGroups.map((gItem) => __awaiter(this, void 0, void 0, function* () {
|
|
674
|
-
yield util_2.writeLibCommonRes2file(gItem, path_1.default.join(appBuildDir, 'src', 'libraries', `${gItem.name}@${gItem.version}`, 'libCommonRes'));
|
|
678
|
+
yield (0, util_2.writeLibCommonRes2file)(gItem, path_1.default.join(appBuildDir, 'src', 'libraries', `${gItem.name}@${gItem.version}`, 'libCommonRes'));
|
|
675
679
|
const compLibCommonResource = gItem.compLibCommonResource;
|
|
676
680
|
let themeCode = '';
|
|
677
681
|
if (compLibCommonResource) {
|
|
@@ -689,13 +693,13 @@ function writeLowCodeFilesForCompositeComp(compositeGroups, appBuildDir) {
|
|
|
689
693
|
function writeCode2file(mod, lowcodeDir, comp, themeCode) {
|
|
690
694
|
return __awaiter(this, void 0, void 0, function* () {
|
|
691
695
|
const pageId = comp.name + '_' + comp.id;
|
|
692
|
-
const file = path_1.default.join(lowcodeDir, weapps_core_1.getCodeModuleFilePath(pageId, mod));
|
|
696
|
+
const file = path_1.default.join(lowcodeDir, (0, weapps_core_1.getCodeModuleFilePath)(pageId, mod));
|
|
693
697
|
yield fs_extra_1.default.ensureFile(file);
|
|
694
698
|
let codeContent = '';
|
|
695
699
|
if (mod.type === 'style') {
|
|
696
|
-
codeContent = `.${weapps_core_1.getCompositedComponentClass(comp)} { \n${themeCode ? themeCode : ''}\n${mod.code}\n }`;
|
|
700
|
+
codeContent = `.${(0, weapps_core_1.getCompositedComponentClass)(comp)} { \n${themeCode ? themeCode : ''}\n${mod.code}\n }`;
|
|
697
701
|
try {
|
|
698
|
-
codeContent = yield style_1.processLess(`${codeContent}`);
|
|
702
|
+
codeContent = yield (0, style_1.processLess)(`${codeContent}`);
|
|
699
703
|
}
|
|
700
704
|
catch (e) {
|
|
701
705
|
console.error(`样式转换失败 [${pageId}] :`, e, codeContent);
|
|
@@ -715,11 +719,11 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
715
719
|
return __awaiter(this, void 0, void 0, function* () {
|
|
716
720
|
const pageIds = [];
|
|
717
721
|
const pageModules = {};
|
|
718
|
-
weapps_core_1.loopDealWithFn(appData.pageInstanceList, (p) => {
|
|
722
|
+
(0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList, (p) => {
|
|
719
723
|
pageIds.push(p.id);
|
|
720
724
|
pageModules[p.id] = p.codeModules;
|
|
721
725
|
});
|
|
722
|
-
const yyptConfig = yield util_2.getYyptConfigInfo(extraData);
|
|
726
|
+
const yyptConfig = yield (0, util_2.getYyptConfigInfo)(extraData);
|
|
723
727
|
const templatesData = {
|
|
724
728
|
'store/index.js': {
|
|
725
729
|
pageIds,
|
|
@@ -742,7 +746,7 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
742
746
|
.map((m) => m.name),
|
|
743
747
|
},
|
|
744
748
|
'datasources/index.js.tpl': {
|
|
745
|
-
isXPage: common_1.buildAsXPageByBuildType(buildTypeList),
|
|
749
|
+
isXPage: (0, common_1.buildAsXPageByBuildType)(buildTypeList),
|
|
746
750
|
},
|
|
747
751
|
'datasources/config.js.tpl': {
|
|
748
752
|
appID: appKey,
|
|
@@ -750,14 +754,14 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
750
754
|
isProd: deployMode === types_1.DEPLOY_MODE.UPLOAD,
|
|
751
755
|
},
|
|
752
756
|
'datasources/datasource-profiles.js.tpl': {
|
|
753
|
-
datasourceProfiles: util_1.JsonToStringWithVariableName(dataSource_1.getDatasourceProfiles(appData.datasources || [])),
|
|
757
|
+
datasourceProfiles: (0, util_1.JsonToStringWithVariableName)((0, dataSource_1.getDatasourceProfiles)(appData.datasources || [])),
|
|
754
758
|
},
|
|
755
759
|
'datasources/dataset-profiles.js.tpl': {
|
|
756
|
-
datasetProfiles: util_1.JsonToStringWithVariableName(dataSource_1.getDatasetProfiles(appData, [appData])),
|
|
760
|
+
datasetProfiles: (0, util_1.JsonToStringWithVariableName)((0, dataSource_1.getDatasetProfiles)(appData, [appData])),
|
|
757
761
|
},
|
|
758
762
|
'handlers/utils/common.js': {
|
|
759
|
-
isAdminPortal: common_1.buildAsAdminPortalByBuildType(buildTypeList),
|
|
760
|
-
isXPage: common_1.buildAsXPageByBuildType(buildTypeList),
|
|
763
|
+
isAdminPortal: (0, common_1.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
764
|
+
isXPage: (0, common_1.buildAsXPageByBuildType)(buildTypeList),
|
|
761
765
|
},
|
|
762
766
|
};
|
|
763
767
|
if (!rootPath) {
|
|
@@ -768,7 +772,7 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
768
772
|
const tplStr = yield fs_extra_1.default.readFile(path_1.default.join(config_1.appTemplateDir, 'src', file), {
|
|
769
773
|
encoding: 'utf8',
|
|
770
774
|
});
|
|
771
|
-
const generatedCode = lodash_template_1.default(tplStr, {
|
|
775
|
+
const generatedCode = (0, lodash_template_1.default)(tplStr, {
|
|
772
776
|
interpolate: /<%=([\s\S]+?)%>/g,
|
|
773
777
|
})(templatesData[file]);
|
|
774
778
|
const outFile = path_1.default.resolve(appBuildDir, file.replace(/.tpl$/, ''));
|
|
@@ -34,7 +34,7 @@ function createNodeModulesSoftLink(appBuildDir, nodeModulesPath) {
|
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
const destPath = path_1.default.join(appBuildDir, 'node_modules');
|
|
36
36
|
if (!fs_extra_1.default.existsSync(destPath)) {
|
|
37
|
-
util_1.promiseWrapper(symlink_dir_1.default(nodeModulesPath, destPath));
|
|
37
|
+
(0, util_1.promiseWrapper)((0, symlink_dir_1.default)(nodeModulesPath, destPath));
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -42,7 +42,7 @@ exports.createNodeModulesSoftLink = createNodeModulesSoftLink;
|
|
|
42
42
|
function getStoreModuleList(appData) {
|
|
43
43
|
const storeModuleList = [];
|
|
44
44
|
extractRematchModules(appData.codeModules);
|
|
45
|
-
weapps_core_1.loopDealWithFn(appData.pageInstanceList, (pageInstance) => {
|
|
45
|
+
(0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList, (pageInstance) => {
|
|
46
46
|
extractRematchModules(pageInstance.codeModules);
|
|
47
47
|
});
|
|
48
48
|
return storeModuleList;
|
|
@@ -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
|
};
|
|
@@ -49,7 +49,7 @@ function installMpPlugin(appBuildDir, plugins) {
|
|
|
49
49
|
yield fs.copy(pluginNodeModuleSrcDir, mpBuildPluginDir, {
|
|
50
50
|
overwrite: true,
|
|
51
51
|
});
|
|
52
|
-
yield mp_1.mergeSubPackages(mpBuildAppJsonPath, pluginAppJsonPath);
|
|
52
|
+
yield (0, mp_1.mergeSubPackages)(mpBuildAppJsonPath, pluginAppJsonPath);
|
|
53
53
|
}))).catch(err => console.error(err));
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -33,7 +33,7 @@ const console_1 = require("../../util/console");
|
|
|
33
33
|
const types_1 = require("../../../types");
|
|
34
34
|
const index_1 = require("../../../index");
|
|
35
35
|
const index_2 = require("./index");
|
|
36
|
-
const yarnExists = command_exists_1.sync('yarn');
|
|
36
|
+
const yarnExists = (0, command_exists_1.sync)('yarn');
|
|
37
37
|
const runningCompilations = {};
|
|
38
38
|
function startCompile(options, cb) {
|
|
39
39
|
const key = options.configPath;
|
|
@@ -43,8 +43,8 @@ function startCompile(options, cb) {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
console.log('Running webpack by ' + options.configPath);
|
|
46
|
-
util_1.removeRequireUncached(path_1.default.resolve(options.configPath, '../miniprogram.config.js'));
|
|
47
|
-
const watching = webpack_1.default(util_1.requireUncached(options.configPath), (err, stats) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
(0, util_1.removeRequireUncached)(path_1.default.resolve(options.configPath, '../miniprogram.config.js'));
|
|
47
|
+
const watching = (0, webpack_1.default)((0, util_1.requireUncached)(options.configPath), (err, stats) => __awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
if (err) {
|
|
49
49
|
console.error('webpack config error', err.stack || err);
|
|
50
50
|
if (err.details) {
|
|
@@ -158,7 +158,7 @@ function downloadAndWriteTabBarIcon(iconPath, pagePath, appBuildDir, fileName) {
|
|
|
158
158
|
const fileFullPath = path_1.default.resolve(appBuildDir, `dist/mp/${relativePath}`);
|
|
159
159
|
yield fs_extra_1.default.ensureFile(fileFullPath);
|
|
160
160
|
const writer = fs_extra_1.default.createWriteStream(fileFullPath);
|
|
161
|
-
const response = yield axios_1.default({
|
|
161
|
+
const response = yield (0, axios_1.default)({
|
|
162
162
|
method: 'get',
|
|
163
163
|
url: iconPath,
|
|
164
164
|
responseType: 'stream',
|
|
@@ -246,7 +246,7 @@ function generateMpJsonConfigFile(allAppDataList, userConfig, appBuildDir, plugi
|
|
|
246
246
|
kbConfig.generate = Object.assign(Object.assign({}, kbConfig.generate), { app: 'noemit' });
|
|
247
247
|
}
|
|
248
248
|
if (plugins.length > 0) {
|
|
249
|
-
kbConfig.generate.subpackages = Object.assign(Object.assign({}, kbConfig.generate.subpackages), (yield plugin_1.getPluginKboneSubpackage(appBuildDir, plugins)));
|
|
249
|
+
kbConfig.generate.subpackages = Object.assign(Object.assign({}, kbConfig.generate.subpackages), (yield (0, plugin_1.getPluginKboneSubpackage)(appBuildDir, plugins)));
|
|
250
250
|
}
|
|
251
251
|
const templateStr = JSON.stringify(kbConfig, null, 2);
|
|
252
252
|
yield fs_extra_1.default.writeFile(path_1.default.resolve(appBuildDir, 'webpack/miniprogram.config.js'), `module.exports = ${templateStr}`);
|
|
@@ -259,7 +259,7 @@ function getMainAppDataByList(allAppDataList) {
|
|
|
259
259
|
exports.getMainAppDataByList = getMainAppDataByList;
|
|
260
260
|
function getHomePageInstance(pageInstanceList) {
|
|
261
261
|
let target = pageInstanceList[0];
|
|
262
|
-
weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => {
|
|
262
|
+
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
263
263
|
if (pageInstance.isHome) {
|
|
264
264
|
target = pageInstance;
|
|
265
265
|
return pageInstance;
|
|
@@ -277,7 +277,7 @@ function getMpAllRouterConfig(allAppDataList, getHome = false) {
|
|
|
277
277
|
let homePath = '';
|
|
278
278
|
allAppDataList.map((appData) => {
|
|
279
279
|
const { pageInstanceList, rootPath = '' } = appData;
|
|
280
|
-
weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => {
|
|
280
|
+
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
281
281
|
const name = [rootPath, pageInstance.id].filter((i) => i).join('_');
|
|
282
282
|
const path = `/${name}`;
|
|
283
283
|
if (!homePath) {
|
|
@@ -310,7 +310,7 @@ function getWebpackWebBuildParams(appId, appBuildDir, materialsDir, dependencies
|
|
|
310
310
|
assets
|
|
311
311
|
.filter((assetUrl) => !!assetUrl)
|
|
312
312
|
.forEach((assetUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
const fileName = common_1.getFileNameByUrl(assetUrl);
|
|
313
|
+
const fileName = (0, common_1.getFileNameByUrl)(assetUrl);
|
|
314
314
|
jsApis.push(`./${fileName}`);
|
|
315
315
|
yield downloadAssets(targetDir, assetUrl);
|
|
316
316
|
}));
|
|
@@ -354,7 +354,7 @@ function getWebpackWebBuildParams(appId, appBuildDir, materialsDir, dependencies
|
|
|
354
354
|
path_1.default.resolve(appBuildDir, 'src'),
|
|
355
355
|
...getMaterialNodeModulesPathList(dependencies, materialsDir),
|
|
356
356
|
],
|
|
357
|
-
definePlugin: Object.assign({ 'process.env.buildType': `"${buildTypeList[0]}"`, 'process.env.isApp': buildTypeList.includes("app"), 'process.env.isAdminPortal': common_2.buildAsAdminPortalByBuildType(buildTypeList) }, extraDefine),
|
|
357
|
+
definePlugin: Object.assign({ 'process.env.buildType': `"${buildTypeList[0]}"`, 'process.env.isApp': buildTypeList.includes("app"), 'process.env.isAdminPortal': (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList) }, extraDefine),
|
|
358
358
|
devtool: ['app-nvzcvt10', 'app-msa2ihs9'].includes(appId)
|
|
359
359
|
? 'source-map'
|
|
360
360
|
: mode !== "production"
|
|
@@ -398,7 +398,7 @@ function getAllPageMpEntryPath(allAppDataList, appBuildDir, options = { generate
|
|
|
398
398
|
allAppDataList.map((app) => {
|
|
399
399
|
const { pageInstanceList, rootPath } = app;
|
|
400
400
|
const packagePathStr = rootPath ? `packages/${rootPath}` : '';
|
|
401
|
-
weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => {
|
|
401
|
+
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
402
402
|
const pageName = rootPath
|
|
403
403
|
? `${rootPath}_${pageInstance.id}`
|
|
404
404
|
: pageInstance.id;
|
|
@@ -411,7 +411,7 @@ exports.getAllPageMpEntryPath = getAllPageMpEntryPath;
|
|
|
411
411
|
const dependenciesMap = new Map();
|
|
412
412
|
function downloadAndInstallDependencies(dependencies = [], materialsDir, installOptions = {}) {
|
|
413
413
|
return __awaiter(this, void 0, void 0, function* () {
|
|
414
|
-
const localPkg = util_1.getCurrentPackageJson();
|
|
414
|
+
const localPkg = (0, util_1.getCurrentPackageJson)();
|
|
415
415
|
yield Promise.all(dependencies.map(({ name, version, srcZipUrl }) => __awaiter(this, void 0, void 0, function* () {
|
|
416
416
|
const materialNameVersion = `${name}@${version}`;
|
|
417
417
|
const targetDir = path_1.default.join(materialsDir, materialNameVersion);
|
|
@@ -420,11 +420,11 @@ function downloadAndInstallDependencies(dependencies = [], materialsDir, install
|
|
|
420
420
|
return;
|
|
421
421
|
}
|
|
422
422
|
if (dependenciesMap.get(targetDir)) {
|
|
423
|
-
console_1.notice(`${materialNameVersion} 存在 ${targetDir},无需安装, 如果依赖库报错,请重启wa watch`);
|
|
423
|
+
(0, console_1.notice)(`${materialNameVersion} 存在 ${targetDir},无需安装, 如果依赖库报错,请重启wa watch`);
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
426
|
const matched = srcZipUrl.match(/\/(cg-.*?)\//);
|
|
427
|
-
const { appBuildDir } = index_2.getCompileDirs('app');
|
|
427
|
+
const { appBuildDir } = (0, index_2.getCompileDirs)('app');
|
|
428
428
|
if (matched &&
|
|
429
429
|
matched[1] &&
|
|
430
430
|
fs_extra_1.default.existsSync(path_1.default.resolve(appBuildDir, `.component_cache/web/${matched[1]}@${version}`))) {
|
|
@@ -436,7 +436,8 @@ function downloadAndInstallDependencies(dependencies = [], materialsDir, install
|
|
|
436
436
|
yield downloadDependencies(targetDir, srcZipUrl);
|
|
437
437
|
}
|
|
438
438
|
console.log(`处理${name}@${version}依赖 ...`);
|
|
439
|
-
yield installDependencies(targetDir, Object.assign(Object.assign({}, installOptions), { ignoreInstall: common_1.isOfficialComponentLib(name, version) ||
|
|
439
|
+
yield installDependencies(targetDir, Object.assign(Object.assign({}, installOptions), { ignoreInstall: (0, common_1.isOfficialComponentLib)(name, version) ||
|
|
440
|
+
(installOptions === null || installOptions === void 0 ? void 0 : installOptions.ignoreInstall), dependenceMeta: {
|
|
440
441
|
name,
|
|
441
442
|
version,
|
|
442
443
|
downloadUrl: srcZipUrl,
|
|
@@ -453,7 +454,7 @@ function downloadDependencies(targetDir, srcZipUrl) {
|
|
|
453
454
|
return;
|
|
454
455
|
}
|
|
455
456
|
try {
|
|
456
|
-
let response = yield axios_1.default({
|
|
457
|
+
let response = yield (0, axios_1.default)({
|
|
457
458
|
url: srcZipUrl,
|
|
458
459
|
responseType: 'stream',
|
|
459
460
|
});
|
|
@@ -501,21 +502,21 @@ function installDependencies(targetDir, options = {}) {
|
|
|
501
502
|
let installProcess;
|
|
502
503
|
if (yarnExists && (options === null || options === void 0 ? void 0 : options.runtime) !== types_1.RUNTIME.CI) {
|
|
503
504
|
const addPackage = packageName ? ['add', packageName] : [];
|
|
504
|
-
installProcess = cross_spawn_1.default('yarn', [...addPackage, registry], {
|
|
505
|
+
installProcess = (0, cross_spawn_1.default)('yarn', [...addPackage, registry], {
|
|
505
506
|
cwd: targetDir,
|
|
506
507
|
env: process.env,
|
|
507
508
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
508
509
|
});
|
|
509
510
|
}
|
|
510
511
|
else {
|
|
511
|
-
installProcess = cross_spawn_1.default('npm', ['install', packageName, ...npmOptions], {
|
|
512
|
+
installProcess = (0, cross_spawn_1.default)('npm', ['install', packageName, ...npmOptions], {
|
|
512
513
|
cwd: targetDir,
|
|
513
514
|
env: process.env,
|
|
514
515
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
515
516
|
});
|
|
516
517
|
}
|
|
517
518
|
installProcess.on('exit', () => console.timeEnd(operationTag));
|
|
518
|
-
yield process_1.promisifyProcess(installProcess);
|
|
519
|
+
yield (0, process_1.promisifyProcess)(installProcess);
|
|
519
520
|
try {
|
|
520
521
|
yield fs_extra_1.default.remove(path_1.default.join(path_1.default.join(targetDir, 'package-lock.json')));
|
|
521
522
|
yield fs_extra_1.default.remove(path_1.default.join(path_1.default.join(targetDir, 'yarn.lock')));
|
|
@@ -525,7 +526,7 @@ function installDependencies(targetDir, options = {}) {
|
|
|
525
526
|
}
|
|
526
527
|
exports.installDependencies = installDependencies;
|
|
527
528
|
function getMaterialNodeModulesPathList(dependencies = [], materialsDir) {
|
|
528
|
-
const localPkg = util_1.getCurrentPackageJson();
|
|
529
|
+
const localPkg = (0, util_1.getCurrentPackageJson)();
|
|
529
530
|
return dependencies.map(({ name, version }) => {
|
|
530
531
|
const nameVersion = `${name}@${version}`;
|
|
531
532
|
if (localPkg && localPkg.name === name && localPkg.version === version) {
|
|
@@ -542,11 +543,11 @@ function generateWebpackWebDevServerFile({ appBuildDir, buildTypeList, }) {
|
|
|
542
543
|
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_2.appTemplateDir, './webpack/devServer.js'), {
|
|
543
544
|
encoding: 'utf8',
|
|
544
545
|
});
|
|
545
|
-
const jsContent = lodash_template_1.default(template, {
|
|
546
|
+
const jsContent = (0, lodash_template_1.default)(template, {
|
|
546
547
|
interpolate: /<%=([\s\S]+?)%>/g,
|
|
547
548
|
})({
|
|
548
549
|
isApp: buildTypeList.includes("app"),
|
|
549
|
-
isAdminPortal: common_2.buildAsAdminPortalByBuildType(buildTypeList),
|
|
550
|
+
isAdminPortal: (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
550
551
|
});
|
|
551
552
|
yield fs_extra_1.default.ensureFile(dest);
|
|
552
553
|
yield fs_extra_1.default.writeFile(dest, jsContent);
|
|
@@ -559,7 +560,7 @@ function downloadAssets(targetDir, assetUrl) {
|
|
|
559
560
|
if (isExist) {
|
|
560
561
|
return;
|
|
561
562
|
}
|
|
562
|
-
const [err, response] = yield util_1.promiseWrapper(axios_1.default({
|
|
563
|
+
const [err, response] = yield (0, util_1.promiseWrapper)((0, axios_1.default)({
|
|
563
564
|
url: assetUrl,
|
|
564
565
|
responseType: 'stream',
|
|
565
566
|
}));
|
|
@@ -568,7 +569,7 @@ function downloadAssets(targetDir, assetUrl) {
|
|
|
568
569
|
throw err;
|
|
569
570
|
}
|
|
570
571
|
yield fs_extra_1.default.ensureDir(targetDir);
|
|
571
|
-
const filename = common_1.getFileNameByUrl(assetUrl);
|
|
572
|
+
const filename = (0, common_1.getFileNameByUrl)(assetUrl);
|
|
572
573
|
const targetPath = path_1.default.resolve(targetDir, `./${filename}`);
|
|
573
574
|
const writer = fs_extra_1.default.createWriteStream(targetPath);
|
|
574
575
|
response.data.pipe(writer);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAsXPageByBuildType = exports.buildAsAdminPortalByBuildType = exports.buildAsWebByBuildType = void 0;
|
|
3
4
|
var common_1 = require("../../generator/types/common");
|
|
4
5
|
Object.defineProperty(exports, "buildAsWebByBuildType", { enumerable: true, get: function () { return common_1.buildAsWebByBuildType; } });
|
|
5
6
|
Object.defineProperty(exports, "buildAsAdminPortalByBuildType", { enumerable: true, get: function () { return common_1.buildAsAdminPortalByBuildType; } });
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.isOfficialComponentLib = exports.readComponentLibMata = exports.writeLibCommonRes2file = exports.getYyptConfigInfo = exports.getComponentsInfo = exports.getInputProps = exports.removeRequireUncached = exports.requireUncached = exports.JsonToStringWithVariableName = exports.getSelfPackageJson = exports.getCurrentPackageJson = exports.promiseWrapper = void 0;
|
|
15
|
+
exports.isOfficialComponentLib = exports.readComponentLibMata = exports.writeLibCommonRes2file = exports.getYyptConfigInfo = exports.getComponentsInfo = exports.getInputProps = exports.removeRequireUncached = exports.requireUncached = exports.JsonToStringWithVariableName = exports.getSelfPackageJson = exports.getCurrentPackageJson = exports.promiseWrapper = exports.getFileNameByUrl = exports.deepDealSchema = exports.simpleDeepClone = exports.deepDeal = exports.isPlainObject = exports.isArray = exports.getMetaInfoBySourceKey = void 0;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
18
|
const style_1 = require("./style");
|
|
@@ -89,7 +89,8 @@ function getInputProps(componentsMetaMap) {
|
|
|
89
89
|
let compItem = component;
|
|
90
90
|
Object.keys(compItem.dataForm || {}).forEach((key) => {
|
|
91
91
|
var _a, _b;
|
|
92
|
-
const inputProps = ((_a = compItem.dataForm[key]) === null || _a === void 0 ? void 0 : _a.inputProp) ||
|
|
92
|
+
const inputProps = ((_a = compItem.dataForm[key]) === null || _a === void 0 ? void 0 : _a.inputProp) ||
|
|
93
|
+
((_b = compItem.dataForm[key]) === null || _b === void 0 ? void 0 : _b.syncProps);
|
|
93
94
|
if (inputProps) {
|
|
94
95
|
outputObj[sourceKey] = Object.assign({ [key]: inputProps }, (outputObj[sourceKey] || {}));
|
|
95
96
|
}
|
|
@@ -184,7 +185,7 @@ function writeLibCommonRes2file(gItem, codeDir) {
|
|
|
184
185
|
libCommonResFiles.push({
|
|
185
186
|
path: path_1.default.join(codeDir, `class.${codeDir.includes('/mp/') ? 'wxss' : 'less'}`),
|
|
186
187
|
code: compLibCommonResource
|
|
187
|
-
? yield style_1.processLess(`
|
|
188
|
+
? yield (0, style_1.processLess)(`
|
|
188
189
|
${compLibCommonResource.theme.variable || ''}
|
|
189
190
|
${compLibCommonResource.class || ''}
|
|
190
191
|
${compLibCommonResource.theme.class || ''}
|
|
@@ -197,7 +198,7 @@ function writeLibCommonRes2file(gItem, codeDir) {
|
|
|
197
198
|
path: path_1.default.join(codeDir, 'tools.js'),
|
|
198
199
|
code: compLibCommonResource ? compLibCommonResource.tools.code : '',
|
|
199
200
|
});
|
|
200
|
-
yield Promise.all(libCommonResFiles.map((item) => generateFiles_1.writeFile(item.path, item.code)));
|
|
201
|
+
yield Promise.all(libCommonResFiles.map((item) => (0, generateFiles_1.writeFile)(item.path, item.code)));
|
|
201
202
|
});
|
|
202
203
|
}
|
|
203
204
|
exports.writeLibCommonRes2file = writeLibCommonRes2file;
|
|
@@ -212,7 +213,7 @@ function readComponentLibMata(libDir) {
|
|
|
212
213
|
let [major] = ((_a = meta === null || meta === void 0 ? void 0 : meta.schemaVersion) === null || _a === void 0 ? void 0 : _a.split('.')) || [];
|
|
213
214
|
const originComponentMetaMap = meta.components;
|
|
214
215
|
if (Number(major) >= 2) {
|
|
215
|
-
meta = cals_1.deserializeComponentLibraryMeta(meta);
|
|
216
|
+
meta = (0, cals_1.deserializeComponentLibraryMeta)(meta);
|
|
216
217
|
}
|
|
217
218
|
for (let key in meta.components) {
|
|
218
219
|
meta.components[key] = Object.assign(Object.assign({}, originComponentMetaMap[key]), { name: key, meta: meta.components[key] });
|
|
@@ -226,6 +227,7 @@ const _OFFICIAL_COMPONENT_LIB = {
|
|
|
226
227
|
};
|
|
227
228
|
function isOfficialComponentLib(name, version) {
|
|
228
229
|
var _a, _b;
|
|
229
|
-
return (!!((_a = _OFFICIAL_COMPONENT_LIB[name]) === null || _a === void 0 ? void 0 : _a.includes(version)) ||
|
|
230
|
+
return (!!((_a = _OFFICIAL_COMPONENT_LIB[name]) === null || _a === void 0 ? void 0 : _a.includes(version)) ||
|
|
231
|
+
((_b = _OFFICIAL_COMPONENT_LIB[name]) === null || _b === void 0 ? void 0 : _b.includes('*')));
|
|
230
232
|
}
|
|
231
233
|
exports.isOfficialComponentLib = isOfficialComponentLib;
|