@cloudbase/lowcode-builder 1.8.78 → 1.8.80
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.js +109 -1
- package/lib/builder/mp/index.js +33 -22
- package/lib/builder/mp/materials.js +4 -13
- package/lib/builder/mp/mp_config.d.ts +14 -0
- package/lib/builder/mp/mp_config.js +45 -13
- package/lib/builder.web.js +12 -12
- package/package.json +2 -2
- package/template/mp/common/util.js +32 -0
- package/template/mp/packages/$wd_system/pages/login/index.js +4 -30
|
@@ -59,7 +59,115 @@ exports.buildWedaConfig = buildWedaConfig;
|
|
|
59
59
|
async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, generateMpType = common_1.GenerateMpType.APP, plugins = [], extraData = {
|
|
60
60
|
isComposite: false,
|
|
61
61
|
compProps: {},
|
|
62
|
-
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {
|
|
62
|
+
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {
|
|
63
|
+
projectConfigJson: {
|
|
64
|
+
wedaRoot: '$weda_root',
|
|
65
|
+
miniprogramRoot: 'miniprogram/',
|
|
66
|
+
cloudfunctionRoot: 'cloudfunctions/',
|
|
67
|
+
setting: {
|
|
68
|
+
urlCheck: true,
|
|
69
|
+
es6: true,
|
|
70
|
+
enhance: true,
|
|
71
|
+
postcss: true,
|
|
72
|
+
preloadBackgroundData: false,
|
|
73
|
+
minified: true,
|
|
74
|
+
newFeature: true,
|
|
75
|
+
coverView: true,
|
|
76
|
+
nodeModules: false,
|
|
77
|
+
autoAudits: false,
|
|
78
|
+
showShadowRootInWxmlPanel: true,
|
|
79
|
+
scopeDataCheck: false,
|
|
80
|
+
uglifyFileName: false,
|
|
81
|
+
checkInvalidKey: true,
|
|
82
|
+
checkSiteMap: true,
|
|
83
|
+
uploadWithSourceMap: true,
|
|
84
|
+
compileHotReLoad: false,
|
|
85
|
+
useMultiFrameRuntime: true,
|
|
86
|
+
useApiHook: true,
|
|
87
|
+
useApiHostProcess: true,
|
|
88
|
+
babelSetting: {
|
|
89
|
+
ignore: [],
|
|
90
|
+
disablePlugins: [],
|
|
91
|
+
outputPath: '',
|
|
92
|
+
},
|
|
93
|
+
enableEngineNative: false,
|
|
94
|
+
useIsolateContext: true,
|
|
95
|
+
useCompilerModule: true,
|
|
96
|
+
userConfirmedUseCompilerModuleSwitch: false,
|
|
97
|
+
userConfirmedBundleSwitch: false,
|
|
98
|
+
packNpmManually: false,
|
|
99
|
+
packNpmRelationList: [
|
|
100
|
+
{
|
|
101
|
+
packageJsonPath: 'miniprogram/$weda_root/package.json',
|
|
102
|
+
miniprogramNpmDistDir: '232miniprogram/$weda_root',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
packageJsonPath: 'miniprogram/$weda_root/packages/$wd_system/package.json',
|
|
106
|
+
miniprogramNpmDistDir: '2323miniprogram/$weda_root/packages/$wd_system',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
packageJsonPath: '111$weda_root/package.json',
|
|
110
|
+
miniprogramNpmDistDir: '$weda_root',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
packageJsonPath: '/$weda_root/packages/$wd_system/package.json',
|
|
114
|
+
miniprogramNpmDistDir: '$weda_root/packages/$wd_system',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
minifyWXSS: true,
|
|
118
|
+
},
|
|
119
|
+
appid: 'wxcf5102ada68a7ac9',
|
|
120
|
+
projectname: 'quickstart-wx-cloud',
|
|
121
|
+
libVersion: '2.20.1',
|
|
122
|
+
cloudfunctionTemplateRoot: 'cloudfunctionTemplate/',
|
|
123
|
+
condition: {
|
|
124
|
+
search: {
|
|
125
|
+
list: [],
|
|
126
|
+
},
|
|
127
|
+
conversation: {
|
|
128
|
+
list: [],
|
|
129
|
+
},
|
|
130
|
+
plugin: {
|
|
131
|
+
list: [],
|
|
132
|
+
},
|
|
133
|
+
game: {
|
|
134
|
+
list: [],
|
|
135
|
+
},
|
|
136
|
+
miniprogram: {
|
|
137
|
+
list: [
|
|
138
|
+
{
|
|
139
|
+
id: -1,
|
|
140
|
+
name: 'db guide',
|
|
141
|
+
pathName: 'pages/databaseGuide/databaseGuide',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
compileType: 'miniprogram',
|
|
147
|
+
srcMiniprogramRoot: 'miniprogram/',
|
|
148
|
+
packOptions: {
|
|
149
|
+
ignore: [],
|
|
150
|
+
include: [],
|
|
151
|
+
},
|
|
152
|
+
editorSetting: {
|
|
153
|
+
tabIndent: 'auto',
|
|
154
|
+
tabSize: 2,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
appJson: {
|
|
158
|
+
pages: [],
|
|
159
|
+
window: {
|
|
160
|
+
backgroundColor: '#F6F6F6',
|
|
161
|
+
backgroundTextStyle: 'light',
|
|
162
|
+
navigationBarBackgroundColor: '#F6F6F6',
|
|
163
|
+
navigationBarTitleText: '云开发 QuickStart',
|
|
164
|
+
navigationBarTextStyle: 'black',
|
|
165
|
+
},
|
|
166
|
+
sitemapLocation: 'sitemap.json',
|
|
167
|
+
style: 'v2',
|
|
168
|
+
lazyCodeLoading: 'requiredComponents',
|
|
169
|
+
},
|
|
170
|
+
}, }, cb) {
|
|
63
171
|
var _a, _b, _c, _d, _e, _f;
|
|
64
172
|
if (!cals) {
|
|
65
173
|
console.error('无效的应用配置');
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -53,6 +53,7 @@ const core_1 = require("../core");
|
|
|
53
53
|
const theme_1 = require("../../utils/theme");
|
|
54
54
|
const index_1 = require("../config/index");
|
|
55
55
|
const mixMode_1 = require("./mixMode");
|
|
56
|
+
const axios_1 = __importDefault(require("axios"));
|
|
56
57
|
const templateDir = `${config_1.appTemplateDir}/mp/`;
|
|
57
58
|
const em = chalk_1.default.blue.bold;
|
|
58
59
|
const error = chalk_1.default.redBright;
|
|
@@ -70,7 +71,7 @@ function patchBuildContext(ctx, calses) {
|
|
|
70
71
|
return { used: used };
|
|
71
72
|
}
|
|
72
73
|
async function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, options, buildTypeList, ignoreInstall = false, cdnEndpoints = {}, mpConfig = {}, }) {
|
|
73
|
-
var _a, _b, _c, _d;
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
74
75
|
const operationLabel = em('Wexin MiniProgram Generated');
|
|
75
76
|
console.time(operationLabel);
|
|
76
77
|
console.log(`Generating ${em('Wexin MiniProgram')} to ${_buildContext.projDir}`);
|
|
@@ -112,7 +113,11 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
112
113
|
..._buildContext,
|
|
113
114
|
wedaRoot: (0, util_3.normalizeWedaRoot)(projectConfigJson.wedaRoot),
|
|
114
115
|
};
|
|
115
|
-
// #
|
|
116
|
+
// #1.5 安装依赖库,生成 materials 目录副作用修改了buildContext 因此需要早于页面生成
|
|
117
|
+
if (hasLowcodePkg) {
|
|
118
|
+
await (0, materials_1.installMaterials)(buildContext, localWedaRoot, used, weapps);
|
|
119
|
+
}
|
|
120
|
+
// #2 生成主包, 若主包为代码包上游已经处理过,不再处理
|
|
116
121
|
if (mainAppData.mpPkgUrl) {
|
|
117
122
|
}
|
|
118
123
|
else {
|
|
@@ -121,8 +126,6 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
121
126
|
// #3 生成 wedaRoot 文件
|
|
122
127
|
if (hasLowcodePkg) {
|
|
123
128
|
await generateFramework(buildContext, { cals: calses[0], weapp: mainAppData }, localWedaRoot, { deployOptions });
|
|
124
|
-
// 安装依赖库,生成 materials 目录
|
|
125
|
-
await (0, materials_1.installMaterials)(buildContext, localWedaRoot, used, weapps);
|
|
126
129
|
await generateConfig({
|
|
127
130
|
domain,
|
|
128
131
|
isPrivateMode,
|
|
@@ -138,6 +141,22 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
138
141
|
map[key] = value;
|
|
139
142
|
return map;
|
|
140
143
|
}, {}) || {};
|
|
144
|
+
let customLoginConfig;
|
|
145
|
+
let loginConfigPathname = ((_d = (_c = calses[0]) === null || _c === void 0 ? void 0 : _c.extra) === null || _d === void 0 ? void 0 : _d.loginConfigVersion)
|
|
146
|
+
? (0, cals_1.generateCustomLoginConfigPathname)({ appId, version: (_f = (_e = calses[0]) === null || _e === void 0 ? void 0 : _e.extra) === null || _f === void 0 ? void 0 : _f.loginConfigVersion })
|
|
147
|
+
: '';
|
|
148
|
+
if (loginConfigPathname) {
|
|
149
|
+
const url = `https://${domain}${loginConfigPathname}`;
|
|
150
|
+
try {
|
|
151
|
+
const { data } = await axios_1.default.get(url, { responseType: 'json' });
|
|
152
|
+
if (data) {
|
|
153
|
+
customLoginConfig = data;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
console.error('预置获取登录配置失败:', url, e);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
141
160
|
const wedaRootFileData = {
|
|
142
161
|
'common/style.js': {},
|
|
143
162
|
'common/util.js': {
|
|
@@ -146,6 +165,10 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
146
165
|
expirationStartTimesnap,
|
|
147
166
|
runtimeDynamicConfig: buildContext.runtimeDynamicConfig,
|
|
148
167
|
RUNTIME_CONFIG_URL: index_1.RUNTIME_CONFIG_URL,
|
|
168
|
+
loginConfigPathname: ((_h = (_g = calses[0]) === null || _g === void 0 ? void 0 : _g.extra) === null || _h === void 0 ? void 0 : _h.loginConfigVersion)
|
|
169
|
+
? (0, cals_1.generateCustomLoginConfigPathname)({ appId, version: (_k = (_j = calses[0]) === null || _j === void 0 ? void 0 : _j.extra) === null || _k === void 0 ? void 0 : _k.loginConfigVersion })
|
|
170
|
+
: '',
|
|
171
|
+
customLoginConfig: customLoginConfig ? JSON.stringify(customLoginConfig, undefined, 2) : 'null',
|
|
149
172
|
},
|
|
150
173
|
'common/widget.js': {},
|
|
151
174
|
'common/weapp-page.js': {
|
|
@@ -197,9 +220,9 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
197
220
|
appID: appId,
|
|
198
221
|
resourceAppid: !!options.isCrossAccount ? options.resourceAppId : '',
|
|
199
222
|
isProd: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD,
|
|
200
|
-
clientID: ((
|
|
223
|
+
clientID: ((_l = mainAppData.extra) === null || _l === void 0 ? void 0 : _l.enableLoginStatusShare)
|
|
201
224
|
? mainAppData.envId
|
|
202
|
-
: (
|
|
225
|
+
: (_m = mainAppData.extra) === null || _m === void 0 ? void 0 : _m.clientId,
|
|
203
226
|
cdnEndpoints,
|
|
204
227
|
builderVersion: core_1.version || '',
|
|
205
228
|
officialLibVersion: (officialLib === null || officialLib === void 0 ? void 0 : officialLib.version) || '',
|
|
@@ -240,6 +263,9 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
240
263
|
projectConfigJson.setting = {
|
|
241
264
|
...projectConfigJson.setting,
|
|
242
265
|
...projConfig.setting,
|
|
266
|
+
packNpmRelationList: ((_o = projConfig.setting) === null || _o === void 0 ? void 0 : _o.packNpmRelationList) || ((_p = projectConfigJson.setting) === null || _p === void 0 ? void 0 : _p.packNpmRelationList)
|
|
267
|
+
? (0, mp_config_1.mergePackNpmRelationList)(projConfig.setting.packNpmRelationList, (_q = projectConfigJson.setting) === null || _q === void 0 ? void 0 : _q.packNpmRelationList)
|
|
268
|
+
: undefined,
|
|
243
269
|
};
|
|
244
270
|
const wedaRoot = path_1.default.posix.join('./', projectConfigJson.miniprogramRoot || '/', projectConfigJson.wedaRoot || '');
|
|
245
271
|
if (!projectConfigJson.setting.packNpmManually) {
|
|
@@ -248,22 +274,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
248
274
|
if (!projectConfigJson.setting.packNpmRelationList) {
|
|
249
275
|
projectConfigJson.setting.packNpmRelationList = [];
|
|
250
276
|
}
|
|
251
|
-
projectConfigJson.setting.packNpmRelationList =
|
|
252
|
-
...projectConfigJson.setting.packNpmRelationList.filter((item) => [
|
|
253
|
-
'./package.json',
|
|
254
|
-
'/package.json',
|
|
255
|
-
'./packages/$wd_system/package.json',
|
|
256
|
-
'/packages/$wd_system/package.json',
|
|
257
|
-
].includes(item.packageJsonPath)),
|
|
258
|
-
{
|
|
259
|
-
packageJsonPath: `./${path_1.default.posix.join(wedaRoot, 'package.json')}`,
|
|
260
|
-
miniprogramNpmDistDir: `./${wedaRoot}`,
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
packageJsonPath: `./${path_1.default.posix.join(wedaRoot, 'packages', '$wd_system', 'package.json')}`,
|
|
264
|
-
miniprogramNpmDistDir: `./${path_1.default.posix.join(wedaRoot, 'packages', '$wd_system')}`,
|
|
265
|
-
},
|
|
266
|
-
];
|
|
277
|
+
projectConfigJson.setting.packNpmRelationList = (0, mp_config_1.mergePackNpmRelationList)((0, mp_config_1.generateSystemPackNpmRelationList)(wedaRoot), projectConfigJson.setting.packNpmRelationList);
|
|
267
278
|
await (0, generateFiles_1.writeFile)(projectConfigJsonPath, JSON.stringify(projectConfigJson, undefined, 2));
|
|
268
279
|
// 有了 framework app 之后,并且是源码的方式,追加 app 引用
|
|
269
280
|
if (hasLowcodePkg) {
|
|
@@ -329,7 +329,7 @@ async function generateCompositeComponent(ctx, compositedComp, outDir, compLibCo
|
|
|
329
329
|
*/
|
|
330
330
|
const NAME_MANAGER = new name_mangler_1.default({ blackList: mp_1.builtinMpTags });
|
|
331
331
|
function getWxmlTag(ctx, cmp, nameMangler) {
|
|
332
|
-
var _a, _b, _c, _d, _e, _f
|
|
332
|
+
var _a, _b, _c, _d, _e, _f;
|
|
333
333
|
const { moduleName, name } = cmp;
|
|
334
334
|
const materialLib = ctx.materialLibs.find((lib) => lib.name === moduleName);
|
|
335
335
|
const miniprogramPlugin = (_a = ctx.miniprogramPlugins) === null || _a === void 0 ? void 0 : _a.find((plugin) => plugin.name === moduleName);
|
|
@@ -338,22 +338,16 @@ function getWxmlTag(ctx, cmp, nameMangler) {
|
|
|
338
338
|
const components = (materialLib === null || materialLib === void 0 ? void 0 : materialLib.components) || (miniprogramPlugin === null || miniprogramPlugin === void 0 ? void 0 : miniprogramPlugin.componentConfigs);
|
|
339
339
|
const findComponent = components === null || components === void 0 ? void 0 : components.find((comp) => comp.name === name);
|
|
340
340
|
if (!findComponent) {
|
|
341
|
-
if (moduleName === cals_1.OFFICIAL_COMPONENT_LIB_NAME) {
|
|
342
|
-
console.log('>>>>>>>>>>>>>>>>>>>>', (_c = (_b = components === null || components === void 0 ? void 0 : components.map) === null || _b === void 0 ? void 0 : _b.call(components, (comp) => comp.name)) === null || _c === void 0 ? void 0 : _c.join(','));
|
|
343
|
-
}
|
|
344
341
|
return { tagName };
|
|
345
342
|
}
|
|
346
343
|
if (materialLib) {
|
|
347
344
|
let cmpMeta = (findComponent === null || findComponent === void 0 ? void 0 : findComponent.meta) || { platforms: undefined };
|
|
348
345
|
if (!cmpMeta.platforms) {
|
|
349
|
-
if (moduleName === cals_1.OFFICIAL_COMPONENT_LIB_NAME) {
|
|
350
|
-
console.log('>>>>>>>>>>>>>>>>>>>>', JSON.stringify(cmpMeta));
|
|
351
|
-
}
|
|
352
346
|
return { tagName };
|
|
353
347
|
}
|
|
354
|
-
compPath = (
|
|
355
|
-
if ((
|
|
356
|
-
tagName = (
|
|
348
|
+
compPath = (_c = (_b = cmpMeta === null || cmpMeta === void 0 ? void 0 : cmpMeta.platforms) === null || _b === void 0 ? void 0 : _b.mp) === null || _c === void 0 ? void 0 : _c.path;
|
|
349
|
+
if ((_e = (_d = cmpMeta === null || cmpMeta === void 0 ? void 0 : cmpMeta.platforms) === null || _d === void 0 ? void 0 : _d.mp) === null || _e === void 0 ? void 0 : _e.tagName) {
|
|
350
|
+
tagName = (_f = cmpMeta === null || cmpMeta === void 0 ? void 0 : cmpMeta.platforms) === null || _f === void 0 ? void 0 : _f.mp.tagName;
|
|
357
351
|
}
|
|
358
352
|
if (compPath) {
|
|
359
353
|
compPath =
|
|
@@ -376,9 +370,6 @@ function getWxmlTag(ctx, cmp, nameMangler) {
|
|
|
376
370
|
if (!tagName) {
|
|
377
371
|
tagName = name.toLocaleUpperCase();
|
|
378
372
|
}
|
|
379
|
-
if (moduleName === cals_1.OFFICIAL_COMPONENT_LIB_NAME && !compPath) {
|
|
380
|
-
console.log('>>>>>>>>>>>>>>>>>>>>**sdfsdf');
|
|
381
|
-
}
|
|
382
373
|
return {
|
|
383
374
|
tagName,
|
|
384
375
|
path: compPath,
|
|
@@ -24,4 +24,18 @@ interface ISubpackage {
|
|
|
24
24
|
}>;
|
|
25
25
|
}
|
|
26
26
|
export declare function mergeSubPackages(base?: ISubpackage[], extra?: ISubpackage[]): ISubpackage[];
|
|
27
|
+
export declare function mergePackNpmRelationList(base?: {
|
|
28
|
+
packageJsonPath: string;
|
|
29
|
+
miniprogramNpmDistDir: string;
|
|
30
|
+
}[], extra?: {
|
|
31
|
+
packageJsonPath: string;
|
|
32
|
+
miniprogramNpmDistDir: string;
|
|
33
|
+
}[]): {
|
|
34
|
+
packageJsonPath: string;
|
|
35
|
+
miniprogramNpmDistDir: string;
|
|
36
|
+
}[];
|
|
37
|
+
export declare function generateSystemPackNpmRelationList(wedaRootProjectPath: any): {
|
|
38
|
+
packageJsonPath: string;
|
|
39
|
+
miniprogramNpmDistDir: any;
|
|
40
|
+
}[];
|
|
27
41
|
export {};
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.mergeSubPackages = exports.generateMpConfig = void 0;
|
|
29
|
+
exports.generateSystemPackNpmRelationList = exports.mergePackNpmRelationList = exports.mergeSubPackages = exports.generateMpConfig = void 0;
|
|
30
30
|
const path = __importStar(require("path"));
|
|
31
31
|
const lodash_1 = require("lodash");
|
|
32
32
|
const mp_1 = require("@cloudbase/lowcode-generator/lib/generator/config/mp");
|
|
@@ -42,7 +42,7 @@ const util_1 = require("../util");
|
|
|
42
42
|
* @param appConfigs app config from prop edit panel
|
|
43
43
|
*/
|
|
44
44
|
function generateMpConfig(ctx, weapps, options) {
|
|
45
|
-
var _a;
|
|
45
|
+
var _a, _b, _c;
|
|
46
46
|
const appConfig = {
|
|
47
47
|
useExtendedLib: { weui: true },
|
|
48
48
|
};
|
|
@@ -69,7 +69,15 @@ function generateMpConfig(ctx, weapps, options) {
|
|
|
69
69
|
// keep main app config only, ignore subapp config
|
|
70
70
|
const configs = (kbConfig ? [eval(`(${kbConfig.code.replace(/export\s+default/, '')})`)] : []).concat([
|
|
71
71
|
{ appJson: mainAppConfig },
|
|
72
|
-
|
|
72
|
+
{
|
|
73
|
+
...options.mpConfig,
|
|
74
|
+
appJson: ((_b = options.mpConfig) === null || _b === void 0 ? void 0 : _b.appJson)
|
|
75
|
+
? {
|
|
76
|
+
...(_c = options.mpConfig) === null || _c === void 0 ? void 0 : _c.appJson,
|
|
77
|
+
sitemapLocation: undefined,
|
|
78
|
+
}
|
|
79
|
+
: {},
|
|
80
|
+
},
|
|
73
81
|
]);
|
|
74
82
|
configs.forEach((config) => {
|
|
75
83
|
if (config) {
|
|
@@ -160,16 +168,12 @@ function generateMpConfig(ctx, weapps, options) {
|
|
|
160
168
|
// projConfig.setting.compileHotReLoad = false;
|
|
161
169
|
projConfig.setting.bigPackageSizeSupport = true;
|
|
162
170
|
projConfig.setting.packNpmManually = true;
|
|
163
|
-
projConfig.setting.packNpmRelationList
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
packageJsonPath: path.posix.join(projConfig.wedaRoot || './', 'packages', '$wd_system', 'package.json'),
|
|
170
|
-
miniprogramNpmDistDir: path.posix.join(projConfig.wedaRoot || './', 'packages', '$wd_system'),
|
|
171
|
-
},
|
|
172
|
-
];
|
|
171
|
+
if (!projConfig.setting.packNpmRelationList) {
|
|
172
|
+
projConfig.setting.packNpmRelationList = [];
|
|
173
|
+
}
|
|
174
|
+
projConfig.setting.packNpmRelationList = mergePackNpmRelationList(generateSystemPackNpmRelationList(path.posix.join(projConfig.miniprogramRoot, projConfig.wedaRoot)), projConfig.setting.packNpmRelationList.filter((item) => {
|
|
175
|
+
return !/\/packages\/\$wd_system\/package.json/.test(item.packageJsonPath);
|
|
176
|
+
}));
|
|
173
177
|
if (process.env.IS_WEB_WORKER) {
|
|
174
178
|
projConfig.setting.ignoreUploadUnusedFiles = true;
|
|
175
179
|
}
|
|
@@ -270,3 +274,31 @@ function mergeSubPackages(base = [], extra = []) {
|
|
|
270
274
|
return base;
|
|
271
275
|
}
|
|
272
276
|
exports.mergeSubPackages = mergeSubPackages;
|
|
277
|
+
function mergePackNpmRelationList(base = [], extra = []) {
|
|
278
|
+
const baseMap = base.reduce((map, item) => {
|
|
279
|
+
map[path.posix.join('./', item.packageJsonPath, 'fake')] = true;
|
|
280
|
+
return map;
|
|
281
|
+
}, {});
|
|
282
|
+
const res = [...base];
|
|
283
|
+
extra.forEach((item) => {
|
|
284
|
+
const key = path.posix.join('./', item.packageJsonPath, 'fake');
|
|
285
|
+
if (!baseMap[key]) {
|
|
286
|
+
res.push(item);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
return res;
|
|
290
|
+
}
|
|
291
|
+
exports.mergePackNpmRelationList = mergePackNpmRelationList;
|
|
292
|
+
function generateSystemPackNpmRelationList(wedaRootProjectPath) {
|
|
293
|
+
return [
|
|
294
|
+
{
|
|
295
|
+
packageJsonPath: path.posix.join(wedaRootProjectPath || './', 'package.json'),
|
|
296
|
+
miniprogramNpmDistDir: wedaRootProjectPath || './',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
packageJsonPath: path.posix.join(wedaRootProjectPath || './', 'packages', '$wd_system', 'package.json'),
|
|
300
|
+
miniprogramNpmDistDir: path.posix.join(wedaRootProjectPath || './', 'packages', '$wd_system'),
|
|
301
|
+
},
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
exports.generateSystemPackNpmRelationList = generateSystemPackNpmRelationList;
|