@cloudbase/lowcode-builder 1.8.21 → 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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BabelTransform = void 0;
4
+ /* eslint-disable no-new-func */
4
5
  const core_1 = require("@babel/core");
5
6
  function BabelTransform(code, options = {}) {
6
7
  var _a;
@@ -8,7 +9,6 @@ function BabelTransform(code, options = {}) {
8
9
  try {
9
10
  const simpleWrapped = `(\n${code || 'undefined'}\n)`;
10
11
  const { code: expression } = (0, core_1.transformSync)(IIFE ? `(()=>${simpleWrapped})()` : simpleWrapped, {
11
- // plugins: ['transform-modules-commonjs', 'transform-react-jsx'],
12
12
  cwd: __dirname,
13
13
  sourceType: 'script',
14
14
  comments: false,
@@ -18,14 +18,31 @@ function BabelTransform(code, options = {}) {
18
18
  '@babel/preset-env',
19
19
  {
20
20
  targets: {
21
- // esmodules: true,
22
- browsers: ['defaults', 'iOS >= 10', 'safari >= 10'],
21
+ /**
22
+ * 支持 proxy 的版本
23
+ * 低于这个版本完全无法支持
24
+ */
25
+ // browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
26
+ /**
27
+ * 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
28
+ * 但是不包涵 options chain
29
+ * 基本上是 es2019
30
+ */
31
+ browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
23
32
  },
33
+ include: [
34
+ // es2015
35
+ '@babel/plugin-transform-arrow-functions',
36
+ ],
24
37
  },
25
38
  ],
26
39
  ],
27
40
  }) || {};
28
- return ((_a = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _a === void 0 ? void 0 : _a.call(expression, /;$/, '')) || code;
41
+ const res = ((_a = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _a === void 0 ? void 0 : _a.call(expression, /;$/, '')) || code;
42
+ if (expression) {
43
+ new Function(`return (\n${res}\n)`);
44
+ }
45
+ return res;
29
46
  }
30
47
  catch (e) {
31
48
  console.error(`transform [${code}] fail:`, e === null || e === void 0 ? void 0 : e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.21",
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",