@cloudbase/lowcode-builder 1.8.45-ide.1 → 1.8.47

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,75 +1,69 @@
1
1
  "use strict";
2
- /* eslint-disable no-new-func */
3
- // import { transformSync } from '@babel/core';
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
3
  exports.BabelTransform = void 0;
6
- // export function BabelTransform(
7
- // code,
8
- // options: {
9
- // IIFE?: boolean;
10
- // } = {},
11
- // ) {
12
- // const { IIFE = false } = options;
13
- // /**
14
- // * 如果 trim 完为空
15
- // * 则原样不用再编译了
16
- // */
17
- // if (!code?.trim?.()) {
18
- // return code;
19
- // }
20
- // try {
21
- // /**
22
- // * 如果是基础字面量的话
23
- // * 可以直接使用原值,不用过babel
24
- // */
25
- // if (typeof code === 'string' && JSON.parse(code?.trim?.())) {
26
- // return code;
27
- // }
28
- // } catch (e) {}
29
- // try {
30
- // const simpleWrapped = `(\n${code || 'undefined'}\n)`;
31
- // const { code: expression } =
32
- // transformSync(IIFE ? `(()=>${simpleWrapped})()` : simpleWrapped, {
33
- // cwd: __dirname,
34
- // sourceType: 'script',
35
- // comments: false,
36
- // // minified: true,
37
- // presets: [
38
- // [
39
- // '@babel/preset-env',
40
- // {
41
- // targets: {
42
- // /**
43
- // * 支持 proxy 的版本
44
- // * 低于这个版本完全无法支持
45
- // */
46
- // // browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
47
- // /**
48
- // * 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
49
- // * 但是不包涵 options chain
50
- // * 基本上是 es2019
51
- // */
52
- // browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
53
- // },
54
- // include: [
55
- // // es2015
56
- // '@babel/plugin-transform-arrow-functions',
57
- // ],
58
- // },
59
- // ],
60
- // ],
61
- // }) || {};
62
- // const res = expression?.replace?.(/;$/, '') || code;
63
- // if (expression) {
64
- // new Function(`return (\n${res}\n)`);
65
- // }
66
- // return res;
67
- // } catch (e: any) {
68
- // console.error(`transform [${code}] fail:`, e?.message);
69
- // return code;
70
- // }
71
- // }
4
+ /* eslint-disable no-new-func */
5
+ const core_1 = require("@babel/core");
72
6
  function BabelTransform(code, options = {}) {
73
- return '';
7
+ var _a, _b, _c;
8
+ const { IIFE = false } = options;
9
+ /**
10
+ * 如果 trim 完为空
11
+ * 则原样不用再编译了
12
+ */
13
+ if (!((_a = code === null || code === void 0 ? void 0 : code.trim) === null || _a === void 0 ? void 0 : _a.call(code))) {
14
+ return code;
15
+ }
16
+ try {
17
+ /**
18
+ * 如果是基础字面量的话
19
+ * 可以直接使用原值,不用过babel
20
+ */
21
+ if (typeof code === 'string' && JSON.parse((_b = code === null || code === void 0 ? void 0 : code.trim) === null || _b === void 0 ? void 0 : _b.call(code))) {
22
+ return code;
23
+ }
24
+ }
25
+ catch (e) { }
26
+ try {
27
+ const simpleWrapped = `(\n${code || 'undefined'}\n)`;
28
+ const { code: expression } = (0, core_1.transformSync)(IIFE ? `(()=>${simpleWrapped})()` : simpleWrapped, {
29
+ cwd: __dirname,
30
+ sourceType: 'script',
31
+ comments: false,
32
+ // minified: true,
33
+ presets: [
34
+ [
35
+ '@babel/preset-env',
36
+ {
37
+ targets: {
38
+ /**
39
+ * 支持 proxy 的版本
40
+ * 低于这个版本完全无法支持
41
+ */
42
+ // browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
43
+ /**
44
+ * 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
45
+ * 但是不包涵 options chain
46
+ * 基本上是 es2019
47
+ */
48
+ browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
49
+ },
50
+ include: [
51
+ // es2015
52
+ '@babel/plugin-transform-arrow-functions',
53
+ ],
54
+ },
55
+ ],
56
+ ],
57
+ }) || {};
58
+ const res = ((_c = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _c === void 0 ? void 0 : _c.call(expression, /;$/, '')) || code;
59
+ if (expression) {
60
+ new Function(`return (\n${res}\n)`);
61
+ }
62
+ return res;
63
+ }
64
+ catch (e) {
65
+ console.error(`transform [${code}] fail:`, e === null || e === void 0 ? void 0 : e.message);
66
+ return code;
67
+ }
74
68
  }
75
69
  exports.BabelTransform = BabelTransform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.45-ide.1",
3
+ "version": "1.8.47",
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",
@@ -33,13 +33,16 @@
33
33
  "dev:web:serve": "rm -rf dist && node ./webpack/scripts/web.pre.js && cross-env NODE_ENV=development webpack-dev-server --config ./webpack/web.config.js",
34
34
  "dev:web": "rm -rf dist && node ./webpack/scripts/web.pre.js && cross-env NODE_ENV=development webpack --config ./webpack/web.config.js && node ./webpack/scripts/web.post.js",
35
35
  "build:web": "rm -rf dist && node ./webpack/scripts/web.pre.js && cross-env NODE_ENV=production webpack --config ./webpack/web.config.js && node ./webpack/scripts/web.post.js",
36
- "build:template": "./scripts/buildTemplate.sh"
36
+ "build:template": "./scripts/buildTemplate.sh",
37
+ "publish:web": "node ./scripts/publish.ide.js"
37
38
  },
38
39
  "bugs": {
39
40
  "url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
40
41
  },
41
42
  "dependencies": {
42
- "@cloudbase/cals": "^1.0.29",
43
+ "@babel/core": "7.21.4",
44
+ "@babel/preset-env": "7.21.4",
45
+ "@cloudbase/cals": "^1.0.35",
43
46
  "@cloudbase/lowcode-generator": "^1.8.14",
44
47
  "axios": "^0.21.0",
45
48
  "browserfs": "^1.4.3",
@@ -514,11 +514,11 @@
514
514
  crossorigin="anonymous"
515
515
  src="<%=
516
516
  cdnEndpoints.cdngo
517
- %>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.45/dist/h5.browser.js"
517
+ %>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.46/dist/h5.browser.js"
518
518
  ></script>
519
519
  <script
520
520
  crossorigin
521
- src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/acorn@8.0.4/dist/acorn.js"
521
+ src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/acorn@8.10.0/dist/acorn.js"
522
522
  ></script>
523
523
  <script>
524
524
  // zxing polifill
@@ -540,7 +540,7 @@
540
540
  crossorigin
541
541
  src="<%=
542
542
  cdnEndpoints.cdngo
543
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.2d2239ac89ba2c135587.bundle.js"
543
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.528a6b9f6d8dfaa16066.bundle.js"
544
544
  ></script>
545
545
  </body>
546
546
  </html>
@@ -6,8 +6,8 @@
6
6
  "@cloudbase/js-sdk": "2.5.6-beta.1",<%
7
7
  } %>
8
8
  "@cloudbase/oauth": "0.1.1-alpha.5",
9
- "@cloudbase/weda-client": "1.0.10",
10
- "@cloudbase/weda-cloud-sdk": "1.0.45",
9
+ "@cloudbase/weda-client": "1.0.11",
10
+ "@cloudbase/weda-cloud-sdk": "1.0.46",
11
11
  "mobx": "^5.15.4",
12
12
  "lodash.get": "^4.4.2",
13
13
  "lodash.set": "^4.3.2",