@cloudbase/lowcode-builder 1.8.103 → 1.8.105

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.
@@ -91,8 +91,9 @@ interface InormalizeOutput extends INormalizeInput {
91
91
  }
92
92
  export declare function normalizeInputs(inputs: INormalizeInput, { envId, getWebRootPath, }: {
93
93
  envId: string;
94
- getWebRootPath?: ({ appId, deployOptions }: {
95
- appId: any;
94
+ getWebRootPath?: ({ appId, name, deployOptions, }: {
95
+ appId: string;
96
+ name: string;
96
97
  deployOptions: any;
97
98
  }) => string;
98
99
  }): InormalizeOutput;
@@ -326,6 +326,16 @@ function normalizeInputs(inputs, { envId, getWebRootPath, }) {
326
326
  inputs.deployOptions.targetMpAppId = inputs.deployOptions.mpAppId;
327
327
  }
328
328
  }
329
+ else {
330
+ // web 构建
331
+ const { deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW } } = inputs;
332
+ if (deployOptions.mode === types_1.DEPLOY_MODE.DYNAMIC) {
333
+ inputs.deployOptions = {
334
+ ...deployOptions,
335
+ mode: types_1.DEPLOY_MODE.PREVIEW,
336
+ };
337
+ }
338
+ }
329
339
  if (extraData.isComposite) {
330
340
  Object.keys(extraData.compProps.events).forEach((eName) => {
331
341
  extraData.compProps.events[eName] = `$$EVENT_${eName}$$`;
@@ -356,7 +366,7 @@ function normalizeCals(cals, { buildTypeList, envId, deployOptions, appId, getWe
356
366
  }
357
367
  let { appConfig = {} } = cals.extra;
358
368
  let { window = {} } = appConfig;
359
- let path = getWebRootPath({ appId, deployOptions });
369
+ let path = getWebRootPath({ appId, name: cals.name, deployOptions });
360
370
  cals.extra.appConfig = {
361
371
  ...appConfig,
362
372
  window: {
@@ -375,8 +385,9 @@ function normalizeCals(cals, { buildTypeList, envId, deployOptions, appId, getWe
375
385
  }
376
386
  return cals;
377
387
  }
378
- function _getWebRootPath({ appId, deployOptions }) {
379
- return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD ? `/${appId}/production/` : `/${appId}/preview/`;
388
+ function _getWebRootPath({ appId, name, deployOptions }) {
389
+ const key = name || appId;
390
+ return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD ? `/${key}/production/` : `/${key}/preview/`;
380
391
  }
381
392
  async function buildComposite({ dependencies, output, isBrowserMpBuilder, }) {
382
393
  var _a, _b;
@@ -53,7 +53,7 @@ if (!process.env.IS_WEB_WORKER) {
53
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, }) {
54
54
  var _a, _b, _c, _d, _e, _f;
55
55
  const { projDir: buildDir, domain, materialLibs: dependencies, appId: appKey, isPrivateMode, enableExpiredTag, privatelinkConfig, } = buildContext;
56
- if (!deployOptions.mode) {
56
+ if (!deployOptions.mode || deployOptions.mode === types_1.DEPLOY_MODE.DYNAMIC) {
57
57
  deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
58
58
  }
59
59
  try {
@@ -124,7 +124,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
124
124
  buildTypeList,
125
125
  isSandbox: false,
126
126
  runtime,
127
- deployOptions,
127
+ deployOptions: deployOptions,
128
128
  _indexPage,
129
129
  isPrivateMode,
130
130
  expirationStartTimesnap: enableExpiredTag ? Date.now() : undefined,
@@ -249,6 +249,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
249
249
  appID: appId,
250
250
  resourceAppid: !!options.isCrossAccount ? options.resourceAppId : '',
251
251
  isProd: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.UPLOAD,
252
+ deployMode: deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode,
252
253
  clientID: ((_g = mainAppData.extra) === null || _g === void 0 ? void 0 : _g.enableLoginStatusShare)
253
254
  ? mainAppData.envId
254
255
  : (_h = mainAppData.extra) === null || _h === void 0 ? void 0 : _h.clientId,
@@ -692,7 +693,6 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
692
693
  label: (appData === null || appData === void 0 ? void 0 : appData.label) || '',
693
694
  version: (_a = options === null || options === void 0 ? void 0 : options.deployOptions) === null || _a === void 0 ? void 0 : _a.version,
694
695
  envId: appData.envId,
695
- envVersion: (ctx === null || ctx === void 0 ? void 0 : ctx.isProduction) ? 'production' : 'preview',
696
696
  loginConfigVersion: (_b = cals.extra) === null || _b === void 0 ? void 0 : _b.loginConfigVersion,
697
697
  basename: ctx.wedaRoot,
698
698
  pages: appData.pageInstanceList
@@ -25,7 +25,7 @@ async function writeCode2file(ctx, mod, lowcodeRootDir, opts = {}, themeCode, ex
25
25
  // Generate app lowcode
26
26
  const baseDir = path_1.default.relative(path_1.default.dirname(file), appDir).replace(/\\/g, '/');
27
27
  // 子包混合模式需要添加相对索引到根目录
28
- const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? `${path_1.default.relative(`packages/${ctx.rootPath}`, '')}/` : '';
28
+ const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? `${path_1.default.posix.relative(`packages/${ctx.rootPath}`, '')}/` : '';
29
29
  let weappsApiPrefix = externalAPIImport
30
30
  ? importFromClientSDK(pageId === 'global')
31
31
  : [`import { app, $app${pageId !== 'global' ? '' : ', $w'} } from '${relativeRoot}${baseDir}/app/weapps-api';`]; // windows compatibility