@cloudbase/lowcode-builder 1.5.1 → 1.5.3

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.
@@ -6,8 +6,9 @@ import { BuildType } from '../types/common';
6
6
  * 该函数从 @govcloud/generate 取到需要的模版文件
7
7
  */
8
8
  export declare function generateProjectFiles(buildData: BuildAppProps): Promise<void>;
9
- export declare function generateHTML({ appId, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints, }: {
9
+ export declare function generateHTML({ appId, envId, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints, }: {
10
10
  appId: string;
11
+ envId: string;
11
12
  externalResources: Required<IPlatformApp>['externalResources'];
12
13
  appBuildDir: string;
13
14
  mode: string;
@@ -25,7 +25,7 @@ async function generateProjectFiles(buildData) {
25
25
  }));
26
26
  }
27
27
  exports.generateProjectFiles = generateProjectFiles;
28
- async function generateHTML({ appId, appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints, }) {
28
+ async function generateHTML({ appId, envId, appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints, }) {
29
29
  const templatePath = path_1.default.join(config_1.appTemplateDir, 'html', 'index.html.ejs');
30
30
  const dstFilePath = path_1.default.join(appBuildDir, 'index.html');
31
31
  const packageTpl = await fs_extra_1.default.readFile(templatePath, { encoding: 'utf8' });
@@ -54,6 +54,16 @@ async function generateHTML({ appId, appBuildDir, externalResources = [], mode,
54
54
  isBuildApp,
55
55
  isAdminPortal: (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
56
56
  cdnEndpoints: (0, config_1.generateCdnEndpoints)(cdnEndpoints),
57
+ /**
58
+ * @deprecated
59
+ * 临时先这么添加白名单
60
+ */
61
+ enableStaticLoading: [
62
+ 'lowcode-4gzdsu5k66946492',
63
+ 'lowcode-2gay8jgh25c7b1cf',
64
+ 'lowcode-4g9b78bx94404d85',
65
+ 'lowcode-8gmx7bat3135e2de',
66
+ ].includes(envId) && !(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
57
67
  }));
58
68
  }
59
69
  exports.generateHTML = generateHTML;
@@ -28,6 +28,7 @@ async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir,
28
28
  console.timeEnd('generateMpJsonConfigFile');
29
29
  await (0, generate_1.generateHTML)({
30
30
  appId: mainAppData.id || appKey,
31
+ envId: mainAppData.envId || '',
31
32
  appBuildDir,
32
33
  externalResources: (cals.externalResources || []).concat(assets.map((url) => ({
33
34
  type: cals_1.EExternalResourceType.CSSUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
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,8 +38,8 @@
38
38
  "url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
39
39
  },
40
40
  "dependencies": {
41
- "@cloudbase/cals": "^0.5.16",
42
- "@cloudbase/lowcode-generator": "^1.5.1",
41
+ "@cloudbase/cals": "^0.5.17",
42
+ "@cloudbase/lowcode-generator": "^1.5.3",
43
43
  "axios": "^0.21.0",
44
44
  "browserfs": "^1.4.3",
45
45
  "browserify-zlib": "^0.2.0",
@@ -386,7 +386,75 @@
386
386
  </head>
387
387
 
388
388
  <body data-weui-theme="light">
389
- <div id="root" class="main-wrap"></div>
389
+ <div id="root" class="main-wrap">
390
+ <% if(enableStaticLoading){ %>
391
+ <style type="text/css">
392
+ .weda-loading-container {
393
+ position: fixed;
394
+ left: 0;
395
+ top: 0;
396
+ width: 100%;
397
+ display: flex;
398
+ justify-content: center;
399
+ align-items: center;
400
+ flex-direction: column;
401
+ height: 100%;
402
+ padding: 0 20px;
403
+ }
404
+ .weda-loading-container .logo {
405
+ width: 100%;
406
+ display: flex;
407
+ justify-content: center;
408
+ text-align: center;
409
+ margin-bottom: 50px;
410
+ }
411
+
412
+ .weda-loading-container .sp {
413
+ width: 48px;
414
+ height: 48px;
415
+ }
416
+
417
+ .weda-loading-container .sp-circle {
418
+ border: 6px rgba(0, 82, 217, 0.25) solid;
419
+ border-top: 6px rgba(0, 82, 217, 1) solid;
420
+ border-radius: 50%;
421
+ -webkit-animation: spCircRot 0.6s infinite linear;
422
+ animation: spCircRot 0.6s infinite linear;
423
+ }
424
+ @-webkit-keyframes spCircRot {
425
+ from {
426
+ -webkit-transform: rotate(0deg);
427
+ }
428
+ to {
429
+ -webkit-transform: rotate(359deg);
430
+ }
431
+ }
432
+ @keyframes spCircRot {
433
+ from {
434
+ transform: rotate(0deg);
435
+ }
436
+ to {
437
+ transform: rotate(359deg);
438
+ }
439
+ }
440
+ </style>
441
+ <div class="weda-loading-container">
442
+ <div class="logo">
443
+ <div class="sp sp-circle"></div>
444
+ </div>
445
+ <div class="text">初始化中...</div>
446
+ <script>
447
+ const ua = navigator.userAgent.toLowerCase();
448
+ if (ua.indexOf('wxwork') !== -1 && /[?&]code=/.test(location.search) && /[?&]state=/.test(location.search)) {
449
+ var el = document.querySelector('#root .weda-loading-container>.text');
450
+ if (el) {
451
+ el.innerHTML = '数据加载中...';
452
+ }
453
+ }
454
+ </script>
455
+ </div>
456
+ <% }%>
457
+ </div>
390
458
  <% jsApis.forEach(function(jsApi){%>
391
459
  <script src="<%=jsApi %>"></script>
392
460
  <% })%> <% if(canUseVite){ %>
@@ -475,7 +543,7 @@
475
543
  crossorigin
476
544
  src="<%=
477
545
  cdnEndpoints.cdngo
478
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.174df5037414faa855d5.bundle.js"
546
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.20c983f574139e8b0039.bundle.js"
479
547
  ></script>
480
548
  </body>
481
549
  </html>
@@ -66,13 +66,19 @@ export function createEventHandlers(
66
66
  const currentTarget = !!event?.currentTarget?.id ? getWidget(owner.widgets, event.currentTarget.id) : undefined;
67
67
  event.target = target;
68
68
  event.currentTarget = currentTarget;
69
- const [prefix = ''] = name.split('$');
69
+ const [prefix = '', trigger] = name.split('$');
70
70
  // The page event handler
71
71
  const forContext = (!!currentTarget && generateForContextOfWidget(currentTarget)) || {};
72
72
  const { lists = [], forItems = {} } = forContext;
73
73
  const dataContext = untracked(() => generateDataContext(currentTarget));
74
74
  const $w = untracked(() => generateWidgetAPIContext(owner?.__internal__?.$w, currentTarget, forContext));
75
+
76
+ const currentPageId = app.__internal__?.activePage?.id
75
77
  listeners.forEach(async (l) => {
78
+ if(currentPageId && owner.id && currentPageId !== owner.id) {
79
+ console.error(`Action error: [${trigger}:${l.key}] 页面生命周期结束,链式调用中断`);
80
+ return ;
81
+ }
76
82
  let { data = {}, boundData = {} } = l;
77
83
  data = { ...data };
78
84
  try {
@@ -89,7 +95,7 @@ export function createEventHandlers(
89
95
  } catch (e) {
90
96
  let eventName = l.key ? `${prefix}$${l.key}_fail` : '';
91
97
  if (self[eventName]) {
92
- console.error(`事件响应失败`, e);
98
+ console.error(`Action error: [${trigger}:${l.key}]`, e);
93
99
  await self[eventName]({
94
100
  ...event,
95
101
  detail: e,
@@ -147,7 +147,6 @@ export function createPage(
147
147
  },
148
148
  async onReady() {
149
149
  const $page = this._getInstance();
150
- console.log("onReady", this, $page)
151
150
 
152
151
  this._disposers.push(...runWatchers(index, this));
153
152
 
@@ -172,7 +171,6 @@ export function createPage(
172
171
 
173
172
  await this.beforePageCustomLaunch?.(this._query)
174
173
 
175
- // 权限检查
176
174
  const hook = lifecycle.onShow || lifecycle.onPageShow;
177
175
  await hook?.call?.($page);
178
176
  this.invokeEventHandler(id, 'show');
@@ -5,7 +5,7 @@
5
5
  "dependencies": {<% if(importJSSDK) {%>
6
6
  "@cloudbase/js-sdk": "2.5.6-beta.1",<% } %>
7
7
  "@cloudbase/oauth": "0.1.1-alpha.5",
8
- "@cloudbase/weda-client": "0.2.51",
8
+ "@cloudbase/weda-client": "0.2.55",
9
9
  "@cloudbase/weda-cloud-sdk": "1.0.26",
10
10
  "mobx": "^5.15.4",
11
11
  "lodash.get": "^4.4.2",