@cloudbase/lowcode-builder 1.8.45 → 1.8.48

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,7 +6,7 @@ export declare const materialsDirName = "materials";
6
6
  * src/template的代码,在IDE编辑器插件中构建builder
7
7
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
8
8
  */
9
- export declare const builderTemplateURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.45.zip";
9
+ export declare const builderTemplateURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.47.zip";
10
10
  /**
11
11
  * miniprogram的代码,IDE插件后续会提供端功能
12
12
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
@@ -45,7 +45,7 @@ exports.materialsDirName = 'materials'; // materials diretory of current project
45
45
  * src/template的代码,在IDE编辑器插件中构建builder
46
46
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
47
47
  */
48
- exports.builderTemplateURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.45.zip';
48
+ exports.builderTemplateURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.47.zip';
49
49
  /**
50
50
  * miniprogram的代码,IDE插件后续会提供端功能
51
51
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
@@ -61,7 +61,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
61
61
  isComposite: false,
62
62
  compProps: {},
63
63
  }, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, }, cb) {
64
- var _a, _b, _c;
64
+ var _a, _b, _c, _d, _e;
65
65
  if (!cals) {
66
66
  console.error('无效的应用配置');
67
67
  return;
@@ -69,6 +69,15 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
69
69
  if (!deployOptions.mode) {
70
70
  deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
71
71
  }
72
+ /**
73
+ * 刷新正规化 packageName
74
+ */
75
+ [cals, ...subAppCalsList].forEach((app) => {
76
+ if (!app.extra) {
77
+ app.extra = {};
78
+ }
79
+ app.extra.rootPath = (0, util_1.normalizePackageName)(app.extra.rootPath);
80
+ });
72
81
  let appBuildDir = (output === null || output === void 0 ? void 0 : output.path) || (runtime === types_1.RUNTIME.CI ? (_a = (0, util_1.getCompileDirs)('app')) === null || _a === void 0 ? void 0 : _a.appBuildDir : (_b = (0, util_1.getCompileDirs)(appKey)) === null || _b === void 0 ? void 0 : _b.appBuildDir);
73
82
  const buildContext = {
74
83
  projDir: appBuildDir,
@@ -82,6 +91,8 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
82
91
  isPrivateMode,
83
92
  endpointType,
84
93
  enableExpiredTag,
94
+ disabled: (_c = cals.extra) === null || _c === void 0 ? void 0 : _c.disabled,
95
+ statusPageId: (_d = cals.extra) === null || _d === void 0 ? void 0 : _d.statusPageId,
85
96
  };
86
97
  console.log('domain', domain);
87
98
  console.log('应用名', appKey);
@@ -141,7 +152,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
141
152
  ? 'px'
142
153
  : 'rpx'),
143
154
  enablePageRoot,
144
- enableLoading: (_c = cals === null || cals === void 0 ? void 0 : cals.extra) === null || _c === void 0 ? void 0 : _c.enableLoading,
155
+ enableLoading: (_e = cals === null || cals === void 0 ? void 0 : cals.extra) === null || _e === void 0 ? void 0 : _e.enableLoading,
145
156
  };
146
157
  const result = await (0, index_1.generateWxMp)({
147
158
  weapps: apps,
@@ -45,7 +45,11 @@ const config_1 = require("../config");
45
45
  const fs_extra_1 = __importDefault(require("fs-extra"));
46
46
  const junk = __importStar(require("../util/junk"));
47
47
  const url_1 = require("url");
48
- const transform_1 = require("../../utils/transform");
48
+ let BabelTransform = (code, options) => code;
49
+ if (!process.env.IS_WEB_WORKER) {
50
+ let transform = require('../../utils/transform');
51
+ BabelTransform = transform.BabelTransform;
52
+ }
49
53
  async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, buildTypeList = [common_1.BuildType.WEB], subAppCalsList, mode, devTool, runtime = types_1.RUNTIME.NONE, deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, ignoreInstall = false, cdnEndpoints, }) {
50
54
  var _a, _b, _c;
51
55
  const { projDir: buildDir, domain, materialLibs: dependencies, appId: appKey, isPrivateMode, enableExpiredTag, } = buildContext;
@@ -88,8 +92,6 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
88
92
  assets,
89
93
  });
90
94
  await (0, copy_1.runCopy)(h5BuildDir, mainAppData, i18nConfig);
91
- // 构建 APP 需要的配置文件
92
- const appConfig = await (0, webpack_2.generateAppConfig)(mainAppData, subAppDataList, h5BuildDir);
93
95
  // // 素材库
94
96
  const runHandleMaterialTag = '🚥 buildWebApp-runHandleMaterial';
95
97
  console.time(runHandleMaterialTag);
@@ -144,7 +146,6 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
144
146
  appBuildDir: h5BuildDir,
145
147
  assets: jsAssets,
146
148
  buildTypeList,
147
- mpConfig: appConfig,
148
149
  mode,
149
150
  devTool,
150
151
  publicPath,
@@ -246,7 +247,7 @@ function _BabelTransformCalsExpression(key, value) {
246
247
  value = value.replace(FOR_IN_REG, '');
247
248
  }
248
249
  }
249
- value = (0, transform_1.BabelTransform)(value, { IIFE: true });
250
+ value = BabelTransform(value, { IIFE: true });
250
251
  if (forPrefix) {
251
252
  value = `${forPrefix}${value}`;
252
253
  }
@@ -5,11 +5,10 @@ import { ICDN_ENDPOINTS_COFIG } from '../config';
5
5
  interface IWebpackCoreProps extends BuildAppProps {
6
6
  cals: IPlatformApp;
7
7
  appBuildDir: string;
8
- mpConfig: any;
9
8
  mainAppData: IWebRuntimeAppData;
10
9
  subAppDataList: IWebRuntimeAppData[];
11
10
  assets: string[];
12
11
  cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
13
12
  }
14
- export declare function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode, appKey, buildTypeList, mpConfig, assets, devTool, generateMpType, cdnEndpoints, }: IWebpackCoreProps): Promise<string>;
13
+ export declare function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode, appKey, buildTypeList, assets, devTool, generateMpType, cdnEndpoints, }: IWebpackCoreProps): Promise<string>;
15
14
  export {};
@@ -5,7 +5,7 @@ const common_1 = require("../types/common");
5
5
  const webpack_1 = require("../service/webpack");
6
6
  const generate_1 = require("./generate");
7
7
  const cals_1 = require("@cloudbase/cals");
8
- async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode = common_1.WebpackModeType.NONE, appKey, buildTypeList = [common_1.BuildType.WEB], mpConfig, assets = [], devTool = 'vite', generateMpType = common_1.GenerateMpType.APP, cdnEndpoints, }) {
8
+ async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode = common_1.WebpackModeType.NONE, appKey, buildTypeList = [common_1.BuildType.WEB], assets = [], devTool = 'vite', generateMpType = common_1.GenerateMpType.APP, cdnEndpoints, }) {
9
9
  var _a;
10
10
  console.time('runWebpackCore');
11
11
  console.time('webpackGenerate');
@@ -20,13 +20,6 @@ async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir,
20
20
  assets,
21
21
  });
22
22
  console.timeEnd('webpackGenerate');
23
- // compile
24
- console.time('generateMpJsonConfigFile');
25
- await (0, webpack_1.generateMpJsonConfigFile)(allAppDataList, mpConfig, appBuildDir, {
26
- appKey,
27
- generateMpType,
28
- });
29
- console.timeEnd('generateMpJsonConfigFile');
30
23
  await (0, generate_1.generateHTML)({
31
24
  appId: mainAppData.id || appKey,
32
25
  envId: mainAppData.envId || '',
@@ -43,4 +43,12 @@ export interface IBuildContext {
43
43
  * 是否启用过期
44
44
  */
45
45
  enableExpiredTag?: boolean;
46
+ /**
47
+ * 是否禁用应用
48
+ */
49
+ disabled?: boolean;
50
+ /**
51
+ * 自定义状态页Id
52
+ */
53
+ statusPageId?: string;
46
54
  }
@@ -137,8 +137,12 @@ async function generateWxMp({ buildContext, weapps, calses, plugins, deployOptio
137
137
  'common/query.js': {},
138
138
  'common/flow.js': {},
139
139
  'common/info': {},
140
- 'common/privacyModal': {},
141
- 'common/modal': {},
140
+ /**
141
+ * 使用微信的 modal
142
+ * 暂时保留内部实现待之后使用
143
+ */
144
+ // 'common/privacyModal': {},
145
+ // 'common/modal': {},
142
146
  /**
143
147
  * 调试用
144
148
  */
@@ -218,7 +222,7 @@ async function generateWxMp({ buildContext, weapps, calses, plugins, deployOptio
218
222
  return;
219
223
  }
220
224
  else {
221
- const subpackageRootPath = path_1.default.join(miniprogramRoot, app.rootPath || '/');
225
+ const subpackageRootPath = path_1.default.join(miniprogramRoot, 'packages', app.rootPath || '/');
222
226
  let subpackageBuildCtx = {
223
227
  ...buildContext,
224
228
  rootPath: app.rootPath,
@@ -341,12 +345,13 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
341
345
  },
342
346
  ],
343
347
  });
344
- const wxml = (0, wxml_1.generateWxml)({ ...ctx, rootPath, isPage: true }, componentInstances, `Page ${rootPath ? path_1.default.join(rootPath, 'pages') : ''}/${page.id}`, wxmlDataPrefix, usingComponents, componentGenerics);
348
+ const wxml = (0, wxml_1.generateWxml)({ ...ctx, rootPath, pageUUID: rootPath ? `${rootPath}/${page.id}` : page.id }, componentInstances, `Page ${rootPath ? path_1.default.join('packages', rootPath, 'pages') : ''}/${page.id}`, wxmlDataPrefix, usingComponents, componentGenerics);
345
349
  const importor = (0, util_3.generateLowcodeImportor)(page.lowCodes);
346
350
  const pageFileName = (0, lodash_1.get)(pageConfigs, `${page.id}.pageFileName`, 'index');
351
+ const subLevelPath = rootPath ? `${path_1.default.posix.relative(`packages/${rootPath}`, '')}/` : '';
347
352
  const pageFileData = {
348
353
  [`api.js|api.js`]: {
349
- subLevelPath: rootPath ? `${path_1.default.posix.relative(rootPath, '')}/` : '',
354
+ subLevelPath,
350
355
  uuid: rootPath ? `${rootPath}/${page.id}` : page.id,
351
356
  label: ((_b = (_a = page === null || page === void 0 ? void 0 : page.data) === null || _a === void 0 ? void 0 : _a.navigationBarTitleText) === null || _b === void 0 ? void 0 : _b.value) || ((_d = (_c = page === null || page === void 0 ? void 0 : page.data) === null || _c === void 0 ? void 0 : _c.title) === null || _d === void 0 ? void 0 : _d.value),
352
357
  },
@@ -365,7 +370,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
365
370
  },
366
371
  debug: ctx.debugMode,
367
372
  stringifyObj: util_1.inspect,
368
- subLevelPath: rootPath ? `${path_1.default.posix.relative(rootPath, '')}/` : '',
373
+ subLevelPath,
369
374
  importor,
370
375
  query: (0, util_2.createTemplateQuery)(ctx, (_f = page.dataset) === null || _f === void 0 ? void 0 : _f.query),
371
376
  eventFlows: (0, util_2.createTemplateEventFlows)(ctx, page.eventFlows),
@@ -385,7 +390,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
385
390
  },
386
391
  [`index.wxss|${pageFileName}.wxss`]: {
387
392
  subWxss: rootPath && !((_l = ctx.mainAppData) === null || _l === void 0 ? void 0 : _l.mpPkgUrl)
388
- ? `@import "${path_1.default.posix.relative(`/${rootPath}/pages/${page.id}`, '/lowcode')}/style.wxss";`
393
+ ? `@import "${path_1.default.posix.relative(`/packages/${rootPath}/pages/${page.id}`, '/lowcode')}/style.wxss";`
389
394
  : '',
390
395
  content: (0, weapps_core_1.toCssText)((0, cals_1.processCommonStyle2CSSProperties)(page.commonStyle, {
391
396
  defaultUnit: processCssUnit,
@@ -440,7 +445,7 @@ async function generateFramework(ctx, appData, outDir, options) {
440
445
  ...fileData,
441
446
  'app/app-global.js': {},
442
447
  'app/weapps-api.js': {
443
- subLevelPath: appData.rootPath ? `${path_1.default.posix.relative(`${appData.rootPath}`, '')}/` : '',
448
+ subLevelPath: appData.rootPath ? `${path_1.default.posix.relative(`packages/${appData.rootPath}`, '')}/` : '',
444
449
  subPackageName: appData.rootPath || '',
445
450
  importor,
446
451
  appConfig: (0, util_3.JsonToStringWithVariableName)({
@@ -451,10 +456,17 @@ async function generateFramework(ctx, appData, outDir, options) {
451
456
  envVersion: (ctx === null || ctx === void 0 ? void 0 : ctx.isProduction) ? 'production' : 'preview',
452
457
  pages: appData.pageInstanceList
453
458
  .sort((item) => (item.isHome ? -1 : 1))
454
- .map((item) => ({
455
- id: item.id,
456
- type: item.data.isCustomLoginPage ? 'login' : '',
457
- })),
459
+ .map((item) => {
460
+ var _a;
461
+ return ({
462
+ id: item.id,
463
+ type: item.data.isCustomLoginPage
464
+ ? 'login'
465
+ : ((_a = appData.extra) === null || _a === void 0 ? void 0 : _a.statusPageId) === item.id
466
+ ? 'status'
467
+ : '',
468
+ });
469
+ }),
458
470
  }),
459
471
  appQuery: (0, util_2.createTemplateQuery)(ctx, (_b = appData.dataset) === null || _b === void 0 ? void 0 : _b.query),
460
472
  stringifyObj: util_1.inspect,
@@ -495,8 +507,9 @@ async function writeLowCodeFiles(ctx, appData, outDir) {
495
507
  }
496
508
  exports.writeLowCodeFiles = writeLowCodeFiles;
497
509
  // {a: 1} -> , "a": 1
498
- function getAppendableJson(json) {
499
- const obj = { ...json };
510
+ function getAppendableJson(json = {}) {
511
+ const { namespace, appShareMessage, ...restJson } = json;
512
+ const obj = { ...restJson };
500
513
  if (obj.reachBottomDistance) {
501
514
  obj.onReachBottomDistance = parseInt(obj.reachBottomDistance, 10) || 0;
502
515
  delete obj.reachBottomDistance;
@@ -555,7 +568,9 @@ async function cleanPkg(pkg, miniprogramRoot) {
555
568
  if (pkg.mpPkgUrl) {
556
569
  return;
557
570
  }
558
- const pkgDir = [miniprogramRoot, pkg.rootPath].filter((p) => !!p).join(path_1.default.sep);
571
+ const pkgDir = [miniprogramRoot, pkg.rootPath ? `packages${path_1.default.sep}${pkg.rootPath}` : '']
572
+ .filter((p) => !!p)
573
+ .join(path_1.default.sep);
559
574
  const pagesDir = path_1.default.join(pkgDir, 'pages');
560
575
  const lowcodesDir = path_1.default.join(pkgDir, 'lowcode');
561
576
  const existedPages = await fs.readdir(pagesDir);
@@ -18,7 +18,7 @@ async function writeCode2file(ctx, mod, lowcodeRootDir, opts = {}, themeCode) {
18
18
  // Generate app lowcode
19
19
  const baseDir = path_1.default.relative(path_1.default.dirname(file), appDir).replace(/\\/g, '/');
20
20
  // 子包混合模式需要添加相对索引到根目录
21
- const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? `${path_1.default.relative(ctx.rootPath, '')}/` : '';
21
+ const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? `${path_1.default.relative(`packages/${ctx.rootPath}`, '')}/` : '';
22
22
  let weappsApiPrefix = [
23
23
  `import { app, $app${pageId !== 'global' ? '' : ', $w'} } from '${relativeRoot}${baseDir}/app/weapps-api';`,
24
24
  ]; // windows compatibility
@@ -246,7 +246,8 @@ async function generateCompositeComponent(ctx, compositedComp, compLibCommonReso
246
246
  enableLoading: false,
247
247
  };
248
248
  const { materialName } = compositedComp;
249
- const outDir = path.join(compositeCtx.projDir, compositeCtx.rootPath || '', // 混合模式下,可能会有 rootPath
249
+ const outDir = path.join(compositeCtx.projDir,
250
+ // compositeCtx.rootPath || '', // 所有组件统一生成到根目录
250
251
  config_1.materialsDirName, materialName, compositedComp.name);
251
252
  const LOWCODE_DIR_NAME = 'lowcode';
252
253
  console.log(`Generating composited component ${materialName}:${compositedComp.name} to ${outDir}`);
@@ -96,7 +96,7 @@ async function handleMixMode({ buildContext, apps = [], miniprogramRoot, plugins
96
96
  await Promise.all(apps
97
97
  .filter((app) => app.rootPath)
98
98
  .map(async (app) => {
99
- const subAppPath = path_1.default.join(miniprogramRoot, app.rootPath || '');
99
+ const subAppPath = path_1.default.join(miniprogramRoot, ...(app.rootPath ? ['packages', app.rootPath] : ['']));
100
100
  // 复制整个子包
101
101
  // 新模式下已经生成,感觉无需进行复制 @royhyang
102
102
  // const distDir = path.join(generateMpPath, app.rootPath || '')
@@ -106,7 +106,7 @@ async function handleMixMode({ buildContext, apps = [], miniprogramRoot, plugins
106
106
  let appJson = await fs_extra_1.default.readJson(appJsonPath);
107
107
  if (appJson) {
108
108
  let { subpackages = [] } = rootAppJosn;
109
- const find = subpackages.find((item) => item.root == app.rootPath);
109
+ const find = subpackages.find((item) => item.root === `packages/${app.rootPath}`);
110
110
  if (find) {
111
111
  find.pages = appJson.pages;
112
112
  }
@@ -115,7 +115,7 @@ async function handleMixMode({ buildContext, apps = [], miniprogramRoot, plugins
115
115
  rootAppJosn.subpackages = [];
116
116
  }
117
117
  rootAppJosn.subpackages.push({
118
- root: app.rootPath,
118
+ root: `packages/${app.rootPath}`,
119
119
  pages: appJson.pages,
120
120
  });
121
121
  }
@@ -121,6 +121,9 @@ function generateMpConfig(ctx, weapps, options) {
121
121
  projConfig.setting = {};
122
122
  }
123
123
  projConfig.setting.bigPackageSizeSupport = true;
124
+ if (process.env.IS_WEB_WORKER) {
125
+ projConfig.setting.ignoreUploadUnusedFiles = true;
126
+ }
124
127
  if (options.mpAppId) {
125
128
  projConfig.appId = options.mpAppId;
126
129
  }
@@ -132,10 +135,9 @@ function extractPages(weapps, pageConfigs) {
132
135
  const pages = [];
133
136
  const subpackages = [];
134
137
  let homePage = '';
135
- let homePageId = '';
136
138
  weapps.forEach((weapp, index) => {
137
139
  const { rootPath } = weapp;
138
- const subPackage = { root: rootPath, pages: [] };
140
+ const subPackage = { root: rootPath ? `packages/${rootPath}` : '', pages: [] };
139
141
  if (rootPath) {
140
142
  subpackages.push(subPackage);
141
143
  }
@@ -150,14 +152,13 @@ function extractPages(weapps, pageConfigs) {
150
152
  }
151
153
  else {
152
154
  homePage = `pages/${page.id}/${pageFileName}`;
153
- homePageId = page.id;
154
155
  }
155
156
  });
156
157
  });
157
158
  if (homePage) {
158
159
  pages.unshift(homePage);
159
160
  }
160
- return { pages, subpackages, homePageId };
161
+ return { pages, subpackages };
161
162
  }
162
163
  function getAppPagesConfig(pages) {
163
164
  const pagesConfig = {};
@@ -1,7 +1,7 @@
1
1
  import { IWeAppComponentInstance, IEventModifiers } from '@cloudbase/lowcode-generator/lib/weapps-core';
2
2
  import { IBuildContext } from './BuildContext';
3
3
  export declare function generateWxml(ctx: IBuildContext & {
4
- isPage: boolean;
4
+ pageUUID?: string;
5
5
  }, widgets: {
6
6
  [key: string]: IWeAppComponentInstance;
7
7
  }, docTag: string, wxmlDataPrefix: any, usingComponents: any, componentGenerics: any, nodeTransform?: (cmp: IWeAppComponentInstance, node: any) => void): string;
@@ -19,91 +19,113 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
19
19
  const xmlJson = {
20
20
  elements: createXml(widgets),
21
21
  };
22
- if (ctx.isPage) {
23
- const { enablePageRoot } = ctx;
22
+ if (ctx.pageUUID) {
23
+ const { enablePageRoot, disabled } = ctx;
24
24
  const originElements = xmlJson.elements;
25
- usingComponents['wd-privacy'] = '/common/privacyModal/index';
25
+ // usingComponents['wd-privacy'] = '/common/privacyModal/index';
26
26
  usingComponents['wd-info'] = '/common/info/index';
27
- // 登录校验: 向其最外层包裹一层block
28
- xmlJson.elements = [
29
- {
30
- type: 'element',
31
- name: 'wd-privacy',
32
- attributes: {},
33
- elements: [],
34
- _order: -Infinity,
35
- _parent: null,
36
- },
37
- {
38
- type: 'element',
39
- name: enablePageRoot ? 'view' : 'block',
40
- attributes: {
41
- id: 'wd-page-root',
42
- ['wx:if']: '{{weDaHasLogin && !_expiredMessage}}',
43
- ['data-weui-theme']: 'light',
44
- },
45
- elements: [
46
- ...originElements,
47
- /**
48
- * 可能需要依赖添加逻辑节点的方式
49
- * 来触发 page 的 ready
50
- * 目的是为了让 page 的 ready 在组件的 ready 之后
51
- */
52
- // {
53
- // type: 'element',
54
- // name: 'readyPlaceHoler',
55
- // attributes: {
56
- // ['bind:ready']: '_onReady',
57
- // },
58
- // elements: originElements,
59
- // _order: Infinity,
60
- // _parent: null,
61
- // },
62
- ],
63
- _order: -1,
64
- _parent: null,
65
- },
66
- {
67
- type: 'element',
68
- name: 'wd-info',
69
- attributes: {
70
- ['wx:if']: '{{weDaHasLogin === false && !_expiredMessage}}',
71
- message: '无权限访问',
72
- type: 'auth',
73
- },
74
- elements: [],
75
- _order: Infinity,
76
- _parent: null,
77
- },
78
- ];
79
- if (ctx.enableExpiredTag) {
80
- usingComponents['wd-info'] = '/common/info/index';
81
- xmlJson.elements.push({
82
- type: 'element',
83
- name: 'wd-info',
84
- attributes: {
85
- ['wx:if']: '{{_expiredMessage}}',
86
- message: '{{_expiredMessage}}',
87
- type: 'info',
27
+ if (disabled && ctx.pageUUID !== ctx.statusPageId) {
28
+ xmlJson.elements = [
29
+ {
30
+ type: 'element',
31
+ name: 'wd-info',
32
+ attributes: {
33
+ message: '当前页面无法访问',
34
+ type: 'notfound',
35
+ enableCustom: true,
36
+ pageUUID: ctx.pageUUID,
37
+ },
38
+ elements: [],
39
+ _order: Infinity,
40
+ _parent: null,
88
41
  },
89
- elements: [],
90
- _order: Infinity,
91
- _parent: null,
92
- });
42
+ ];
93
43
  }
94
- if (ctx.enableLoading) {
95
- usingComponents['wd-info'] = '/common/info/index';
96
- xmlJson.elements.push({
97
- type: 'element',
98
- name: 'wd-info',
99
- attributes: {
100
- ['wx:if']: '{{_isCheckingAtuh && !_expiredMessage}}',
101
- type: 'loading',
44
+ else {
45
+ // 登录校验: 向其最外层包裹一层block
46
+ xmlJson.elements = [
47
+ // {
48
+ // type: 'element',
49
+ // name: 'wd-privacy',
50
+ // attributes: {},
51
+ // elements: [],
52
+ // _order: -Infinity,
53
+ // _parent: null,
54
+ // },
55
+ {
56
+ type: 'element',
57
+ name: enablePageRoot ? 'view' : 'block',
58
+ attributes: {
59
+ id: 'wd-page-root',
60
+ ['wx:if']: '{{weDaHasLogin && !_expiredMessage}}',
61
+ ['data-weui-theme']: 'light',
62
+ },
63
+ elements: [
64
+ ...originElements,
65
+ /**
66
+ * 可能需要依赖添加逻辑节点的方式
67
+ * 来触发 page 的 ready
68
+ * 目的是为了让 page 的 ready 在组件的 ready 之后
69
+ */
70
+ // {
71
+ // type: 'element',
72
+ // name: 'readyPlaceHoler',
73
+ // attributes: {
74
+ // ['bind:ready']: '_onReady',
75
+ // },
76
+ // elements: originElements,
77
+ // _order: Infinity,
78
+ // _parent: null,
79
+ // },
80
+ ],
81
+ _order: -1,
82
+ _parent: null,
102
83
  },
103
- elements: [],
104
- _order: Infinity,
105
- _parent: null,
106
- });
84
+ {
85
+ type: 'element',
86
+ name: 'wd-info',
87
+ attributes: {
88
+ ['wx:if']: '{{weDaHasLogin === false && !_expiredMessage}}',
89
+ message: '无权限访问',
90
+ type: 'auth',
91
+ enableCustom: true,
92
+ pageUUID: ctx.pageUUID,
93
+ error: '{{loginError}}',
94
+ },
95
+ elements: [],
96
+ _order: Infinity,
97
+ _parent: null,
98
+ },
99
+ ];
100
+ if (ctx.enableExpiredTag) {
101
+ usingComponents['wd-info'] = '/common/info/index';
102
+ xmlJson.elements.push({
103
+ type: 'element',
104
+ name: 'wd-info',
105
+ attributes: {
106
+ ['wx:if']: '{{_expiredMessage}}',
107
+ message: '{{_expiredMessage}}',
108
+ type: 'info',
109
+ },
110
+ elements: [],
111
+ _order: Infinity,
112
+ _parent: null,
113
+ });
114
+ }
115
+ if (ctx.enableLoading) {
116
+ usingComponents['wd-info'] = '/common/info/index';
117
+ xmlJson.elements.push({
118
+ type: 'element',
119
+ name: 'wd-info',
120
+ attributes: {
121
+ ['wx:if']: '{{_isCheckingAtuh && !_expiredMessage}}',
122
+ type: 'loading',
123
+ },
124
+ elements: [],
125
+ _order: Infinity,
126
+ _parent: null,
127
+ });
128
+ }
107
129
  }
108
130
  }
109
131
  function createXml(widgets, parent = null, parentForNodes = []) {
@@ -44,19 +44,12 @@ export interface IGenerateMpJsonConfigFileOpts {
44
44
  appKey?: string;
45
45
  generateMpType?: 'app' | 'subpackage';
46
46
  }
47
- export declare function generateAppConfig(mainAppData: IWebRuntimeAppData, subAppDataList: IWebRuntimeAppData[], appBuildDir: string): Promise<{}>;
48
47
  export declare function generateKboneTabBarConfig(mpConfig: Record<string, any>, appBuildDir: any): Promise<void>;
49
48
  export declare function downloadAndWriteTabBarIcon(iconPath: any, pagePath: any, appBuildDir: string, fileName: string): Promise<unknown>;
50
- export declare function generateKbonePageConfig(mpConfig: Record<string, any>, mainAppData: IWebRuntimeAppData, subAppDataList?: IWebRuntimeAppData[]): Record<string, any>;
51
- export declare function generateKboneAppConfig(mpConfig: Record<string, any>, mainAppData: IWebRuntimeAppData): void;
52
- export declare function generateMpJsonConfigFile(allAppDataList: IWebRuntimeAppData[], userConfig: any, appBuildDir: string, options: IGenerateMpJsonConfigFileOpts): Promise<void>;
53
49
  export declare function getMainAppDataByList(allAppDataList: IWebRuntimeAppData[]): IWebRuntimeAppData | undefined;
54
50
  export declare function getHomePageInstance(pageInstanceList: any): any;
55
51
  export declare function getPageName(name: string): string;
56
- export declare function getMpAllRouterConfig(allAppDataList: IWebRuntimeAppData[], getHome?: boolean): any;
57
52
  export declare function getWebpackWebBuildParams(appId: string, appBuildDir: string, publicPath?: string, mode?: WebpackModeType, buildTypeList?: BuildType[], extraDefine?: {}, assets?: string[]): any;
58
- export declare function getWebpackMpBuildParams(appBuildDir: string, materialsDir: string, dependencies: IMaterialItem[] | undefined, nodeModulesPath: string, allAppDataList: IWebRuntimeAppData[], mode: string, watch: boolean, options: IGenerateMpJsonConfigFileOpts): any;
59
- export declare function getAllPageMpEntryPath(allAppDataList: IWebRuntimeAppData[], appBuildDir: string): Record<string, any>;
60
53
  export declare function downloadAndInstallDependencies(dependencies: IMaterialItem[] | undefined, materialsDir: string, installOptions?: IInstallOpts): Promise<void>;
61
54
  export declare function downloadDependencies(targetDir: string, srcZipUrl: string): Promise<void>;
62
55
  /**