@cloudbase/lowcode-builder 1.4.3 → 1.4.4

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.
@@ -94,18 +94,16 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
94
94
  // 尽早下载物料
95
95
  await (0, net_1.downloadBrowserMaterial)(output === null || output === void 0 ? void 0 : output.path);
96
96
  }
97
- const { enablePageRoot } = (0, cals_1.parseVersion)(cals === null || cals === void 0 ? void 0 : cals.schemaVersion, dependencies);
98
97
  const mpBuildContext = {
99
98
  ...buildContext,
100
99
  projDir: (output === null || output === void 0 ? void 0 : output.path) || path_1.default.join(appBuildDir, 'mp'),
101
100
  mainAppData: mainAppSerializeData,
102
101
  processCssUnit: ([cals, ...subAppCalsList].find((cals) => {
103
- const FEATURE_MAP = (0, cals_1.parseVersion)(cals.schemaVersion, dependencies);
102
+ const FEATURE_MAP = (0, cals_1.parseVersion)(cals.schemaVersion);
104
103
  return !FEATURE_MAP.defaultDynamicCssUnit;
105
104
  })
106
105
  ? 'px'
107
106
  : 'rpx'),
108
- enablePageRoot,
109
107
  };
110
108
  const result = await (0, index_1.generateWxMp)({
111
109
  weapps: apps,
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -20,6 +43,7 @@ const mp_1 = require("../mp");
20
43
  const common_2 = require("../../utils/common");
21
44
  const config_1 = require("../config");
22
45
  const fs_extra_1 = __importDefault(require("fs-extra"));
46
+ const junk = __importStar(require("../util/junk"));
23
47
  async function buildH5App({ buildContext, i18nConfig, extraData, cals, buildTypeList = [common_1.BuildType.WEB], subAppCalsList, mode, devTool, runtime = types_1.RUNTIME.NONE, deployMode = types_1.DEPLOY_MODE.PREVIEW, ignoreInstall = false, cdnEndpoints, }) {
24
48
  var _a, _b, _c;
25
49
  const { projDir: buildDir, domain, materialLibs: dependencies, appId: appKey, isPrivateMode } = buildContext;
@@ -136,10 +160,23 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals, buildType
136
160
  }
137
161
  });
138
162
  });
163
+ const MAINIFAST_FILENAME = 'weda-manifest.json';
164
+ const preHeatUrls = fs_extra_1.default
165
+ .readdirSync(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR))
166
+ .filter((file) => junk.not(file) && file !== MAINIFAST_FILENAME)
167
+ .map((file) => {
168
+ return path_1.default.posix.join(basename, file);
169
+ });
139
170
  // 普通 web 模式,且非hash模式,根据页面生成多份入口
140
171
  if (!((_c = cals.extra) === null || _c === void 0 ? void 0 : _c.historyType) || cals.extra.historyType === types_1.HISTORY_TYPE.BROWSER) {
141
- await Promise.all((cals.items || []).map((page) => 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'))));
172
+ preHeatUrls.push(path_1.default.posix.join(basename));
173
+ await Promise.all((cals.items || []).map((page) => {
174
+ preHeatUrls.push(path_1.default.posix.join(basename, page.id));
175
+ preHeatUrls.push(path_1.default.posix.join(basename, page.id, '/'));
176
+ 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'));
177
+ }));
142
178
  }
179
+ await fs_extra_1.default.writeFile(path_1.default.resolve(h5BuildDir, webpack_2.OUTPUT_DIR, 'weda-manifest.json'), JSON.stringify({ preHeatUrls }, undefined, 2));
143
180
  return h5BuildDir;
144
181
  }
145
182
  catch (e) {
@@ -26,9 +26,4 @@ export interface IBuildContext {
26
26
  * 云开发sdk请求,js-sdk or wx.cloud
27
27
  */
28
28
  endpointType?: 'tcb-api' | 'wechat-service';
29
- /**
30
- * 是否在页面层面添加节点
31
- * 并设置 #page-root-id
32
- */
33
- enablePageRoot?: boolean;
34
29
  }
@@ -32,15 +32,13 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
32
32
  ].concat(createXml(widgets)),
33
33
  };
34
34
  if (ctx.isPage) {
35
- const { enablePageRoot } = ctx;
36
35
  const originElements = xmlJson.elements;
37
36
  // 登录校验: 向其最外层包裹一层block
38
37
  xmlJson.elements = [
39
38
  {
40
39
  type: 'element',
41
- name: enablePageRoot ? 'view' : 'block',
40
+ name: 'block',
42
41
  attributes: {
43
- id: 'wd-page-root',
44
42
  ['wx:if']: '{{weDaHasLogin}}',
45
43
  ['data-weui-theme']: 'light',
46
44
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
5
5
  "author": "yhsunshining@gmail.com",
6
6
  "homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
@@ -38,7 +38,7 @@
38
38
  "url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
39
39
  },
40
40
  "dependencies": {
41
- "@cloudbase/cals": "^0.5.12",
41
+ "@cloudbase/cals": "^0.5.14",
42
42
  "@cloudbase/lowcode-generator": "^1.4.0",
43
43
  "axios": "^0.21.0",
44
44
  "browserfs": "^1.4.3",
@@ -475,7 +475,7 @@
475
475
  crossorigin
476
476
  src="<%=
477
477
  cdnEndpoints.cdngo
478
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.2d3f3e4f3bfd356a2a85.bundle.js"
478
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.39b933e356640041bb42.bundle.js"
479
479
  ></script>
480
480
  </body>
481
481
  </html>