@cloudbase/lowcode-builder 1.8.22 → 1.8.23

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.
@@ -19,3 +19,7 @@ export declare function buildH5App({ buildContext, i18nConfig, extraData, cals:
19
19
  ignoreInstall?: boolean;
20
20
  cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
21
21
  }): Promise<string>;
22
+ /**
23
+ * 导出进行单测
24
+ */
25
+ export declare function _BabelTransformCalsExpression(key: any, value: any): any;
@@ -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.buildH5App = void 0;
29
+ exports._BabelTransformCalsExpression = exports.buildH5App = void 0;
30
30
  const path_1 = __importDefault(require("path"));
31
31
  const weapps_core_1 = require("@cloudbase/lowcode-generator/lib/weapps-core");
32
32
  const material_1 = require("./material");
@@ -203,15 +203,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
203
203
  exports.buildH5App = buildH5App;
204
204
  function processCals(cals) {
205
205
  return walkThroughJson(cals, (key, value, prefix) => {
206
- if (/^:(.*)$/.test(key)) {
207
- try {
208
- return (0, transform_1.BabelTransform)(value, { IIFE: true });
209
- }
210
- catch (e) {
211
- return value;
212
- }
213
- }
214
- return value;
206
+ return _BabelTransformCalsExpression(key, value);
215
207
  });
216
208
  }
217
209
  function _isPlainObj(obj) {
@@ -237,3 +229,32 @@ function walkThroughJson(obj, callback, path = '') {
237
229
  }
238
230
  return obj;
239
231
  }
232
+ /**
233
+ * 导出进行单测
234
+ */
235
+ function _BabelTransformCalsExpression(key, value) {
236
+ const DYNAMIC_REG = /^:(.*)$/;
237
+ const FOR_IN_REG = /^(.*?in\s)/;
238
+ if (DYNAMIC_REG.test(key)) {
239
+ try {
240
+ let forPrefix = '';
241
+ if (key === ':for') {
242
+ const matched = value.match(FOR_IN_REG) || [];
243
+ forPrefix = matched[0];
244
+ if (forPrefix) {
245
+ value = value.replace(FOR_IN_REG, '');
246
+ }
247
+ }
248
+ value = (0, transform_1.BabelTransform)(value, { IIFE: true });
249
+ if (forPrefix) {
250
+ value = `${forPrefix}${value}`;
251
+ }
252
+ return value;
253
+ }
254
+ catch (e) {
255
+ return value;
256
+ }
257
+ }
258
+ return value;
259
+ }
260
+ exports._BabelTransformCalsExpression = _BabelTransformCalsExpression;
@@ -1,6 +1,6 @@
1
1
  export { BuildType, GenerateMpType, WebpackModeType, WebpackBuildCallBack, IPackageJson, buildAsWebByBuildType, buildAsAdminPortalByBuildType, buildAsXPageByBuildType, IAppUsedComp, IUsedComps, ISyncProp, IComponentInputProps, IFileCodeMap, } from '@cloudbase/lowcode-generator/lib/generator/types/common';
2
2
  import { IComponentMeta, ICompositedComponent } from '@cloudbase/lowcode-generator/lib/weapps-core';
3
- export declare type IComponentsInfoMap = {
3
+ export type IComponentsInfoMap = {
4
4
  [componentSourceKey: string]: ({
5
5
  meta: IComponentMeta;
6
6
  } & {
@@ -1,7 +1,7 @@
1
1
  import { IComponentInputProps, IComponentsInfoMap, IPackageJson } from '../types/common';
2
2
  import { IMaterialItem, IWeAppComponentInstance, IWeAppCode } from '@cloudbase/lowcode-generator/lib/weapps-core';
3
3
  export { getMetaInfoBySourceKey, isArray, isPlainObject, deepDeal, simpleDeepClone, deepDealSchema, getFileNameByUrl, } from '@cloudbase/lowcode-generator/lib/generator/util/common';
4
- declare type PromiseResult<T> = Promise<[null, T] | [Error, null]>;
4
+ type PromiseResult<T> = Promise<[null, T] | [Error, null]>;
5
5
  export declare function promiseWrapper<T>(p: Promise<T>): PromiseResult<T>;
6
6
  export declare function getCurrentPackageJson(): {
7
7
  name: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.22",
3
+ "version": "1.8.23",
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",