@cloudbase/lowcode-builder 1.8.94 → 1.8.95

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.
@@ -295,15 +295,9 @@ function normalizeInputs(inputs, { envId, getWebRootPath, }) {
295
295
  };
296
296
  if (inputs.mainAppSerializeData) {
297
297
  inputs.mainAppSerializeData = normalizeCals(inputs.mainAppSerializeData, normalizeCalsOptions);
298
- if ((0, common_1.buildAsWebByBuildType)(inputs.buildTypeList)) {
299
- inputs.subAppSerializeDataList = [];
300
- }
301
298
  }
302
299
  if (inputs.cals) {
303
300
  inputs.cals = normalizeCals(inputs.cals, normalizeCalsOptions);
304
- if ((0, common_1.buildAsWebByBuildType)(inputs.buildTypeList)) {
305
- inputs.subAppCalsList = [];
306
- }
307
301
  }
308
302
  if (!(0, common_1.buildAsWebByBuildType)(inputs.buildTypeList)) {
309
303
  // 小程序构建
@@ -113,8 +113,8 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
113
113
  await (0, generate_1.generateProjectFiles)({
114
114
  dependencies: processedDependencies,
115
115
  cals,
116
+ sub_cals: subAppCalsList,
116
117
  mainAppData,
117
- subAppDataList,
118
118
  appKey,
119
119
  publicPath,
120
120
  i18nConfig,
@@ -128,6 +128,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
128
128
  _indexPage,
129
129
  isPrivateMode,
130
130
  expirationStartTimesnap: enableExpiredTag ? Date.now() : undefined,
131
+ usedComps: used,
131
132
  });
132
133
  console.timeEnd(runGenerateTag);
133
134
  // // 构建 NPM 包
@@ -195,11 +196,28 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
195
196
  // 普通 web 模式,且非hash模式,根据页面生成多份入口
196
197
  if (!((_f = cals.extra) === null || _f === void 0 ? void 0 : _f.historyType) || cals.extra.historyType === types_1.HISTORY_TYPE.BROWSER) {
197
198
  preHeatUrls.push(path_1.default.posix.join(basename || ''));
198
- await Promise.all((cals.items || []).map((page) => {
199
- preHeatUrls.push(path_1.default.posix.join(basename || '', page.id));
200
- preHeatUrls.push(path_1.default.posix.join(basename || '', page.id, '/'));
201
- return fs_extra_1.default.copy(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, 'index.html'), path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, page.id, 'index.html'));
202
- }));
199
+ await Promise.all([
200
+ ...(cals.items || []).map((page) => {
201
+ preHeatUrls.push(path_1.default.posix.join(basename || '', page.id));
202
+ preHeatUrls.push(path_1.default.posix.join(basename || '', page.id, '/'));
203
+ return fs_extra_1.default.copy(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, 'index.html'), path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, page.id, 'index.html'));
204
+ }),
205
+ ...(subAppCalsList || []).reduce((list, cals) => {
206
+ const { rootPath } = cals.extra || {};
207
+ const packageName = (0, util_1.normalizePackageName)(rootPath);
208
+ if (packageName) {
209
+ preHeatUrls.push(path_1.default.posix.join(basename || '', packageName));
210
+ preHeatUrls.push(path_1.default.posix.join(basename || '', packageName, '/'));
211
+ list.push(fs_extra_1.default.copy(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, 'index.html'), path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, packageName, 'index.html')));
212
+ (cals.items || []).forEach((page) => {
213
+ preHeatUrls.push(path_1.default.posix.join(basename || '', packageName, page.id));
214
+ preHeatUrls.push(path_1.default.posix.join(basename || '', packageName, page.id, '/'));
215
+ list.push(fs_extra_1.default.copy(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, 'index.html'), path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, packageName, page.id, 'index.html')));
216
+ });
217
+ }
218
+ return list;
219
+ }, []),
220
+ ]);
203
221
  }
204
222
  await fs_extra_1.default.writeFile(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, 'weda-manifest.json'), JSON.stringify({ preHeatUrls }, undefined, 2));
205
223
  return h5BuildDir;
@@ -64,7 +64,7 @@ function patchBuildContext(ctx, calses) {
64
64
  * 修改 buildContext 进行 miniprogramPlugins 精简
65
65
  */
66
66
  ctx.miniprogramPlugins = (mainAppData.miniprogramPlugins || []).filter((plugin) => used.component[plugin.name] || used.action[plugin.name]);
67
- return { used: used };
67
+ return { used };
68
68
  }
69
69
  async function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, options, buildTypeList, ignoreInstall = false, cdnEndpoints = {}, mpConfig = {}, }) {
70
70
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
@@ -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, deepDealSchema, getFileNameByUrl, } from '@cloudbase/lowcode-generator/lib/generator/util/common';
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(): {
@@ -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.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;
6
+ exports.normalizeWedaRoot = exports.normalizePackageName = exports.generateLowcodeImportor = exports.getCompileDirs = exports.deepDealComponentSchemaJson = exports.canUseVite = 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.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');