@cloudbase/lowcode-builder 1.8.73 → 1.8.75

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.
Files changed (48) hide show
  1. package/lib/builder/config/index.d.ts +2 -5
  2. package/lib/builder/config/index.js +3 -6
  3. package/lib/builder/core/index.d.ts +2 -1
  4. package/lib/builder/core/index.js +15 -24
  5. package/lib/builder/core/plugin.d.ts +1 -7
  6. package/lib/builder/core/plugin.js +0 -2
  7. package/lib/builder/mp/BuildContext.d.ts +8 -0
  8. package/lib/builder/mp/index.d.ts +2 -2
  9. package/lib/builder/mp/index.js +179 -124
  10. package/lib/builder/mp/materials.d.ts +1 -1
  11. package/lib/builder/mp/materials.js +11 -19
  12. package/lib/builder/mp/mixMode.d.ts +9 -3
  13. package/lib/builder/mp/mixMode.js +70 -137
  14. package/lib/builder/mp/mp_config.d.ts +1 -1
  15. package/lib/builder/mp/mp_config.js +28 -20
  16. package/lib/builder/mp/wxml.js +19 -2
  17. package/lib/builder/service/webpack.js +1 -1
  18. package/lib/builder/util/common.d.ts +1 -0
  19. package/lib/builder/util/common.js +8 -1
  20. package/lib/builder/util/net.d.ts +10 -1
  21. package/lib/builder/util/net.js +47 -8
  22. package/lib/builder.web.js +13 -13
  23. package/package.json +6 -5
  24. package/template/html/index.html.ejs +2 -2
  25. package/template/mp/app/weapps-api.js +19 -1
  26. package/template/mp/app.js +3 -120
  27. package/template/mp/common/info/index.js +5 -4
  28. package/template/mp/common/info/index.wxml +2 -2
  29. package/template/mp/common/privacyModal/index.js +3 -2
  30. package/template/mp/common/util.js +24 -12
  31. package/template/mp/common/weapp-page.js +24 -9
  32. package/template/mp/component/index.wxss +2 -0
  33. package/template/mp/datasources/index.js.tpl +122 -2
  34. package/template/mp/package.json +2 -2
  35. package/template/mp/packages/$wd_system/pages/login/components/input/index.js +40 -0
  36. package/template/mp/packages/$wd_system/pages/login/components/input/index.json +4 -0
  37. package/template/mp/packages/$wd_system/pages/login/components/input/index.wxml +11 -0
  38. package/template/mp/packages/$wd_system/pages/login/index.js +161 -0
  39. package/template/mp/packages/$wd_system/pages/login/index.json +16 -0
  40. package/template/mp/packages/$wd_system/pages/login/index.wxml +60 -0
  41. package/template/mp/packages/$wd_system/pages/login/index.wxss +60 -0
  42. package/template/mp/packages/$wd_system/pages/login/methods/loginByPassword.js +55 -0
  43. package/template/mp/packages/$wd_system/pages/login/methods/loginByWXPhone.js +68 -0
  44. package/template/mp/packages/$wd_system/pages/login/methods/loginSuccessCallBack.js +20 -0
  45. package/template/mp/page/api.js +5 -6
  46. package/template/mp/page/index.js +4 -1
  47. package/template/package.json +6 -5
  48. package/template/webpack/web.dev.js +21 -0
@@ -2,22 +2,19 @@ export { REPLACE_SIGN, MP_CONFIG_MODULE_NAME, KBONE_PAGE_KEYS, npmRegistry, remC
2
2
  export declare const sharedMaterialsDir: string;
3
3
  export declare const appTemplateDir: string;
4
4
  export declare const materialsDirName = "materials";
5
- /**
6
- * src/template的代码,在IDE编辑器插件中构建builder
7
- * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
8
- */
9
- export declare const builderTemplateURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.67.zip";
10
5
  /**
11
6
  * miniprogram的代码,IDE插件后续会提供端功能
12
7
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
13
8
  */
14
9
  export declare const miniprogramURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/miniprogram_npm.1.8.57.zip";
10
+ export declare const cloudbaseMiniprogramURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/cloudbase_miniprogram_npm.1.8.57.zip";
15
11
  export declare const systemSubpackageMiniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/wd_system_miniprogram_npm.zip";
16
12
  export declare const RUNTIME_CONFIG_URL = "https://comp-public-1303824488.file.myqcloud.com/release_config/runtime/exp_runtime.json";
17
13
  /**
18
14
  * miniprogram_npm存放目录。IDE插件builder用到
19
15
  */
20
16
  export declare const miniprogramDir: string;
17
+ export declare const cloudbaseMiniprogramDir: string;
21
18
  export declare const systemSubpackageMiniprogramDir: string;
22
19
  export interface ICDN_ENDPOINTS_COFIG {
23
20
  common?: string;
@@ -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.REPEATER = exports.generateCdnEndpoints = exports.CDN_ENDPONTS_CONFIG = exports.systemSubpackageMiniprogramDir = exports.miniprogramDir = exports.RUNTIME_CONFIG_URL = exports.systemSubpackageMiniprogramURL = exports.miniprogramURL = exports.builderTemplateURL = exports.materialsDirName = exports.appTemplateDir = exports.sharedMaterialsDir = exports.OFFICIAL_LIB_KEY = exports.rpxConfig = exports.remConfig = exports.npmRegistry = exports.KBONE_PAGE_KEYS = exports.MP_CONFIG_MODULE_NAME = exports.REPLACE_SIGN = void 0;
29
+ exports.REPEATER = exports.generateCdnEndpoints = exports.CDN_ENDPONTS_CONFIG = exports.systemSubpackageMiniprogramDir = exports.cloudbaseMiniprogramDir = exports.miniprogramDir = exports.RUNTIME_CONFIG_URL = exports.systemSubpackageMiniprogramURL = exports.cloudbaseMiniprogramURL = exports.miniprogramURL = exports.materialsDirName = exports.appTemplateDir = exports.sharedMaterialsDir = exports.OFFICIAL_LIB_KEY = exports.rpxConfig = exports.remConfig = exports.npmRegistry = exports.KBONE_PAGE_KEYS = exports.MP_CONFIG_MODULE_NAME = exports.REPLACE_SIGN = void 0;
30
30
  const path = __importStar(require("path"));
31
31
  const os_1 = __importDefault(require("os"));
32
32
  const index_1 = require("@cloudbase/lowcode-generator/lib/generator/config/index");
@@ -41,22 +41,19 @@ Object.defineProperty(exports, "OFFICIAL_LIB_KEY", { enumerable: true, get: func
41
41
  exports.sharedMaterialsDir = path.join(os_1.default.homedir(), '.weapps-materials');
42
42
  exports.appTemplateDir = path.resolve(__dirname, '../../../template');
43
43
  exports.materialsDirName = 'materials'; // materials diretory of current project
44
- /**
45
- * src/template的代码,在IDE编辑器插件中构建builder
46
- * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
47
- */
48
- exports.builderTemplateURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.67.zip';
49
44
  /**
50
45
  * miniprogram的代码,IDE插件后续会提供端功能
51
46
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
52
47
  */
53
48
  exports.miniprogramURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/miniprogram_npm.1.8.57.zip';
49
+ exports.cloudbaseMiniprogramURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/cloudbase_miniprogram_npm.1.8.57.zip';
54
50
  exports.systemSubpackageMiniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/wd_system_miniprogram_npm.zip';
55
51
  exports.RUNTIME_CONFIG_URL = `https://comp-public-1303824488.file.myqcloud.com/release_config/runtime/exp_runtime.json`;
56
52
  /**
57
53
  * miniprogram_npm存放目录。IDE插件builder用到
58
54
  */
59
55
  exports.miniprogramDir = path.join(os_1.default.homedir(), exports.sharedMaterialsDir, 'miniprogram_npm');
56
+ exports.cloudbaseMiniprogramDir = path.join(os_1.default.homedir(), exports.sharedMaterialsDir, 'cloudbase_miniprogram_npm');
60
57
  exports.systemSubpackageMiniprogramDir = path.join(os_1.default.homedir(), exports.sharedMaterialsDir, '$wd_system_miniprogram_npm');
61
58
  exports.CDN_ENDPONTS_CONFIG = {
62
59
  common: '',
@@ -44,6 +44,7 @@ export interface IBuildWedaApp extends IBaseAppProps {
44
44
  isPrivateMode?: boolean;
45
45
  endpointType?: 'tcb-api' | 'wechat-service';
46
46
  enableExpiredTag?: boolean;
47
+ enableAd?: boolean;
47
48
  account?: {
48
49
  uin?: string;
49
50
  };
@@ -59,7 +60,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
59
60
  endpointType?: IBuildWedaApp['endpointType'];
60
61
  buildTypeList?: IBuildWedaApp['buildTypeList'];
61
62
  }): Promise<void>;
62
- export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, account, mpConfig, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
63
+ export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, enableAd, account, mpConfig, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
63
64
  export declare function cleanComponentDir(): Promise<void>;
64
65
  export declare const version: any;
65
66
  export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
@@ -5,13 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.normalizeInputs = exports.getCompileDirs = exports.downloadZip = exports.strToBuf = exports.fileToZip = exports.getFiles = exports.version = exports.cleanComponentDir = exports.buildWedaApp = exports.buildWedaConfig = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
- const chalk_1 = __importDefault(require("chalk"));
9
8
  const path_1 = __importDefault(require("path"));
10
9
  const util_1 = require("../util");
11
10
  const common_1 = require("../types/common");
12
11
  const index_1 = require("../mp/index");
13
12
  const types_1 = require("../../types");
14
- const mixMode_1 = require("../mp/mixMode");
15
13
  const common_2 = require("../../utils/common");
16
14
  const postProcess_1 = require("../../utils/postProcess");
17
15
  const cals_1 = require("@cloudbase/cals");
@@ -27,13 +25,13 @@ async function buildWedaConfig({ output, domain = undefined, isPrivateMode = und
27
25
  if (!outDir) {
28
26
  throw new Error('无效的项目输出路径');
29
27
  }
30
- let miniprogramRoot = outDir;
28
+ let wedaRoot = outDir;
31
29
  let projectJsonPath = path_1.default.resolve(outDir, 'project.config.json');
32
30
  if (fs_extra_1.default.existsSync(projectJsonPath)) {
33
31
  const projectConfigJson = await fs_extra_1.default.readJson(projectJsonPath);
34
- miniprogramRoot = path_1.default.join(outDir, projectConfigJson.miniprogramRoot || '/');
32
+ wedaRoot = path_1.default.join(outDir, projectConfigJson.miniprogramRoot || '/', (0, util_1.normalizeWedaRoot)(projectConfigJson.wedaRoot) || '');
35
33
  }
36
- const configPath = path_1.default.resolve(miniprogramRoot, 'common/config.js');
34
+ const configPath = path_1.default.resolve(wedaRoot, 'common/config.js');
37
35
  let data = { domain, isPrivateMode, endpointType };
38
36
  if (fs_extra_1.default.existsSync(configPath)) {
39
37
  try {
@@ -61,7 +59,7 @@ exports.buildWedaConfig = buildWedaConfig;
61
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 = {
62
60
  isComposite: false,
63
61
  compProps: {},
64
- }, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, account = {}, mpConfig = {}, }, cb) {
62
+ }, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, }, cb) {
65
63
  var _a, _b, _c, _d, _e, _f;
66
64
  if (!cals) {
67
65
  console.error('无效的应用配置');
@@ -74,10 +72,19 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
74
72
  * 刷新正规化 packageName
75
73
  */
76
74
  [cals, ...subAppCalsList].forEach((app) => {
75
+ var _a, _b;
77
76
  if (!app.extra) {
78
77
  app.extra = {};
79
78
  }
80
79
  app.extra.rootPath = (0, util_1.normalizePackageName)(app.extra.rootPath);
80
+ /**
81
+ * 历史登录页清理
82
+ * 使用默认的登录
83
+ */
84
+ app.items = (_b = (_a = app.items) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.call(_a, (item) => {
85
+ var _a;
86
+ return !((_a = item.attributes) === null || _a === void 0 ? void 0 : _a.isCustomLoginPage);
87
+ });
81
88
  });
82
89
  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);
83
90
  let runtimeDynamicConfig = {};
@@ -100,6 +107,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
100
107
  isPrivateMode,
101
108
  endpointType,
102
109
  enableExpiredTag,
110
+ enableAd,
103
111
  runtimeDynamicConfig,
104
112
  disabled: (_c = cals.extra) === null || _c === void 0 ? void 0 : _c.disabled,
105
113
  statusPageId: (_d = cals.extra) === null || _d === void 0 ? void 0 : _d.statusPageId,
@@ -148,7 +156,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
148
156
  const calses = [cals, ...subAppCalsList];
149
157
  if (isBrowserMpBuilder) {
150
158
  // 尽早下载物料
151
- await (0, net_1.downloadBrowserMaterial)(output === null || output === void 0 ? void 0 : output.path);
159
+ await (0, net_1.downloadBrowserMaterial)({ runtimeEndpointType: endpointType });
152
160
  }
153
161
  const { enablePageRoot } = (0, cals_1.parseVersion)(cals === null || cals === void 0 ? void 0 : cals.schemaVersion, dependencies);
154
162
  const mpBuildContext = {
@@ -182,18 +190,6 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
182
190
  cdnEndpoints: (0, config_1.generateCdnEndpoints)(cdnEndpoints),
183
191
  mpConfig,
184
192
  });
185
- // 如果是混合模式,则将特定的目录复制到工程下
186
- // 针对 app.json / package.json 则采用 merge 的操作
187
- if (buildContext.isMixMode) {
188
- console.log(chalk_1.default.green('【混合模式】'), mpBuildContext.projDir);
189
- await (0, mixMode_1.handleMixMode)({
190
- buildContext: mpBuildContext,
191
- apps,
192
- miniprogramRoot: result.miniprogramRoot,
193
- plugins,
194
- ignoreInstall,
195
- });
196
- }
197
193
  const outDir = mpBuildContext.projDir;
198
194
  let projectJsonPath = path_1.default.resolve(outDir, 'project.config.json');
199
195
  await (0, postProcess_1.postprocessProjectConfig)(projectJsonPath, {
@@ -202,11 +198,6 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
202
198
  });
203
199
  // 如果是代开发的模式,则写入ext.json
204
200
  await (0, postProcess_1.postprocessDeployExtraJson)(outDir, deployOptions);
205
- if (!isBrowserMpBuilder && generateMpType === common_1.GenerateMpType.APP && !ignoreInstall) {
206
- // 模板拷入的 miniprogram_npm 有问题,直接删除使用重新构建的版本
207
- // 模板需要占位保证 mp 文件夹存在
208
- fs_extra_1.default.removeSync(path_1.default.resolve(outDir, 'miniprogram_npm'));
209
- }
210
201
  await (cb === null || cb === void 0 ? void 0 : cb(null, {
211
202
  ...result,
212
203
  outDir,
@@ -1,7 +1 @@
1
- import { IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
2
- /**
3
- * 安装小程序插件
4
- * @param appBuildDir
5
- * @param plugins
6
- */
7
- export declare function runHandleMpPlugin(appBuildDir: string, plugins: IPlugin[]): Promise<void>;
1
+ export {};
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runHandleMpPlugin = void 0;
4
3
  const plugin_1 = require("../mp/plugin");
5
4
  /**
6
5
  * 安装小程序插件
@@ -12,4 +11,3 @@ async function runHandleMpPlugin(appBuildDir, plugins) {
12
11
  await (0, plugin_1.installMpPlugin)(appBuildDir, plugins);
13
12
  console.timeEnd('runHandleMpPlugin');
14
13
  }
15
- exports.runHandleMpPlugin = runHandleMpPlugin;
@@ -42,6 +42,10 @@ export interface ICommonBuildContext {
42
42
  * 是否启用过期
43
43
  */
44
44
  enableExpiredTag?: boolean;
45
+ /**
46
+ * 显示微信云模板toast
47
+ */
48
+ enableAd?: boolean;
45
49
  /**
46
50
  * 应用运行态动态全局配置
47
51
  */
@@ -65,4 +69,8 @@ export interface IBuildContext extends ICommonBuildContext {
65
69
  * 组件库目录独立子包
66
70
  */
67
71
  enableAsyncMaterials?: boolean;
72
+ /**
73
+ * weda 默认自身root
74
+ */
75
+ wedaRoot?: string;
68
76
  }
@@ -4,8 +4,8 @@ import { IBuildContext } from './BuildContext';
4
4
  import { BuildType } from '../types/common';
5
5
  import { IPlatformApp } from '@cloudbase/cals';
6
6
  import { IBuildWedaApp } from '../core';
7
- export declare function generateWxMp({ buildContext, weapps, calses, plugins, deployOptions, options, buildTypeList, ignoreInstall, cdnEndpoints, mpConfig, }: {
8
- buildContext: IBuildContext;
7
+ export declare function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, options, buildTypeList, ignoreInstall, cdnEndpoints, mpConfig, }: {
8
+ buildContext: Omit<IBuildContext, 'wedaRoot'>;
9
9
  weapps: IWeAppData[];
10
10
  calses: IPlatformApp[];
11
11
  plugins: IPlugin[];