@cloudbase/lowcode-builder 1.10.8 → 1.10.10

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateSystemPackageDependencies = exports.generateLibDependencies = exports.generatePackageDependencies = void 0;
4
4
  const cals_1 = require("@cloudbase/cals");
5
- const CLOUDBASE_VERSION = '2.9.2';
5
+ const CLOUDBASE_VERSION = '2.10.0';
6
6
  const BASE_DEPS = {
7
7
  'miniprogram-gesture': '^1.0.6',
8
8
  mobx: '^5',
@@ -13,7 +13,7 @@ const BASE_DEPS = {
13
13
  * 注意锁版本
14
14
  */
15
15
  const CLOUDBASE_DEPS = {
16
- '@cloudbase/weda-client': '1.1.26',
16
+ '@cloudbase/weda-client': '1.1.27',
17
17
  '@cloudbase/weda-cloud-sdk': '1.0.96',
18
18
  };
19
19
  const COMPONENT_DEPS = {
@@ -35,6 +35,9 @@ export interface IBuildWedaApp extends IBaseAppProps {
35
35
  targetMpAppId?: string;
36
36
  version?: string;
37
37
  };
38
+ runtimeOptions?: {
39
+ mode?: DEPLOY_MODE;
40
+ };
38
41
  runtime?: RUNTIME;
39
42
  ignoreInstall?: boolean;
40
43
  resourceAppId?: string;
@@ -64,7 +67,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
64
67
  endpointType?: IBuildWedaApp['endpointType'];
65
68
  buildTypeList?: IBuildWedaApp['buildTypeList'];
66
69
  }): Promise<void>;
67
- export declare function buildWedaApp({ cals, subAppCalsList: _subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints: _cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, enableAd, account, mpConfig, privatelinkConfig, __defaultLoginType__, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
70
+ export declare function buildWedaApp({ cals, subAppCalsList: _subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, runtimeOptions, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints: _cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, enableAd, account, mpConfig, privatelinkConfig, __defaultLoginType__, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
68
71
  export declare function cleanComponentDir(): Promise<void>;
69
72
  export declare const version: any;
70
73
  export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
@@ -81,6 +84,7 @@ interface INormalizeInput {
81
84
  subAppSerializeDataList?: IBuildWedaApp['subAppCalsList'];
82
85
  subAppCalsList?: IBuildWedaApp['subAppCalsList'];
83
86
  deployOptions: IBuildWedaApp['deployOptions'];
87
+ runtimeOptions?: IBuildWedaApp['runtimeOptions'];
84
88
  mpAppId?: string;
85
89
  extraData?: {
86
90
  isComposite: boolean;
@@ -60,7 +60,7 @@ async function buildWedaConfig({ output, domain = undefined, isPrivateMode = und
60
60
  await (0, index_1.generateConfig)(data, outDir);
61
61
  }
62
62
  exports.buildWedaConfig = buildWedaConfig;
63
- async function buildWedaApp({ cals, subAppCalsList: _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 }, plugins = [], extraData = {
63
+ async function buildWedaApp({ cals, subAppCalsList: _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 }, runtimeOptions, plugins = [], extraData = {
64
64
  isComposite: false,
65
65
  compProps: {},
66
66
  }, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints: _cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, privatelinkConfig = undefined, __defaultLoginType__ = 'anonymous', }, cb) {
@@ -73,6 +73,12 @@ async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], depend
73
73
  if (!deployOptions.mode) {
74
74
  deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
75
75
  }
76
+ if (!runtimeOptions) {
77
+ runtimeOptions = {};
78
+ }
79
+ if (!runtimeOptions.mode) {
80
+ runtimeOptions.mode = deployOptions.mode;
81
+ }
76
82
  /**
77
83
  * 正规化子包数据
78
84
  * 清除冗余字段
@@ -207,6 +213,7 @@ async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], depend
207
213
  calses,
208
214
  plugins,
209
215
  deployOptions,
216
+ runtimeOptions,
210
217
  options: {
211
218
  isCrossAccount: resourceAppId !== deployOptions.targetMpAppId,
212
219
  mpAppId: deployOptions.mpAppId || '',
@@ -252,6 +259,7 @@ async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], depend
252
259
  devTool,
253
260
  runtime,
254
261
  deployOptions,
262
+ runtimeOptions,
255
263
  ignoreInstall,
256
264
  cdnEndpoints,
257
265
  });
@@ -302,6 +310,7 @@ var util_2 = require("../util");
302
310
  Object.defineProperty(exports, "getCompileDirs", { enumerable: true, get: function () { return util_2.getCompileDirs; } });
303
311
  exports.default = buildWedaApp;
304
312
  function normalizeInputs(inputs, { envId, getWebRootPath, }) {
313
+ var _a, _b;
305
314
  const { extraData = { isComposite: false, compProps: {} } } = inputs;
306
315
  /**
307
316
  * 过滤处理 dependencies
@@ -349,6 +358,14 @@ function normalizeInputs(inputs, { envId, getWebRootPath, }) {
349
358
  };
350
359
  }
351
360
  }
361
+ if (!inputs.runtimeOptions) {
362
+ inputs.runtimeOptions = {};
363
+ }
364
+ inputs.runtimeOptions.mode =
365
+ inputs.runtimeOptions.mode ||
366
+ (((_a = inputs.deployOptions) === null || _a === void 0 ? void 0 : _a.mode) == types_1.DEPLOY_MODE.DYNAMIC
367
+ ? types_1.DEPLOY_MODE.PREVIEW
368
+ : ((_b = inputs.deployOptions) === null || _b === void 0 ? void 0 : _b.mode) || types_1.DEPLOY_MODE.PREVIEW);
352
369
  if (extraData.isComposite) {
353
370
  Object.keys(extraData.compProps.events).forEach((eName) => {
354
371
  extraData.compProps.events[eName] = `$$EVENT_${eName}$$`;
@@ -5,7 +5,7 @@ import { IPlatformApp } from '@cloudbase/cals';
5
5
  import { ICDN_ENDPOINTS_COFIG } from '../config';
6
6
  import { IAppCommonBuildContext } from '../mp/BuildContext';
7
7
  import { IBuildWedaApp } from '../core';
8
- export declare function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, buildTypeList, subAppCalsList, mode, devTool, runtime, deployOptions, ignoreInstall, cdnEndpoints, }: {
8
+ export declare function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, buildTypeList, subAppCalsList, mode, devTool, runtime, deployOptions, ignoreInstall, runtimeOptions, cdnEndpoints, }: {
9
9
  buildContext: Omit<IAppCommonBuildContext, 'mainAppData'>;
10
10
  cals: IPlatformApp;
11
11
  subAppCalsList: IPlatformApp[];
@@ -18,6 +18,7 @@ export declare function buildH5App({ buildContext, i18nConfig, extraData, cals:
18
18
  deployOptions?: IBuildWedaApp['deployOptions'];
19
19
  ignoreInstall?: boolean;
20
20
  cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
21
+ runtimeOptions?: IBuildWedaApp['runtimeOptions'];
21
22
  }): Promise<string>;
22
23
  /**
23
24
  * 导出进行单测
@@ -53,12 +53,15 @@ if (!process.env.IS_WEB_WORKER) {
53
53
  let transform = require('../../utils/transform');
54
54
  BabelTransform = transform.BabelTransform;
55
55
  }
56
- 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, }) {
56
+ 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, runtimeOptions = {}, cdnEndpoints, }) {
57
57
  var _a, _b, _c, _d, _e, _f, _g, _h;
58
58
  const { projDir: buildDir, domain, materialLibs: dependencies, appId: appKey, isPrivateMode, enableExpiredTag, privatelinkConfig, enableOfficialLibNPM, } = buildContext;
59
59
  if (!deployOptions.mode || deployOptions.mode === types_1.DEPLOY_MODE.DYNAMIC) {
60
60
  deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
61
61
  }
62
+ if (!runtimeOptions.mode) {
63
+ runtimeOptions.mode = deployOptions.mode;
64
+ }
62
65
  try {
63
66
  const { materialsDir } = runtime === types_1.RUNTIME.CI ? (0, util_1.getCompileDirs)(appKey) : (0, util_1.getCompileDirs)('app');
64
67
  const h5BuildDir = path_1.default.join(buildDir, 'h5');
@@ -176,6 +179,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
176
179
  isSandbox: false,
177
180
  runtime,
178
181
  deployOptions: deployOptions,
182
+ runtimeOptions: runtimeOptions,
179
183
  _indexPage,
180
184
  isPrivateMode,
181
185
  expirationStartTimesnap: enableExpiredTag ? Date.now() : undefined,
@@ -14,12 +14,13 @@ export declare function generateWedaRootCommonFile({ buildContext, buildTypeList
14
14
  cssVarMap?: Object;
15
15
  filter?: (src: string) => boolean;
16
16
  }): Promise<void>;
17
- export declare function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, options, buildTypeList, ignoreInstall, cdnEndpoints, mpConfig, }: {
17
+ export declare function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, runtimeOptions, options, buildTypeList, ignoreInstall, cdnEndpoints, mpConfig, }: {
18
18
  buildContext: Omit<IBuildContext, 'wedaRoot'>;
19
19
  weapps: IWeAppData[];
20
20
  calses: IPlatformApp[];
21
21
  plugins: IPlugin[];
22
22
  deployOptions: Required<IBuildWedaApp>['deployOptions'];
23
+ runtimeOptions?: IBuildWedaApp['runtimeOptions'];
23
24
  options: {
24
25
  mpAppId: string;
25
26
  resourceAppId?: string;
@@ -112,7 +112,7 @@ async function generateWedaRootCommonFile({ buildContext, buildTypeList, localWe
112
112
  await (0, generateFiles_1.default)(wedaRootFileData, templateDir, localWedaRoot, filter);
113
113
  }
114
114
  exports.generateWedaRootCommonFile = generateWedaRootCommonFile;
115
- async function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, options, buildTypeList, ignoreInstall = false, cdnEndpoints = {}, mpConfig = {}, }) {
115
+ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deployOptions, runtimeOptions, options, buildTypeList, ignoreInstall = false, cdnEndpoints = {}, mpConfig = {}, }) {
116
116
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
117
117
  const operationLabel = em('Wexin MiniProgram Generated');
118
118
  console.time(operationLabel);
@@ -232,7 +232,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
232
232
  envID: mainAppData.envId,
233
233
  appID: appId,
234
234
  resourceAppid: !!options.isCrossAccount ? options.resourceAppId : '',
235
- isProd: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD,
235
+ isProd: (runtimeOptions === null || runtimeOptions === void 0 ? void 0 : runtimeOptions.mode) === types_1.DEPLOY_MODE.UPLOAD,
236
236
  deployMode: deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode,
237
237
  clientID: ((_g = mainAppData.extra) === null || _g === void 0 ? void 0 : _g.enableLoginStatusShare)
238
238
  ? mainAppData.envId