@cloudbase/lowcode-builder 1.8.94 → 1.8.96
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/core/index.d.ts +9 -0
- package/lib/builder/core/index.js +118 -7
- package/lib/builder/h5/generate.d.ts +1 -1
- package/lib/builder/h5/index.d.ts +2 -2
- package/lib/builder/h5/index.js +24 -6
- package/lib/builder/h5/webpack.d.ts +2 -2
- package/lib/builder/mp/BuildContext.d.ts +18 -14
- package/lib/builder/mp/index.d.ts +11 -1
- package/lib/builder/mp/index.js +98 -85
- package/lib/builder/mp/lowcode.d.ts +5 -3
- package/lib/builder/mp/lowcode.js +14 -5
- package/lib/builder/mp/materials.d.ts +10 -5
- package/lib/builder/mp/materials.js +139 -135
- package/lib/builder/mp/util.d.ts +15 -12
- package/lib/builder/mp/util.js +50 -22
- package/lib/builder/mp/wxml.d.ts +5 -3
- package/lib/builder/mp/wxml.js +29 -27
- package/lib/builder/service/webpack.js +0 -1
- package/lib/builder/util/common.d.ts +1 -2
- package/lib/builder/util/common.js +1 -45
- package/lib/builder/util/generateFiles.d.ts +1 -1
- package/lib/builder/util/generateFiles.js +5 -1
- package/lib/builder.web.js +8 -55
- package/package.json +2 -2
- package/template/html/index.html.ejs +7 -3
- package/template/mp/app/weapps-api.js +1 -1
- package/template/mp/app.js +4 -2
- package/template/mp/common/cloud-sdk.js +28 -0
- package/template/mp/common/data-patch.js +18 -3
- package/template/mp/common/util.js +6 -2
- package/template/mp/common/watch.js +1 -1
- package/template/mp/common/weapp-component.js +5 -5
- package/template/mp/common/weapp-page.js +4 -3
- package/template/mp/common/widget.js +51 -38
- package/template/mp/component/index.js +7 -6
- package/template/mp/datasources/index.js.tpl +2 -30
- package/template/mp/package.json +3 -3
- package/template/webpack/web.prod.js +1 -1
package/lib/builder/mp/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateScopedStyleText = exports.findComponentInfo = exports.processRepeaterSchema = exports.setDataBind = exports.createDataBinds = exports.generateArgsDynamicValueFromData = exports.createTemplateEventFlows = exports.createTemplateQuery = exports.generateDataContainerListeners = exports.generateSyncListeners = exports.createEventHandlers = exports.createWidgetProps = exports.generatedDynamicData = void 0;
|
|
3
|
+
exports.isRepeaterWidget = exports.generateScopedStyleText = exports.findComponentInfo = exports.processRepeaterSchema = exports.setDataBind = exports.createDataBinds = exports.generateArgsDynamicValueFromData = exports.createTemplateEventFlows = exports.createTemplateQuery = exports.generateDataContainerListeners = exports.generateSyncListeners = exports.createEventHandlers = exports.createWidgetProps = exports.generatedDynamicData = void 0;
|
|
4
4
|
const weapps_core_1 = require("@cloudbase/lowcode-generator/lib/weapps-core");
|
|
5
5
|
const lowcode_generator_1 = require("@cloudbase/lowcode-generator");
|
|
6
6
|
const weapp_1 = require("@cloudbase/lowcode-generator/lib/generator/util/weapp");
|
|
@@ -128,14 +128,8 @@ function createWidgetProps(ctx, widgets) {
|
|
|
128
128
|
materialLibs: ctx.materialLibs,
|
|
129
129
|
miniprogramPlugins: ctx.miniprogramPlugins,
|
|
130
130
|
});
|
|
131
|
-
if (!widegetComp) {
|
|
132
|
-
|
|
133
|
-
(xComponent.name === config_1.REPEATER.REPEATER_NAME || xComponent.name === config_1.REPEATER.REPEATER_ITEM_NAME)) {
|
|
134
|
-
// skip
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
131
|
+
if (!widegetComp && !checkRepeaterComponent(xComponent)) {
|
|
132
|
+
return;
|
|
139
133
|
}
|
|
140
134
|
widgetProps[id] = extractWidgetProps(xProps, widegetComp, ctx.processCssUnit);
|
|
141
135
|
widgetProps[id]._parentId = parentId;
|
|
@@ -157,8 +151,7 @@ function createEventHandlers(ctx, widgets, componentApi, page) {
|
|
|
157
151
|
return;
|
|
158
152
|
}
|
|
159
153
|
let compProto;
|
|
160
|
-
if (xComponent
|
|
161
|
-
(xComponent.name === config_1.REPEATER.REPEATER_ITEM_NAME || xComponent.name === config_1.REPEATER.REPEATER_NAME)) {
|
|
154
|
+
if (checkRepeaterComponent(xComponent)) {
|
|
162
155
|
// 内部虚组件,不校验compProto
|
|
163
156
|
}
|
|
164
157
|
else {
|
|
@@ -357,8 +350,7 @@ function createDataBinds(ctx, widgets) {
|
|
|
357
350
|
// skip slot component
|
|
358
351
|
return;
|
|
359
352
|
}
|
|
360
|
-
if (xComponent
|
|
361
|
-
(xComponent.name === config_1.REPEATER.REPEATER_NAME || xComponent.name === config_1.REPEATER.REPEATER_ITEM_NAME)) {
|
|
353
|
+
if (checkRepeaterComponent(xComponent)) {
|
|
362
354
|
// skip exist
|
|
363
355
|
}
|
|
364
356
|
else if (!findComponentInfo(xComponent, { materialLibs: ctx.materialLibs, miniprogramPlugins: ctx.miniprogramPlugins })) {
|
|
@@ -439,16 +431,36 @@ function processRepeaterSchema(ctx, componentInstanceMap) {
|
|
|
439
431
|
// skip slot component
|
|
440
432
|
return;
|
|
441
433
|
}
|
|
442
|
-
|
|
434
|
+
const componentInfo = findComponentInfo(xComponent, {
|
|
435
|
+
materialLibs: ctx.materialLibs,
|
|
436
|
+
miniprogramPlugins: ctx.miniprogramPlugins,
|
|
437
|
+
});
|
|
438
|
+
const simpleWidget = {
|
|
439
|
+
widgetType: `${xComponent.moduleName}:${xComponent.name}`,
|
|
440
|
+
getConfig: () => {
|
|
441
|
+
return (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.compConfig) || {};
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
if (isRepeaterWidget(simpleWidget, config_1.REPEATER.REPEATER_NAME)) {
|
|
443
445
|
const children = Object.values(properties);
|
|
444
446
|
// 子项已经为 item 的不在处理
|
|
445
447
|
if (children.length === 1) {
|
|
446
448
|
const child = children[0];
|
|
447
449
|
const { xComponent: childXComponent } = child;
|
|
448
|
-
if (childXComponent
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
if (childXComponent) {
|
|
451
|
+
const componentInfo = findComponentInfo(childXComponent, {
|
|
452
|
+
materialLibs: ctx.materialLibs,
|
|
453
|
+
miniprogramPlugins: ctx.miniprogramPlugins,
|
|
454
|
+
});
|
|
455
|
+
const simpleWidget = {
|
|
456
|
+
widgetType: `${xComponent.moduleName}:${xComponent.name}`,
|
|
457
|
+
getConfig: () => {
|
|
458
|
+
return (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.compConfig) || {};
|
|
459
|
+
},
|
|
460
|
+
};
|
|
461
|
+
if (isRepeaterWidget(simpleWidget, config_1.REPEATER.REPEATER_ITEM_NAME)) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
452
464
|
}
|
|
453
465
|
}
|
|
454
466
|
// 给 Repeater 组件加一层虚拟项组件,在虚拟项组件上挂 for 循环
|
|
@@ -483,10 +495,10 @@ function processRepeaterSchema(ctx, componentInstanceMap) {
|
|
|
483
495
|
},
|
|
484
496
|
};
|
|
485
497
|
}
|
|
486
|
-
else if (
|
|
498
|
+
else if (isRepeaterWidget(simpleWidget, config_1.REPEATER.REPEATER_ITEM_NAME)) {
|
|
487
499
|
return;
|
|
488
500
|
}
|
|
489
|
-
else if (xComponent && !
|
|
501
|
+
else if (xComponent && !componentInfo) {
|
|
490
502
|
component.properties = {};
|
|
491
503
|
}
|
|
492
504
|
return;
|
|
@@ -522,7 +534,7 @@ function findComponentInfo(xComponent, { materialLibs, miniprogramPlugins }) {
|
|
|
522
534
|
return compProto;
|
|
523
535
|
}
|
|
524
536
|
exports.findComponentInfo = findComponentInfo;
|
|
525
|
-
function generateScopedStyleText(widgets) {
|
|
537
|
+
function generateScopedStyleText(widgets, weightPrefix = '#wd-page-root') {
|
|
526
538
|
const cssTextList = [];
|
|
527
539
|
function traverse(target) {
|
|
528
540
|
var _a;
|
|
@@ -535,7 +547,7 @@ function generateScopedStyleText(widgets) {
|
|
|
535
547
|
// 移除换行及其前后的空白符
|
|
536
548
|
.replace(/\s*\n\s*/g, '')
|
|
537
549
|
// 添加 `#wd-page-root` 前缀以增加样式权重
|
|
538
|
-
.replace(/(:scope.*?{)/g,
|
|
550
|
+
.replace(/(:scope.*?{)/g, `\n${weightPrefix} $1`)
|
|
539
551
|
// 替换 `:scope`
|
|
540
552
|
.replace(/:scope/g, `.wd-comp-id-${id}`)
|
|
541
553
|
// `: ` => `:`
|
|
@@ -555,3 +567,19 @@ function generateScopedStyleText(widgets) {
|
|
|
555
567
|
return cssTextList.join('\n');
|
|
556
568
|
}
|
|
557
569
|
exports.generateScopedStyleText = generateScopedStyleText;
|
|
570
|
+
function isRepeaterWidget(w, repeaterComponentName /* 'Repeater' | 'RepeaterItem' */) {
|
|
571
|
+
var _a;
|
|
572
|
+
const { componentType } = ((_a = w === null || w === void 0 ? void 0 : w.getConfig) === null || _a === void 0 ? void 0 : _a.call(w)) || {};
|
|
573
|
+
if (componentType === repeaterComponentName || (w === null || w === void 0 ? void 0 : w.widgetType) === `${config_1.REPEATER.MODULE_NAME}:${repeaterComponentName}`) {
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
exports.isRepeaterWidget = isRepeaterWidget;
|
|
578
|
+
function checkRepeaterComponent(xComponent) {
|
|
579
|
+
if (xComponent.moduleName === config_1.REPEATER.MODULE_NAME &&
|
|
580
|
+
(xComponent.name === config_1.REPEATER.REPEATER_NAME || xComponent.name === config_1.REPEATER.REPEATER_ITEM_NAME)) {
|
|
581
|
+
return true;
|
|
582
|
+
// skip
|
|
583
|
+
}
|
|
584
|
+
return false;
|
|
585
|
+
}
|
package/lib/builder/mp/wxml.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { IWeAppComponentInstance, IEventModifiers } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
2
|
-
import { IBuildContext } from './BuildContext';
|
|
2
|
+
import { IBuildContext, IMpCommonBuildContext } from './BuildContext';
|
|
3
3
|
export declare const WD_EMPTY_PLACEHOLDER = "wd-ph";
|
|
4
4
|
export declare const WD_RUNTIME_TAG: string[];
|
|
5
|
-
export declare function generateWxml(ctx: IBuildContext & {
|
|
5
|
+
export declare function generateWxml(ctx: (IBuildContext & {
|
|
6
6
|
pageUUID?: string;
|
|
7
|
-
}
|
|
7
|
+
}) | (IMpCommonBuildContext & {
|
|
8
|
+
pageUUID?: undefined;
|
|
9
|
+
}), widgets: {
|
|
8
10
|
[key: string]: IWeAppComponentInstance;
|
|
9
11
|
}, docTag: string, wxmlDataPrefix: any, usingComponents: any, componentGenerics: any, nodeTransform?: (cmp: IWeAppComponentInstance, node: any) => void): string;
|
|
10
12
|
export declare function getMpEventHandlerName(widgetId: string, evtName: string, modifier?: IEventModifiers): string;
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -194,35 +194,37 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
|
|
|
194
194
|
}
|
|
195
195
|
const componentKey = `${xComponent.moduleName}:${xComponent.name}`;
|
|
196
196
|
const helpMsg = `Please check component(${id}) in component tree of ${docTag}.`;
|
|
197
|
-
let tagName, path
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
197
|
+
let tagName, path;
|
|
198
|
+
const componentProto = (0, util_1.findComponentInfo)(xComponent, {
|
|
199
|
+
materialLibs: ctx.materialLibs,
|
|
200
|
+
miniprogramPlugins: ctx.miniprogramPlugins,
|
|
201
|
+
});
|
|
202
|
+
const simpleWidget = {
|
|
203
|
+
widgetType: componentKey,
|
|
204
|
+
getConfig: () => {
|
|
205
|
+
return (componentProto === null || componentProto === void 0 ? void 0 : componentProto.compConfig) || {};
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
if ((0, util_1.isRepeaterWidget)(simpleWidget, config_1.REPEATER.REPEATER_NAME)) {
|
|
209
|
+
const children = createXml(properties, parent, parentForNodes);
|
|
210
|
+
for (let item of children) {
|
|
211
|
+
item._order = xIndex || 0;
|
|
212
212
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
path = meta.path;
|
|
213
|
+
elements.push(...children);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
else if ((0, util_1.isRepeaterWidget)(simpleWidget, config_1.REPEATER.REPEATER_ITEM_NAME)) {
|
|
217
|
+
tagName = 'block';
|
|
218
|
+
path = '';
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
if (!componentProto) {
|
|
222
|
+
console.error(error(`Component(${xComponent.name}) not found in lib(${xComponent.moduleName}). ${helpMsg}`));
|
|
223
|
+
continue;
|
|
225
224
|
}
|
|
225
|
+
const meta = (0, materials_1.getWxmlTag)(ctx, xComponent, nameMangler);
|
|
226
|
+
tagName = meta.tagName;
|
|
227
|
+
path = meta.path;
|
|
226
228
|
}
|
|
227
229
|
if (genericComp === null || genericComp === void 0 ? void 0 : genericComp.propName) {
|
|
228
230
|
tagName = getGenericCompTagName(genericComp.propName);
|
|
@@ -259,7 +259,6 @@ async function downloadDependencies(targetDir, srcZipUrl) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
exports.downloadDependencies = downloadDependencies;
|
|
262
|
-
// TODO use yarn if installed
|
|
263
262
|
async function installDependencies(targetDir, options = {}) {
|
|
264
263
|
var _a;
|
|
265
264
|
let yarnExists = false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IComponentInputProps, IComponentsInfoMap, IPackageJson } from '../types/common';
|
|
2
2
|
import { IMaterialItem, IWeAppComponentInstance, IWeAppCode } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
3
|
-
export { getMetaInfoBySourceKey, isArray, isPlainObject, deepDeal, simpleDeepClone,
|
|
3
|
+
export { getMetaInfoBySourceKey, isArray, isPlainObject, deepDeal, simpleDeepClone, getFileNameByUrl, } from '@cloudbase/lowcode-generator/lib/generator/util/common';
|
|
4
4
|
declare type PromiseResult<T> = Promise<[null, T] | [Error, null]>;
|
|
5
5
|
export declare function promiseWrapper<T>(p: Promise<T>): PromiseResult<T>;
|
|
6
6
|
export declare function getCurrentPackageJson(): {
|
|
@@ -14,7 +14,6 @@ export declare function JsonToStringWithVariableName(copyJson: any, options?: {
|
|
|
14
14
|
export declare function requireUncached(module: any): any;
|
|
15
15
|
export declare function removeRequireUncached(path?: string): void;
|
|
16
16
|
export declare function getInputProps(componentsMetaMap: IComponentsInfoMap): IComponentInputProps;
|
|
17
|
-
export declare function getComponentsInfo(appBuildDir: string, dependencies: IMaterialItem[]): Promise<IComponentsInfoMap>;
|
|
18
17
|
export declare function getYyptConfigInfo(extraData: any): Promise<{
|
|
19
18
|
yyptAppKey: any;
|
|
20
19
|
reportUrl: any;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.normalizeWedaRoot = exports.normalizePackageName = exports.generateLowcodeImportor = exports.getCompileDirs = exports.deepDealComponentSchemaJson = exports.canUseVite = exports.isOfficialComponentLib = exports.readComponentLibMata = exports.writeLibCommonRes2file = exports.getYyptConfigInfo = exports.
|
|
6
|
+
exports.normalizeWedaRoot = exports.normalizePackageName = exports.generateLowcodeImportor = exports.getCompileDirs = exports.deepDealComponentSchemaJson = exports.canUseVite = exports.isOfficialComponentLib = exports.readComponentLibMata = exports.writeLibCommonRes2file = exports.getYyptConfigInfo = exports.getInputProps = exports.removeRequireUncached = exports.requireUncached = exports.JsonToStringWithVariableName = exports.getSelfPackageJson = exports.getCurrentPackageJson = exports.promiseWrapper = exports.getFileNameByUrl = exports.simpleDeepClone = exports.deepDeal = exports.isPlainObject = exports.isArray = exports.getMetaInfoBySourceKey = void 0;
|
|
7
7
|
// import * as R from 'ramda'
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -19,7 +19,6 @@ Object.defineProperty(exports, "isArray", { enumerable: true, get: function () {
|
|
|
19
19
|
Object.defineProperty(exports, "isPlainObject", { enumerable: true, get: function () { return common_1.isPlainObject; } });
|
|
20
20
|
Object.defineProperty(exports, "deepDeal", { enumerable: true, get: function () { return common_1.deepDeal; } });
|
|
21
21
|
Object.defineProperty(exports, "simpleDeepClone", { enumerable: true, get: function () { return common_1.simpleDeepClone; } });
|
|
22
|
-
Object.defineProperty(exports, "deepDealSchema", { enumerable: true, get: function () { return common_1.deepDealSchema; } });
|
|
23
22
|
Object.defineProperty(exports, "getFileNameByUrl", { enumerable: true, get: function () { return common_1.getFileNameByUrl; } });
|
|
24
23
|
const homeDir = os_1.default.homedir();
|
|
25
24
|
const commandConfigPath = path_1.default.join(homeDir, '.warc');
|
|
@@ -100,49 +99,6 @@ function getInputProps(componentsMetaMap) {
|
|
|
100
99
|
return outputObj;
|
|
101
100
|
}
|
|
102
101
|
exports.getInputProps = getInputProps;
|
|
103
|
-
async function getComponentsInfo(appBuildDir, dependencies) {
|
|
104
|
-
const outputObj = {};
|
|
105
|
-
await Promise.all(dependencies.map(async ({ name: materialName, version, components = [], isComposite }) => {
|
|
106
|
-
if (isComposite) {
|
|
107
|
-
components.forEach((component) => {
|
|
108
|
-
let { lowCodes, componentInstances, ...compItem } = component;
|
|
109
|
-
const sourceKey = `${materialName}:${compItem.name}`;
|
|
110
|
-
outputObj[sourceKey] = {
|
|
111
|
-
isComposite,
|
|
112
|
-
...compItem,
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
const materialComponentsPath = path_1.default.resolve(appBuildDir, `src/libraries/${materialName}@${version}/components`);
|
|
118
|
-
const componentLibPath = path_1.default.resolve(appBuildDir, `src/libraries/${materialName}@${version}`);
|
|
119
|
-
const meta = readComponentLibMata(componentLibPath);
|
|
120
|
-
if (meta) {
|
|
121
|
-
const { components: componentsMap } = meta;
|
|
122
|
-
for (let name in componentsMap) {
|
|
123
|
-
const sourceKey = `${materialName}:${name}`;
|
|
124
|
-
let metaJson = componentsMap[name];
|
|
125
|
-
outputObj[sourceKey] = { isComposite, ...metaJson };
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
// 老格式,需要从子目录下读取
|
|
130
|
-
const components = await fs_extra_1.default.readdir(materialComponentsPath);
|
|
131
|
-
await Promise.all(components.map(async (name) => {
|
|
132
|
-
const sourceKey = `${materialName}:${name}`;
|
|
133
|
-
const componentMetaPath = `${materialComponentsPath}/${name}/meta.json`;
|
|
134
|
-
let metaJson = {
|
|
135
|
-
name,
|
|
136
|
-
meta: await fs_extra_1.default.readJson(componentMetaPath),
|
|
137
|
-
};
|
|
138
|
-
outputObj[sourceKey] = { isComposite, ...metaJson };
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}));
|
|
143
|
-
return outputObj;
|
|
144
|
-
}
|
|
145
|
-
exports.getComponentsInfo = getComponentsInfo;
|
|
146
102
|
async function getYyptConfigInfo(extraData) {
|
|
147
103
|
let configJson;
|
|
148
104
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { OutputType } from 'jszip';
|
|
3
3
|
export declare const generatedFileContents: {};
|
|
4
|
-
export default function generateFiles(appFileData: any, srcDir: string, dstDir: string): Promise<void>;
|
|
4
|
+
export default function generateFiles(appFileData: any, srcDir: string, dstDir: string, filter?: (src: any) => boolean): Promise<void>;
|
|
5
5
|
export declare function writeFile(outFile: string, content: string): Promise<boolean>;
|
|
6
6
|
export declare function removeFile(file: string): void;
|
|
7
7
|
/**
|
|
@@ -35,7 +35,7 @@ const glob_1 = __importDefault(require("glob"));
|
|
|
35
35
|
const jszip_1 = __importDefault(require("jszip"));
|
|
36
36
|
const buffer_1 = require("buffer");
|
|
37
37
|
exports.generatedFileContents = {}; // generated files for incrmental build
|
|
38
|
-
async function generateFiles(appFileData, srcDir, dstDir) {
|
|
38
|
+
async function generateFiles(appFileData, srcDir, dstDir, filter = (src) => true) {
|
|
39
39
|
const filesGenerated = [];
|
|
40
40
|
// Generating file by template and data
|
|
41
41
|
for (const file in appFileData) {
|
|
@@ -43,6 +43,10 @@ async function generateFiles(appFileData, srcDir, dstDir) {
|
|
|
43
43
|
const srcFileName = fileNameList[0];
|
|
44
44
|
const outFileName = fileNameList[1] || fileNameList[0];
|
|
45
45
|
const srcePath = path_1.default.join(srcDir, srcFileName);
|
|
46
|
+
const use = filter ? filter(srcePath) : true;
|
|
47
|
+
if (!use) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
46
50
|
if (fs_extra_1.default.lstatSync(srcePath).isDirectory()) {
|
|
47
51
|
(0, exports.copyRecursiveSync)(srcePath, path_1.default.join(dstDir, outFileName));
|
|
48
52
|
}
|