@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
|
@@ -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,
|
|
@@ -132,7 +132,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
132
132
|
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './src/pages/app.tpl'), {
|
|
133
133
|
encoding: 'utf8',
|
|
134
134
|
});
|
|
135
|
-
const jsx = lodash_template_1.default(template)(templateData);
|
|
135
|
+
const jsx = (0, lodash_template_1.default)(template)(templateData);
|
|
136
136
|
yield fs_extra_1.default.ensureFile(dest);
|
|
137
137
|
yield fs_extra_1.default.writeFile(dest, jsx);
|
|
138
138
|
const pageStyleDest = path_1.default.resolve(appBuildDir, `./pages/${pageInstance.id}/index.less`);
|
|
@@ -169,7 +169,7 @@ function getOriginPluginList(pluginInstances = [], dependencies = [], originPlug
|
|
|
169
169
|
pluginInstances.map((instance) => {
|
|
170
170
|
var _a;
|
|
171
171
|
const { sourceKey } = instance;
|
|
172
|
-
const { materialName, name, variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
172
|
+
const { materialName, name, variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
173
173
|
const pluginKey = `${materialName}_${name}`;
|
|
174
174
|
const isExist = originPluginList.find((item) => item.key === pluginKey);
|
|
175
175
|
if (isExist) {
|
|
@@ -193,7 +193,7 @@ function pullActionToListByInstances(listenerInstances, originActionList, fixedD
|
|
|
193
193
|
}
|
|
194
194
|
listenerInstances.map((pageListenerInstance) => {
|
|
195
195
|
const { sourceKey, type } = pageListenerInstance;
|
|
196
|
-
const { materialName, name, variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
196
|
+
const { materialName, name, variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
197
197
|
const material = fixedDependencies.find((m) => m.name === materialName);
|
|
198
198
|
const actionKey = `${materialName}_${name}`;
|
|
199
199
|
const isExistAction = originActionList.find((item) => item.key === actionKey);
|
|
@@ -212,7 +212,7 @@ function pullActionToListByInstances(listenerInstances, originActionList, fixedD
|
|
|
212
212
|
}
|
|
213
213
|
exports.pullActionToListByInstances = pullActionToListByInstances;
|
|
214
214
|
function pullComponentToListByInstance(sourceKey, originComponentList, fixedDependencies) {
|
|
215
|
-
const { materialName, name, variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
215
|
+
const { materialName, name, variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
216
216
|
const componentKey = `${materialName}_${name}`;
|
|
217
217
|
const isExistComponent = originComponentList.find((item) => item.key === componentKey);
|
|
218
218
|
if (!isExistComponent) {
|
|
@@ -250,11 +250,11 @@ function isSlot(comp) {
|
|
|
250
250
|
}
|
|
251
251
|
exports.isSlot = isSlot;
|
|
252
252
|
function getComponentSchemaString(componentSchema, isComposite = false, componentsInfoMap = {}, wrapperClass) {
|
|
253
|
-
const componentInputProps = util_1.getInputProps(componentsInfoMap) || {};
|
|
254
|
-
const copyJson = util_1.simpleDeepClone(componentSchema);
|
|
253
|
+
const componentInputProps = (0, util_1.getInputProps)(componentsInfoMap) || {};
|
|
254
|
+
const copyJson = (0, util_1.simpleDeepClone)(componentSchema);
|
|
255
255
|
const compWidgets = {};
|
|
256
256
|
const compDataBinds = {};
|
|
257
|
-
const componentSchemaJson = util_1.deepDealSchema(copyJson, (schema) => {
|
|
257
|
+
const componentSchemaJson = (0, util_1.deepDealSchema)(copyJson, (schema) => {
|
|
258
258
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
259
259
|
const { 'x-props': xProps = {}, properties } = schema;
|
|
260
260
|
const { dataBinds = [], commonStyle = {}, data = {}, classNameList = [], sourceKey, styleBind, classNameListBind, staticResourceAttribute = [], } = xProps;
|
|
@@ -272,8 +272,9 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
272
272
|
schema['emitEvents'] = componentInfo.emitEvents.map((item) => item.eventName);
|
|
273
273
|
}
|
|
274
274
|
if (!isSlot(schema) && schema.key) {
|
|
275
|
-
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: weapps_core_1.toCssStyle(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(schema.parent)
|
|
276
|
-
? (_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
|
|
275
|
+
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: (0, weapps_core_1.toCssStyle)(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(schema.parent)
|
|
276
|
+
? (_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
|
|
277
|
+
: (_h = schema === null || schema === void 0 ? void 0 : schema.parent) === null || _h === void 0 ? void 0 : _h.key });
|
|
277
278
|
if (dataBinds.length > 0) {
|
|
278
279
|
compDataBinds[schema.key] = generateDataBinds(dataBinds, isComposite);
|
|
279
280
|
}
|
|
@@ -291,7 +292,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
291
292
|
compDataBinds[schema.key] = Object.assign(Object.assign({}, (compDataBinds[schema.key] || {})), generateDataBinds([classNameListBind], isComposite));
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
|
-
if (properties && weapps_core_1.isEmptyObj(properties)) {
|
|
295
|
+
if (properties && (0, weapps_core_1.isEmptyObj)(properties)) {
|
|
295
296
|
delete schema.properties;
|
|
296
297
|
}
|
|
297
298
|
delete schema.type;
|
|
@@ -302,7 +303,8 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
302
303
|
if (propsVaule && Array.isArray(propsVaule)) {
|
|
303
304
|
propsVaule.map((block) => {
|
|
304
305
|
var _a, _b;
|
|
305
|
-
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) &&
|
|
306
|
+
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) &&
|
|
307
|
+
((_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);
|
|
306
308
|
if (blockInstance) {
|
|
307
309
|
block.selectableBlock['x-props'].listenerInstances = generateListnerInstances(blockInstance, isComposite);
|
|
308
310
|
}
|
|
@@ -319,12 +321,12 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
319
321
|
xProps['classNameList'].push(wrapperClass);
|
|
320
322
|
}
|
|
321
323
|
}
|
|
322
|
-
xProps['commonStyle'] = weapps_core_1.toCssStyle(xProps['commonStyle']);
|
|
324
|
+
xProps['commonStyle'] = (0, weapps_core_1.toCssStyle)(xProps['commonStyle']);
|
|
323
325
|
xProps['staticResourceAttribute'] = staticResourceAttribute;
|
|
324
|
-
if (weapps_core_1.isEmptyObj(xProps['commonStyle'])) {
|
|
326
|
+
if ((0, weapps_core_1.isEmptyObj)(xProps['commonStyle'])) {
|
|
325
327
|
delete xProps['commonStyle'];
|
|
326
328
|
}
|
|
327
|
-
if (weapps_core_1.isEmptyObj(xProps['style'])) {
|
|
329
|
+
if ((0, weapps_core_1.isEmptyObj)(xProps['style'])) {
|
|
328
330
|
delete xProps['style'];
|
|
329
331
|
}
|
|
330
332
|
if (xProps['dataBinds'] && xProps['dataBinds'].length === 0) {
|
|
@@ -346,7 +348,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
346
348
|
xPropsData.staticResourceAttribute.length === 0) {
|
|
347
349
|
delete xPropsData.staticResourceAttribute;
|
|
348
350
|
}
|
|
349
|
-
if (weapps_core_1.isEmptyObj(xPropsData)) {
|
|
351
|
+
if ((0, weapps_core_1.isEmptyObj)(xPropsData)) {
|
|
350
352
|
delete xProps['data'];
|
|
351
353
|
}
|
|
352
354
|
}
|
|
@@ -388,9 +390,9 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
388
390
|
}
|
|
389
391
|
});
|
|
390
392
|
return {
|
|
391
|
-
widgets: util_1.JsonToStringWithVariableName(compWidgets),
|
|
392
|
-
dataBinds: util_1.JsonToStringWithVariableName(compDataBinds),
|
|
393
|
-
componentSchema: util_1.JsonToStringWithVariableName(componentSchemaJson),
|
|
393
|
+
widgets: (0, util_1.JsonToStringWithVariableName)(compWidgets),
|
|
394
|
+
dataBinds: (0, util_1.JsonToStringWithVariableName)(compDataBinds),
|
|
395
|
+
componentSchema: (0, util_1.JsonToStringWithVariableName)(componentSchemaJson),
|
|
394
396
|
};
|
|
395
397
|
}
|
|
396
398
|
exports.getComponentSchemaString = getComponentSchemaString;
|
|
@@ -478,7 +480,7 @@ function generateListnerInstances(listenerInstances, isComposite = false) {
|
|
|
478
480
|
};
|
|
479
481
|
if (listener.type === weapps_core_1.ActionType.Material) {
|
|
480
482
|
const { sourceKey } = listener;
|
|
481
|
-
const { variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
483
|
+
const { variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
482
484
|
generatedListener.instanceFunction = `${config_1.REPLACE_SIGN}${variableName}${config_1.REPLACE_SIGN}`;
|
|
483
485
|
}
|
|
484
486
|
else if (listener.type === weapps_core_1.ActionType.Platform) {
|
|
@@ -503,7 +505,7 @@ function generateListnerInstances(listenerInstances, isComposite = false) {
|
|
|
503
505
|
generatedListener.instanceFunction = `${config_1.REPLACE_SIGN}handler.${((_e = listener.handler) === null || _e === void 0 ? void 0 : _e.name) || listener.jsCode}${config_1.REPLACE_SIGN}`;
|
|
504
506
|
}
|
|
505
507
|
}
|
|
506
|
-
if (!weapps_core_1.isEmptyObj(listener.data)) {
|
|
508
|
+
if (!(0, weapps_core_1.isEmptyObj)(listener.data)) {
|
|
507
509
|
generatedListener.data = listener.data;
|
|
508
510
|
}
|
|
509
511
|
if (listener.dataBinds && listener.dataBinds.length > 0) {
|
|
@@ -513,20 +515,20 @@ function generateListnerInstances(listenerInstances, isComposite = false) {
|
|
|
513
515
|
});
|
|
514
516
|
}
|
|
515
517
|
function getListenersString(listeners = [], isComposite = false) {
|
|
516
|
-
return util_1.JsonToStringWithVariableName(generateListnerInstances(listeners, isComposite));
|
|
518
|
+
return (0, util_1.JsonToStringWithVariableName)(generateListnerInstances(listeners, isComposite));
|
|
517
519
|
}
|
|
518
520
|
exports.getListenersString = getListenersString;
|
|
519
521
|
function getPluginInstancesString(instances) {
|
|
520
522
|
if (!instances || !instances.length) {
|
|
521
523
|
return '[]';
|
|
522
524
|
}
|
|
523
|
-
const copyInstances = util_1.simpleDeepClone(instances);
|
|
525
|
+
const copyInstances = (0, util_1.simpleDeepClone)(instances);
|
|
524
526
|
copyInstances.map((itemInstance) => {
|
|
525
527
|
const { sourceKey } = itemInstance;
|
|
526
|
-
const { variableName } = util_1.getMetaInfoBySourceKey(sourceKey);
|
|
528
|
+
const { variableName } = (0, util_1.getMetaInfoBySourceKey)(sourceKey);
|
|
527
529
|
itemInstance.instanceFunction = `${config_1.REPLACE_SIGN}${variableName}${config_1.REPLACE_SIGN}`;
|
|
528
530
|
});
|
|
529
|
-
return util_1.JsonToStringWithVariableName(copyInstances);
|
|
531
|
+
return (0, util_1.JsonToStringWithVariableName)(copyInstances);
|
|
530
532
|
}
|
|
531
533
|
exports.getPluginInstancesString = getPluginInstancesString;
|
|
532
534
|
function getPluginImportStringArr(plugins, pluginImportStringArr = []) {
|
|
@@ -549,7 +551,7 @@ function getComponentImportStringArr(components, componentImportStringArr = [])
|
|
|
549
551
|
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)}'`;
|
|
550
552
|
}
|
|
551
553
|
else if (entries === null || entries === void 0 ? void 0 : entries.entry) {
|
|
552
|
-
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
554
|
+
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
553
555
|
importString = `const { ${name}: ${lodash_1.default.upperFirst(variableName)} } = ${componentsLibVariableName}.components`;
|
|
554
556
|
}
|
|
555
557
|
else {
|
|
@@ -565,7 +567,7 @@ exports.getComponentImportStringArr = getComponentImportStringArr;
|
|
|
565
567
|
function getEntryImportStringArr(materialInfoList = [], entryImportStringArr = []) {
|
|
566
568
|
materialInfoList.forEach(({ materialName, version, entries }) => {
|
|
567
569
|
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)) {
|
|
568
|
-
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
570
|
+
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
569
571
|
const importComponentLibString = `import ${componentsLibVariableName} from '${path_1.default.posix.join(`libraries/${materialName}@${version}`, entries === null || entries === void 0 ? void 0 : entries.entry)}'`;
|
|
570
572
|
if (!entryImportStringArr.includes(importComponentLibString)) {
|
|
571
573
|
entryImportStringArr.push(importComponentLibString);
|
|
@@ -586,9 +588,11 @@ function getActionImportStringArr(originActionList, actionImportStringArr = [])
|
|
|
586
588
|
exports.getActionImportStringArr = getActionImportStringArr;
|
|
587
589
|
function pushActionToImportStringArr(listenerInstance, actionImportStringArr) {
|
|
588
590
|
const { name, materialName, materialVersion, variableName, entries, } = listenerInstance;
|
|
589
|
-
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
590
|
-
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions)
|
|
591
|
-
|
|
591
|
+
const componentsLibVariableName = (0, util_3.camelcase)(`${materialName}`);
|
|
592
|
+
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions)
|
|
593
|
+
? `import { ${name} as ${variableName} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.actions)}'`
|
|
594
|
+
: (entries === null || entries === void 0 ? void 0 : entries.entry)
|
|
595
|
+
? `const { ${name}: ${variableName} } = ${componentsLibVariableName}.actions`
|
|
592
596
|
: `import ${variableName} from 'libraries/${materialName}@${materialVersion}/actions/${name}'`;
|
|
593
597
|
if (actionImportStringArr.includes(importString)) {
|
|
594
598
|
return;
|
|
@@ -605,7 +609,7 @@ function generateRouterFile(allAppDataList, appBuildDir, basename = '', buildTyp
|
|
|
605
609
|
const { pageInstanceList, rootPath = '' } = data;
|
|
606
610
|
const pageFilePath = rootPath ? `packages/${rootPath}/` : '';
|
|
607
611
|
mountApis.push(`import '${pageFilePath}app/mountAppApis';`);
|
|
608
|
-
weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => {
|
|
612
|
+
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
609
613
|
const pageId = [rootPath, pageInstance.id].filter((i) => i).join('_');
|
|
610
614
|
if (pageInstance.isHome && !rootPath) {
|
|
611
615
|
routerRenders.push(`<Route from="/" exact children={() => <Redirect to="/${pageId}" />} />`);
|
|
@@ -617,7 +621,7 @@ function generateRouterFile(allAppDataList, appBuildDir, basename = '', buildTyp
|
|
|
617
621
|
const routerTemplate = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './src/router/index.tpl'), {
|
|
618
622
|
encoding: 'utf8',
|
|
619
623
|
});
|
|
620
|
-
const routerIndexStr = lodash_template_1.default(routerTemplate)({
|
|
624
|
+
const routerIndexStr = (0, lodash_template_1.default)(routerTemplate)({
|
|
621
625
|
routerImports: routerImports.join('\n'),
|
|
622
626
|
routerRenders: routerRenders.join('\n'),
|
|
623
627
|
mountApis: mountApis.join('\n'),
|
|
@@ -633,19 +637,19 @@ function writeLowCodeFiles(appData, appBuildDir) {
|
|
|
633
637
|
return __awaiter(this, void 0, void 0, function* () {
|
|
634
638
|
const lowcodeRootDir = path_1.default.join(appBuildDir, 'lowcode');
|
|
635
639
|
console.log(chalk_1.default.blue.bold('Writing lowcode files:'));
|
|
636
|
-
generateFiles_1.cleanDir(lowcodeRootDir, []);
|
|
637
|
-
style_1.generateDefaultTheme(appData);
|
|
640
|
+
(0, generateFiles_1.cleanDir)(lowcodeRootDir, []);
|
|
641
|
+
(0, style_1.generateDefaultTheme)(appData);
|
|
638
642
|
const themeCode = appData.codeModules.find((mod) => mod.type === 'theme');
|
|
639
643
|
yield Promise.all(appData.codeModules.map((m) => writeCode2file(m, 'global')));
|
|
640
|
-
yield Promise.all(weapps_core_1.loopDealWithFn(appData.pageInstanceList, (page) => __awaiter(this, void 0, void 0, function* () {
|
|
641
|
-
style_1.generateDefaultStyle(page);
|
|
644
|
+
yield Promise.all((0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList, (page) => __awaiter(this, void 0, void 0, function* () {
|
|
645
|
+
(0, style_1.generateDefaultStyle)(page);
|
|
642
646
|
yield page.codeModules
|
|
643
647
|
.filter((m) => m.name !== '____index____')
|
|
644
648
|
.forEach((m) => writeCode2file(m, page.id));
|
|
645
649
|
})));
|
|
646
650
|
function writeCode2file(mod, pageId) {
|
|
647
651
|
return __awaiter(this, void 0, void 0, function* () {
|
|
648
|
-
const file = path_1.default.join(lowcodeRootDir, weapps_core_1.getCodeModuleFilePath(pageId, mod));
|
|
652
|
+
const file = path_1.default.join(lowcodeRootDir, (0, weapps_core_1.getCodeModuleFilePath)(pageId, mod));
|
|
649
653
|
let weappsApiPrefix = '';
|
|
650
654
|
if (mod.type !== 'theme') {
|
|
651
655
|
weappsApiPrefix =
|
|
@@ -658,7 +662,7 @@ function writeLowCodeFiles(appData, appBuildDir) {
|
|
|
658
662
|
console.log(chalk_1.default.green(file));
|
|
659
663
|
let code = mod.code;
|
|
660
664
|
if (mod.type === 'style') {
|
|
661
|
-
code = yield style_1.processLess(((themeCode === null || themeCode === void 0 ? void 0 : themeCode.code) || style_1.defaultThemeCode) + code);
|
|
665
|
+
code = yield (0, style_1.processLess)(((themeCode === null || themeCode === void 0 ? void 0 : themeCode.code) || style_1.defaultThemeCode) + code);
|
|
662
666
|
}
|
|
663
667
|
yield fs_extra_1.default.ensureFile(file);
|
|
664
668
|
yield fs_extra_1.default.writeFile(file, weappsApiPrefix + os_1.default.EOL + code);
|
|
@@ -672,7 +676,7 @@ function writeLowCodeFilesForCompositeComp(compositeGroups, appBuildDir) {
|
|
|
672
676
|
const lowcodeRootDir = path_1.default.join(appBuildDir, 'src', 'lowcode', 'composite');
|
|
673
677
|
console.log(chalk_1.default.blue.bold('Writing composite component lowcode files:'));
|
|
674
678
|
yield Promise.all(compositeGroups.map((gItem) => __awaiter(this, void 0, void 0, function* () {
|
|
675
|
-
yield util_2.writeLibCommonRes2file(gItem, path_1.default.join(appBuildDir, 'src', 'libraries', `${gItem.name}@${gItem.version}`, 'libCommonRes'));
|
|
679
|
+
yield (0, util_2.writeLibCommonRes2file)(gItem, path_1.default.join(appBuildDir, 'src', 'libraries', `${gItem.name}@${gItem.version}`, 'libCommonRes'));
|
|
676
680
|
const compLibCommonResource = gItem.compLibCommonResource;
|
|
677
681
|
let themeCode = '';
|
|
678
682
|
if (compLibCommonResource) {
|
|
@@ -690,13 +694,13 @@ function writeLowCodeFilesForCompositeComp(compositeGroups, appBuildDir) {
|
|
|
690
694
|
function writeCode2file(mod, lowcodeDir, comp, themeCode) {
|
|
691
695
|
return __awaiter(this, void 0, void 0, function* () {
|
|
692
696
|
const pageId = comp.name + '_' + comp.id;
|
|
693
|
-
const file = path_1.default.join(lowcodeDir, weapps_core_1.getCodeModuleFilePath(pageId, mod));
|
|
697
|
+
const file = path_1.default.join(lowcodeDir, (0, weapps_core_1.getCodeModuleFilePath)(pageId, mod));
|
|
694
698
|
yield fs_extra_1.default.ensureFile(file);
|
|
695
699
|
let codeContent = '';
|
|
696
700
|
if (mod.type === 'style') {
|
|
697
|
-
codeContent = `.${weapps_core_1.getCompositedComponentClass(comp)} { \n${themeCode ? themeCode : ''}\n${mod.code}\n }`;
|
|
701
|
+
codeContent = `.${(0, weapps_core_1.getCompositedComponentClass)(comp)} { \n${themeCode ? themeCode : ''}\n${mod.code}\n }`;
|
|
698
702
|
try {
|
|
699
|
-
codeContent = yield style_1.processLess(`${codeContent}`);
|
|
703
|
+
codeContent = yield (0, style_1.processLess)(`${codeContent}`);
|
|
700
704
|
}
|
|
701
705
|
catch (e) {
|
|
702
706
|
console.error(`样式转换失败 [${pageId}] :`, e, codeContent);
|
|
@@ -717,13 +721,13 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
717
721
|
return __awaiter(this, void 0, void 0, function* () {
|
|
718
722
|
const computedPageIds = [];
|
|
719
723
|
const pageModules = {};
|
|
720
|
-
weapps_core_1.loopDealWithFn(appData.pageInstanceList, (p) => {
|
|
724
|
+
(0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList, (p) => {
|
|
721
725
|
pageModules[p.id] = p.codeModules;
|
|
722
726
|
if (p.codeModules.find((item) => item.type === 'computed')) {
|
|
723
727
|
computedPageIds.push(p.id);
|
|
724
728
|
}
|
|
725
729
|
});
|
|
726
|
-
const yyptConfig = yield util_2.getYyptConfigInfo(extraData);
|
|
730
|
+
const yyptConfig = yield (0, util_2.getYyptConfigInfo)(extraData);
|
|
727
731
|
const templatesData = {
|
|
728
732
|
'store/index.js': {
|
|
729
733
|
appId: appKey,
|
|
@@ -745,7 +749,7 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
745
749
|
.map((m) => m.name),
|
|
746
750
|
},
|
|
747
751
|
'datasources/index.js.tpl': {
|
|
748
|
-
isXPage: common_1.buildAsXPageByBuildType(buildTypeList),
|
|
752
|
+
isXPage: (0, common_1.buildAsXPageByBuildType)(buildTypeList),
|
|
749
753
|
},
|
|
750
754
|
'datasources/config.js.tpl': {
|
|
751
755
|
appID: appKey,
|
|
@@ -754,14 +758,14 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
754
758
|
clientID: ((_a = appData.extra) === null || _a === void 0 ? void 0 : _a.clientId) || '',
|
|
755
759
|
},
|
|
756
760
|
'datasources/datasource-profiles.js.tpl': {
|
|
757
|
-
datasourceProfiles: util_1.JsonToStringWithVariableName(dataSource_1.getDatasourceProfiles(appData.datasources || [])),
|
|
761
|
+
datasourceProfiles: (0, util_1.JsonToStringWithVariableName)((0, dataSource_1.getDatasourceProfiles)(appData.datasources || [])),
|
|
758
762
|
},
|
|
759
763
|
'datasources/dataset-profiles.js.tpl': {
|
|
760
|
-
datasetProfiles: util_1.JsonToStringWithVariableName(dataSource_1.getDatasetProfiles(appData, [appData])),
|
|
764
|
+
datasetProfiles: (0, util_1.JsonToStringWithVariableName)((0, dataSource_1.getDatasetProfiles)(appData, [appData])),
|
|
761
765
|
},
|
|
762
766
|
'handlers/utils/common.js': {
|
|
763
|
-
isAdminPortal: common_1.buildAsAdminPortalByBuildType(buildTypeList),
|
|
764
|
-
isXPage: common_1.buildAsXPageByBuildType(buildTypeList),
|
|
767
|
+
isAdminPortal: (0, common_1.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
768
|
+
isXPage: (0, common_1.buildAsXPageByBuildType)(buildTypeList),
|
|
765
769
|
},
|
|
766
770
|
};
|
|
767
771
|
if (!rootPath) {
|
|
@@ -772,7 +776,7 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
772
776
|
const tplStr = yield fs_extra_1.default.readFile(path_1.default.join(config_1.appTemplateDir, 'src', file), {
|
|
773
777
|
encoding: 'utf8',
|
|
774
778
|
});
|
|
775
|
-
const generatedCode = lodash_template_1.default(tplStr, {
|
|
779
|
+
const generatedCode = (0, lodash_template_1.default)(tplStr, {
|
|
776
780
|
interpolate: /<%=([\s\S]+?)%>/g,
|
|
777
781
|
})(templatesData[file]);
|
|
778
782
|
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
|
}));
|
|
@@ -355,7 +355,7 @@ function getWebpackWebBuildParams(appId, appBuildDir, materialsDir, dependencies
|
|
|
355
355
|
path_1.default.resolve(appBuildDir, 'src'),
|
|
356
356
|
...getMaterialNodeModulesPathList(dependencies, materialsDir),
|
|
357
357
|
],
|
|
358
|
-
definePlugin: Object.assign({ 'process.env.buildType': `"${buildTypeList[0]}"`, 'process.env.isApp': buildTypeList.includes("app"), 'process.env.isAdminPortal': common_2.buildAsAdminPortalByBuildType(buildTypeList) }, extraDefine),
|
|
358
|
+
definePlugin: Object.assign({ 'process.env.buildType': `"${buildTypeList[0]}"`, 'process.env.isApp': buildTypeList.includes("app"), 'process.env.isAdminPortal': (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList) }, extraDefine),
|
|
359
359
|
devtool: ['app-nvzcvt10', 'app-msa2ihs9'].includes(appId)
|
|
360
360
|
? 'source-map'
|
|
361
361
|
: mode !== "production"
|
|
@@ -399,7 +399,7 @@ function getAllPageMpEntryPath(allAppDataList, appBuildDir, options = { generate
|
|
|
399
399
|
allAppDataList.map((app) => {
|
|
400
400
|
const { pageInstanceList, rootPath } = app;
|
|
401
401
|
const packagePathStr = rootPath ? `packages/${rootPath}` : '';
|
|
402
|
-
weapps_core_1.loopDealWithFn(pageInstanceList, (pageInstance) => {
|
|
402
|
+
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
403
403
|
const pageName = rootPath
|
|
404
404
|
? `${rootPath}_${pageInstance.id}`
|
|
405
405
|
: pageInstance.id;
|
|
@@ -412,7 +412,7 @@ exports.getAllPageMpEntryPath = getAllPageMpEntryPath;
|
|
|
412
412
|
const dependenciesMap = new Map();
|
|
413
413
|
function downloadAndInstallDependencies(dependencies = [], materialsDir, installOptions = {}) {
|
|
414
414
|
return __awaiter(this, void 0, void 0, function* () {
|
|
415
|
-
const localPkg = util_1.getCurrentPackageJson();
|
|
415
|
+
const localPkg = (0, util_1.getCurrentPackageJson)();
|
|
416
416
|
yield Promise.all(dependencies.map(({ name, version, srcZipUrl }) => __awaiter(this, void 0, void 0, function* () {
|
|
417
417
|
const materialNameVersion = `${name}@${version}`;
|
|
418
418
|
const targetDir = path_1.default.join(materialsDir, materialNameVersion);
|
|
@@ -421,11 +421,11 @@ function downloadAndInstallDependencies(dependencies = [], materialsDir, install
|
|
|
421
421
|
return;
|
|
422
422
|
}
|
|
423
423
|
if (dependenciesMap.get(targetDir)) {
|
|
424
|
-
console_1.notice(`${materialNameVersion} 存在 ${targetDir},无需安装, 如果依赖库报错,请重启wa watch`);
|
|
424
|
+
(0, console_1.notice)(`${materialNameVersion} 存在 ${targetDir},无需安装, 如果依赖库报错,请重启wa watch`);
|
|
425
425
|
return;
|
|
426
426
|
}
|
|
427
427
|
const matched = srcZipUrl.match(/\/(cg-.*?)\//);
|
|
428
|
-
const { appBuildDir } = index_2.getCompileDirs('app');
|
|
428
|
+
const { appBuildDir } = (0, index_2.getCompileDirs)('app');
|
|
429
429
|
if (matched &&
|
|
430
430
|
matched[1] &&
|
|
431
431
|
fs_extra_1.default.existsSync(path_1.default.resolve(appBuildDir, `.component_cache/web/${matched[1]}@${version}`))) {
|
|
@@ -437,7 +437,8 @@ function downloadAndInstallDependencies(dependencies = [], materialsDir, install
|
|
|
437
437
|
yield downloadDependencies(targetDir, srcZipUrl);
|
|
438
438
|
}
|
|
439
439
|
console.log(`处理${name}@${version}依赖 ...`);
|
|
440
|
-
yield installDependencies(targetDir, Object.assign(Object.assign({}, installOptions), { ignoreInstall: common_1.isOfficialComponentLib(name, version) ||
|
|
440
|
+
yield installDependencies(targetDir, Object.assign(Object.assign({}, installOptions), { ignoreInstall: (0, common_1.isOfficialComponentLib)(name, version) ||
|
|
441
|
+
(installOptions === null || installOptions === void 0 ? void 0 : installOptions.ignoreInstall), dependenceMeta: {
|
|
441
442
|
name,
|
|
442
443
|
version,
|
|
443
444
|
downloadUrl: srcZipUrl,
|
|
@@ -454,7 +455,7 @@ function downloadDependencies(targetDir, srcZipUrl) {
|
|
|
454
455
|
return;
|
|
455
456
|
}
|
|
456
457
|
try {
|
|
457
|
-
let response = yield axios_1.default({
|
|
458
|
+
let response = yield (0, axios_1.default)({
|
|
458
459
|
url: srcZipUrl,
|
|
459
460
|
responseType: 'stream',
|
|
460
461
|
});
|
|
@@ -502,21 +503,21 @@ function installDependencies(targetDir, options = {}) {
|
|
|
502
503
|
let installProcess;
|
|
503
504
|
if (yarnExists && (options === null || options === void 0 ? void 0 : options.runtime) !== types_1.RUNTIME.CI) {
|
|
504
505
|
const addPackage = packageName ? ['add', packageName] : [];
|
|
505
|
-
installProcess = cross_spawn_1.default('yarn', [...addPackage, registry], {
|
|
506
|
+
installProcess = (0, cross_spawn_1.default)('yarn', [...addPackage, registry], {
|
|
506
507
|
cwd: targetDir,
|
|
507
508
|
env: process.env,
|
|
508
509
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
509
510
|
});
|
|
510
511
|
}
|
|
511
512
|
else {
|
|
512
|
-
installProcess = cross_spawn_1.default('npm', ['install', packageName, ...npmOptions], {
|
|
513
|
+
installProcess = (0, cross_spawn_1.default)('npm', ['install', packageName, ...npmOptions], {
|
|
513
514
|
cwd: targetDir,
|
|
514
515
|
env: process.env,
|
|
515
516
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
516
517
|
});
|
|
517
518
|
}
|
|
518
519
|
installProcess.on('exit', () => console.timeEnd(operationTag));
|
|
519
|
-
yield process_1.promisifyProcess(installProcess);
|
|
520
|
+
yield (0, process_1.promisifyProcess)(installProcess);
|
|
520
521
|
try {
|
|
521
522
|
yield fs_extra_1.default.remove(path_1.default.join(path_1.default.join(targetDir, 'package-lock.json')));
|
|
522
523
|
yield fs_extra_1.default.remove(path_1.default.join(path_1.default.join(targetDir, 'yarn.lock')));
|
|
@@ -526,7 +527,7 @@ function installDependencies(targetDir, options = {}) {
|
|
|
526
527
|
}
|
|
527
528
|
exports.installDependencies = installDependencies;
|
|
528
529
|
function getMaterialNodeModulesPathList(dependencies = [], materialsDir) {
|
|
529
|
-
const localPkg = util_1.getCurrentPackageJson();
|
|
530
|
+
const localPkg = (0, util_1.getCurrentPackageJson)();
|
|
530
531
|
return dependencies.map(({ name, version }) => {
|
|
531
532
|
const nameVersion = `${name}@${version}`;
|
|
532
533
|
if (localPkg && localPkg.name === name && localPkg.version === version) {
|
|
@@ -543,11 +544,11 @@ function generateWebpackWebDevServerFile({ appBuildDir, buildTypeList, }) {
|
|
|
543
544
|
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_2.appTemplateDir, './webpack/devServer.js'), {
|
|
544
545
|
encoding: 'utf8',
|
|
545
546
|
});
|
|
546
|
-
const jsContent = lodash_template_1.default(template, {
|
|
547
|
+
const jsContent = (0, lodash_template_1.default)(template, {
|
|
547
548
|
interpolate: /<%=([\s\S]+?)%>/g,
|
|
548
549
|
})({
|
|
549
550
|
isApp: buildTypeList.includes("app"),
|
|
550
|
-
isAdminPortal: common_2.buildAsAdminPortalByBuildType(buildTypeList),
|
|
551
|
+
isAdminPortal: (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
551
552
|
});
|
|
552
553
|
yield fs_extra_1.default.ensureFile(dest);
|
|
553
554
|
yield fs_extra_1.default.writeFile(dest, jsContent);
|
|
@@ -560,7 +561,7 @@ function downloadAssets(targetDir, assetUrl) {
|
|
|
560
561
|
if (isExist) {
|
|
561
562
|
return;
|
|
562
563
|
}
|
|
563
|
-
const [err, response] = yield util_1.promiseWrapper(axios_1.default({
|
|
564
|
+
const [err, response] = yield (0, util_1.promiseWrapper)((0, axios_1.default)({
|
|
564
565
|
url: assetUrl,
|
|
565
566
|
responseType: 'stream',
|
|
566
567
|
}));
|
|
@@ -569,7 +570,7 @@ function downloadAssets(targetDir, assetUrl) {
|
|
|
569
570
|
throw err;
|
|
570
571
|
}
|
|
571
572
|
yield fs_extra_1.default.ensureDir(targetDir);
|
|
572
|
-
const filename = common_1.getFileNameByUrl(assetUrl);
|
|
573
|
+
const filename = (0, common_1.getFileNameByUrl)(assetUrl);
|
|
573
574
|
const targetPath = path_1.default.resolve(targetDir, `./${filename}`);
|
|
574
575
|
const writer = fs_extra_1.default.createWriteStream(targetPath);
|
|
575
576
|
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; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/builder/util/common.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,aAAa,EACd,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EACL,sBAAsB,EACtB,OAAO,EACP,aAAa,EACb,QAAQ,EACR,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAMrC,oBAAY,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAClE,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAQjE;AAOD,wBAAgB,qBAAqB;;;cAUpC;AAED,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,SAAS,CAI7D;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAWlE;AAED,wBAAgB,eAAe,CAAC,MAAM,KAAA,OAIrC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,SAAK,QAI9C;AAED,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,kBAAkB,GACpC,oBAAoB,CA2BtB;AAED,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,aAAa,EAAE,GAC5B,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/builder/util/common.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,aAAa,EACd,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EACL,sBAAsB,EACtB,OAAO,EACP,aAAa,EACb,QAAQ,EACR,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAMrC,oBAAY,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAClE,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAQjE;AAOD,wBAAgB,qBAAqB;;;cAUpC;AAED,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,SAAS,CAI7D;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAWlE;AAED,wBAAgB,eAAe,CAAC,MAAM,KAAA,OAIrC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,SAAK,QAI9C;AAED,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,kBAAkB,GACpC,oBAAoB,CA2BtB;AAED,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,aAAa,EAAE,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CA2D7B;AAED,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,GAAG;;;;GA2BrD;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,MAAM,iBAgChB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,KAAA,GAAG;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC7C,UAAU,EAAE;QACV,CAAC,aAAa,EAAE,MAAM,GAAG;YACvB,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH,GAAG,IAAI,CA0BP;AAOD,wBAAgB,sBAAsB,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,GAAG,OAAO,CAK7D"}
|