@cloudbase/lowcode-builder 0.1.26 → 1.0.0

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.
Files changed (84) hide show
  1. package/lib/builder/core/index.d.ts +1 -3
  2. package/lib/builder/core/index.js +42 -52
  3. package/lib/builder/h5/compile.d.ts +1 -1
  4. package/lib/builder/h5/compile.js +59 -20
  5. package/lib/builder/h5/copy.js +2 -4
  6. package/lib/builder/h5/generate.js +3 -3
  7. package/lib/builder/h5/index.d.ts +5 -4
  8. package/lib/builder/h5/index.js +25 -14
  9. package/lib/builder/h5/material.js +6 -11
  10. package/lib/builder/h5/npm.js +6 -5
  11. package/lib/builder/mp/index.js +38 -49
  12. package/lib/builder/mp/materials.js +25 -18
  13. package/lib/builder/mp/mixMode.js +7 -10
  14. package/lib/builder/mp/mp_config.js +2 -3
  15. package/lib/builder/mp/wxml.js +1 -1
  16. package/lib/builder/service/webpack.d.ts +7 -1
  17. package/lib/builder/service/webpack.js +97 -24
  18. package/lib/builder/types/common.d.ts +1 -1
  19. package/lib/builder/types/common.js +2 -1
  20. package/lib/builder/util/common.js +1 -4
  21. package/lib/builder/util/generateFiles.js +12 -10
  22. package/lib/builder/util/mp.js +2 -8
  23. package/lib/builder.web.js +71 -0
  24. package/lib/index.d.ts +4 -0
  25. package/lib/index.js +6 -0
  26. package/lib/types.d.ts +1 -0
  27. package/lib/types.js +11 -0
  28. package/package.json +3 -8
  29. package/template/html/index.html.ejs +59 -29
  30. package/template/mp/common/weapp-page.js +23 -1
  31. package/template/mp/package.json +1 -1
  32. package/template/mp/page/index.js +2 -1
  33. package/template/package.json +5 -2
  34. package/template/webpack/getCSSModuleLocalIdent.js +28 -0
  35. package/template/webpack/web.prod.js +112 -103
  36. package/template/src/app/common.js +0 -13
  37. package/template/src/app/global-api.js +0 -99
  38. package/template/src/app/handlers.js +0 -13
  39. package/template/src/app/material-actions.js +0 -16
  40. package/template/src/app/mountAppApis.js +0 -25
  41. package/template/src/app/mountMpApis.js +0 -4
  42. package/template/src/datasources/config.js.tpl +0 -23
  43. package/template/src/datasources/dataset-profiles.js.tpl +0 -5
  44. package/template/src/datasources/datasource-profiles.js.tpl +0 -4
  45. package/template/src/datasources/index.js +0 -31
  46. package/template/src/handlers/FieldMiddleware/renderer.jsx +0 -331
  47. package/template/src/handlers/HotAreas.js +0 -36
  48. package/template/src/handlers/PositionHandler.jsx +0 -8
  49. package/template/src/handlers/actionHandler/utils.js +0 -149
  50. package/template/src/handlers/componentEventActionEmitter.js +0 -29
  51. package/template/src/handlers/componentNodeMap.js +0 -24
  52. package/template/src/handlers/controller.js +0 -5
  53. package/template/src/handlers/emitComponentEvent.js +0 -8
  54. package/template/src/handlers/eventListener/componentEventListener.js +0 -15
  55. package/template/src/handlers/eventListener/hotAreaEventListener.js +0 -32
  56. package/template/src/handlers/eventListener/index.js +0 -29
  57. package/template/src/handlers/eventListener/pageEventListener.js +0 -11
  58. package/template/src/handlers/eventListener/types.js +0 -32
  59. package/template/src/handlers/hooks/index.js +0 -14
  60. package/template/src/handlers/initWebEnv.js +0 -4
  61. package/template/src/handlers/injectStyle.js +0 -14
  62. package/template/src/handlers/instanceMap.js +0 -39
  63. package/template/src/handlers/lifecycle.js +0 -232
  64. package/template/src/handlers/render.jsx +0 -131
  65. package/template/src/handlers/utils/common.js +0 -151
  66. package/template/src/handlers/utils/eventProxy.js +0 -64
  67. package/template/src/handlers/utils/events.js +0 -8
  68. package/template/src/handlers/utils/index.js +0 -4
  69. package/template/src/handlers/utils/widgets.js +0 -320
  70. package/template/src/index.jsx +0 -142
  71. package/template/src/index.less +0 -119
  72. package/template/src/libraries/default-lib/wx_yypt_report_v2.js +0 -441
  73. package/template/src/pages/app.tpl +0 -124
  74. package/template/src/router/index.tpl +0 -28
  75. package/template/src/store/computed.js +0 -11
  76. package/template/src/store/index.js +0 -40
  77. package/template/src/utils/ScanCodeComponent.js +0 -396
  78. package/template/src/utils/date.js +0 -324
  79. package/template/src/utils/history.js +0 -72
  80. package/template/src/utils/index.js +0 -67
  81. package/template/src/utils/kbone.js +0 -18
  82. package/template/src/utils/monitor-jssdk.min.js +0 -763
  83. package/template/src/utils/request.js +0 -5
  84. package/template/src/utils/scan-code-action.js +0 -27
package/lib/index.d.ts CHANGED
@@ -7,3 +7,7 @@
7
7
  */
8
8
  export * from './builder/core/index';
9
9
  export * from './types';
10
+ /**
11
+ * cache map
12
+ */
13
+ export { PERSISTENT_DEPENDIENCES_MAP } from './builder/service/webpack';
package/lib/index.js CHANGED
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.PERSISTENT_DEPENDIENCES_MAP = void 0;
13
14
  /**
14
15
  * Tencent is pleased to support the open source community by making CloudBaseFramework - 云原生一体化部署工具 available.
15
16
  *
@@ -19,3 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
20
  */
20
21
  __exportStar(require("./builder/core/index"), exports);
21
22
  __exportStar(require("./types"), exports);
23
+ /**
24
+ * cache map
25
+ */
26
+ var webpack_1 = require("./builder/service/webpack");
27
+ Object.defineProperty(exports, "PERSISTENT_DEPENDIENCES_MAP", { enumerable: true, get: function () { return webpack_1.PERSISTENT_DEPENDIENCES_MAP; } });
package/lib/types.d.ts CHANGED
@@ -12,3 +12,4 @@ export declare enum HISTORY_TYPE {
12
12
  HASH = "HASH"
13
13
  }
14
14
  export { PropBindType } from '@cloudbase/cals';
15
+ export * from './builder/types/common';
package/lib/types.js CHANGED
@@ -1,4 +1,14 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
3
13
  exports.PropBindType = exports.HISTORY_TYPE = exports.RUNTIME = exports.DEPLOY_MODE = void 0;
4
14
  var DEPLOY_MODE;
@@ -19,3 +29,4 @@ var HISTORY_TYPE;
19
29
  })(HISTORY_TYPE = exports.HISTORY_TYPE || (exports.HISTORY_TYPE = {}));
20
30
  var cals_1 = require("@cloudbase/cals");
21
31
  Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function () { return cals_1.PropBindType; } });
32
+ __exportStar(require("./builder/types/common"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "0.1.26",
3
+ "version": "1.0.0",
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",
@@ -38,8 +38,8 @@
38
38
  "url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
39
39
  },
40
40
  "dependencies": {
41
- "@cloudbase/cals": "^0.3.29",
42
- "@cloudbase/lowcode-generator": "^0.6.26",
41
+ "@cloudbase/cals": "^0.3.31",
42
+ "@cloudbase/lowcode-generator": "^1.0.0",
43
43
  "axios": "^0.21.0",
44
44
  "browserfs": "^1.4.3",
45
45
  "browserify-zlib": "^0.2.0",
@@ -52,11 +52,6 @@
52
52
  "fs-extra": "^7.0.1",
53
53
  "jszip": "^3.7.1",
54
54
  "lodash": "^4.17.11",
55
- "lodash.clone": "^4.5.0",
56
- "lodash.get": "^4.4.2",
57
- "lodash.set": "^4.3.2",
58
- "lodash.template": "^4.5.0",
59
- "lodash.uniqby": "^4.7.0",
60
55
  "os-browserify": "^0.3.0",
61
56
  "stream-browserify": "^3.0.0",
62
57
  "webpack": "^4.41.4",
@@ -10,24 +10,37 @@
10
10
  />
11
11
  <meta name="format-detection" content="telephone=no" />
12
12
  <meta name="description" content="<%= desc %>" />
13
- <% if(!isAdminPortal){ %>
14
- <script src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js"></script>
13
+ <link
14
+ rel="stylesheet"
15
+ href="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.0278b2e1cf17b7972959.css"
16
+ />
17
+ <script crossorigin="anonymous" src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?v=1"></script>
15
18
  <script>
16
- const aegis = new Aegis({
19
+ <% if(!isAdminPortal){ %>
20
+ const _aegis = new Aegis({
17
21
  id: 'lXHFsBpTjIzNADiczY', // 项目ID,即上报key
18
22
  reportApiSpeed: true, // 接口测速
19
23
  reportAssetSpeed: true, // 静态资源测速
20
24
  spa: true,
21
25
  ext1: '<%=appId%>',
22
26
  });
27
+ <% } else {%>
28
+ const _aegis = new Aegis({
29
+ id: 'lXHFsBpTrKcnOMqTRQ', // 项目ID,即上报key
30
+ reportApiSpeed: false, // 接口测速
31
+ reportAssetSpeed: false, // 静态资源测速
32
+ spa: true,
33
+ ext1: '<%=appId%>',
34
+ });
35
+ <% }%>
36
+ window._aegis = _aegis;
37
+ window._aegis_inited = Date.now()
23
38
  </script>
24
- <% }%>
25
39
  <title><%= title %></title>
26
40
  <% if(mode !== 'production'){ %>
27
41
  <!-- <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.3.4/vconsole.min.js"></script>
28
42
  <script>new VConsole()</script> -->
29
- <% }%> <% Array.isArray(jsApis) && jsApis.filter(function(item){return
30
- !!item}).forEach(function(jsApi){%>
43
+ <% }%> <% Array.isArray(jsApis) && jsApis.filter(function(item){return !!item}).forEach(function(jsApi){%>
31
44
  <script src="<%=jsApi %>"></script>
32
45
  <% })%>
33
46
 
@@ -53,15 +66,14 @@
53
66
  body {
54
67
  margin: 0;
55
68
  font-size: 14px;
56
- font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi,
57
- Arial, sans-serif;
69
+ font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
58
70
  line-height: 1.5;
59
71
  color: #333;
60
72
  background-color: #fff;
61
73
  min-height: 100%;
62
74
  }
63
75
 
64
- body > #root {
76
+ body > #react {
65
77
  height: 100%;
66
78
  }
67
79
 
@@ -374,7 +386,8 @@
374
386
  <% if(canUseVite){ %>
375
387
  <script type="module" src="/src/index.jsx"></script>
376
388
  <% } %> <% if(!isAdminPortal){ %>
377
- <script src="https://imgcache.qq.com/qcloud/cloudbase-js-sdk/1.5.3-alpha.0/cloudbase.full.js"></script>
389
+ <script src="/weda-config/weda-private.js"></script>
390
+ <script src="//static.cloudbase.net/cloudbase-js-sdk/2.4.0-alpha.0/cloudbase.full.js?v=1"></script>
378
391
  <% }%>
379
392
  <script>
380
393
  if (window.cloudbase) {
@@ -383,18 +396,12 @@
383
396
  let promise = _callFunction.call(window.cloudbase, ...arguments);
384
397
  if (promise instanceof Promise) {
385
398
  return promise
386
- .then((res) => {
399
+ .then(function (res) {
387
400
  const { name, data = {} } = args || {};
388
401
  try {
389
402
  if (res.result && res.result.code) {
390
- aegis.report({
391
- msg:
392
- '[' +
393
- name +
394
- ':' +
395
- data.methodName +
396
- ']: ' +
397
- (res.result.message || '函数调用失败'),
403
+ _aegis.report({
404
+ msg: '[' + name + ':' + data.methodName + ']: ' + (res.result.message || '函数调用失败'),
398
405
  level: '16',
399
406
  ext2: res.result.code,
400
407
  ext3: res.requestId,
@@ -404,16 +411,10 @@
404
411
  } catch (e) {}
405
412
  return res;
406
413
  })
407
- .catch((e) => {
414
+ .catch(function (e) {
408
415
  try {
409
- aegis.report({
410
- msg:
411
- '[' +
412
- name +
413
- ':' +
414
- data.methodName +
415
- ']: ' +
416
- (e.message || '函数调用失败'),
416
+ _aegis.report({
417
+ msg: '[' + name + ':' + data.methodName + ']: ' + (e.message || '函数调用失败'),
417
418
  level: '16',
418
419
  ext2: e.code,
419
420
  ext3: e.requestId,
@@ -428,10 +429,39 @@
428
429
  };
429
430
  }
430
431
  </script>
432
+ <script
433
+ crossorigin
434
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react@16.14.0/umd/react.production.min.js"
435
+ ></script>
436
+ <script
437
+ crossorigin
438
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react-dom@16.14.0/umd/react-dom.production.min.js"
439
+ ></script>
431
440
  <script
432
441
  src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
433
442
  crossorigin="anonymous"
434
443
  ></script>
435
- <script src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"></script>
444
+ <script
445
+ crossorigin="anonymous"
446
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.11/dist/h5.browser.js"
447
+ ></script>
448
+ <script>
449
+ // zxing polifill
450
+ if (!this.globalThis) {
451
+ this.globalThis = this;
452
+ }
453
+ </script>
454
+ <script
455
+ crossorigin="anonymous"
456
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"
457
+ ></script>
458
+ <script
459
+ crossorigin
460
+ src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_url/qcloud/lowcode/static/ide/assets/js/babel.min.js"
461
+ ></script>
462
+ <script
463
+ crossorigin
464
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.f93bff079760aee11bad.bundle.js"
465
+ ></script>
436
466
  </body>
437
467
  </html>
@@ -19,7 +19,8 @@ export function createPage(
19
19
  app,
20
20
  handler,
21
21
  pageContext = {},
22
- context
22
+ context,
23
+ pageAttributes
23
24
  ) {
24
25
  const evtHandlers = createEventHandlers(evtListeners, context);
25
26
 
@@ -39,6 +40,27 @@ export function createPage(
39
40
  // delete result[e[1]];
40
41
  // }
41
42
  // });
43
+ result['onShareAppMessage'] = (res) => {
44
+ if (res?.from === 'button' && res?.target?.dataset?.weda_share_info) {
45
+ return res?.target?.dataset?.weda_share_info;
46
+ }
47
+ else if (pageAttributes?.appShareMessage) {
48
+ let {pageId, params, imageUrl, title} = pageAttributes.appShareMessage;
49
+ pageId = pageId ? pageId.replace(/^(\.)?\//,'') : pageId;
50
+ let realPath = `/pages/${pageId}/index` + (params ? '?'+params.map(pair => pair.key + '=' + pair.value).join('&'):'');
51
+ return {
52
+ path:realPath,
53
+ imageUrl,
54
+ title
55
+ };
56
+ }
57
+ try {
58
+ return lifecycle?.['onShareAppMessage']?.() || {};
59
+ } catch (error) {
60
+ console.log(error);
61
+ return {};
62
+ }
63
+ }
42
64
  return result;
43
65
  }
44
66
 
@@ -3,7 +3,7 @@
3
3
  "version": "1.0.8",
4
4
  "scripts": {},
5
5
  "dependencies": {
6
- "@cloudbase/weda-client": "^0.2.12",
6
+ "@cloudbase/weda-client": "^0.2.15",
7
7
  "@cloudbase/oauth": "0.1.1-alpha.5",
8
8
  "mobx": "^5.15.4",
9
9
  "lodash.get": "^4.4.2",
@@ -35,4 +35,5 @@ const dataBinds = {<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
35
35
  },<%}) %>
36
36
  }
37
37
 
38
- createPage('<%= pageName %>', '<%= pageUUID %>', widgetProps, {}, lifecyle, state, computed, evtListeners, dataBinds, app, handlers, $page, context)
38
+
39
+ createPage('<%= pageName %>', '<%= pageUUID %>', widgetProps, {}, lifecyle, state, computed, evtListeners, dataBinds, app, handlers, $page, context, <%= pageAttributes?JSON.stringify(pageAttributes):'{}' %>)
@@ -2,7 +2,7 @@
2
2
  "name": "lcap-<%= appId%>",
3
3
  "version": "1.0.0",
4
4
  "scripts": {
5
- "build-web": "rm -rf ./preivew && webpack --config ./webpack/webpack.web.prod.js"
5
+ "build-web": "webpack --config ./webpack/webpack.web.prod.js"
6
6
  },
7
7
  "dependencies": {
8
8
  "@cloudbase/js-sdk": "2.4.0-beta.0",
@@ -39,7 +39,7 @@
39
39
  "babel-plugin-import": "^1.13.0",
40
40
  "base64-inline-loader": "^1.1.1",
41
41
  "copy-webpack-plugin": "^6.2.1",
42
- "css-loader": "^3.4.0",
42
+ "css-loader": "^5",
43
43
  "css-minimizer-webpack-plugin": "^1.2.0",
44
44
  "happypack": "^5.0.1",
45
45
  "dart-sass": "^1.24.0",
@@ -49,6 +49,7 @@
49
49
  "postcss-css-variables": "^0.16.0",
50
50
  "less": "^4.0.0",
51
51
  "less-loader": "^7.0.1",
52
+ "loader-utils": "^3.2.0",
52
53
  "sass-loader": "^8.0.0",
53
54
  "terser-webpack-plugin": "^3.0.2",
54
55
  "mini-css-extract-plugin": "^0.8.0",
@@ -56,6 +57,8 @@
56
57
  "html-webpack-plugin": "^3.2.0",
57
58
  "ts-loader": "^8.3.0",
58
59
  "typescript": "^4.4.4",
60
+ "vue-loader": "14",
61
+ "vue-template-compiler": "^2.6.14",
59
62
  "webpack": "^4.41.4",
60
63
  "webpack-cli": "^4.2.0",
61
64
  "webpack-dev-server": "^3.11.0"
@@ -0,0 +1,28 @@
1
+ // Stolen from https://github.com/facebook/create-react-app/blob/cee26589ff919e946030a5651a93ccba78a93293/packages/react-dev-utils/getCSSModuleLocalIdent.js
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ const loaderUtils = require('loader-utils');
12
+ const path = require('path');
13
+
14
+ module.exports = function getLocalIdent(context, localIdentName, localName, options) {
15
+ // Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style
16
+ const fileNameOrFolder = context.resourcePath.match(/index\.module\.(css|scss|sass)$/) ? '[folder]' : '[name]';
17
+ // Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique.
18
+ const hash = loaderUtils.getHashDigest(
19
+ path.posix.relative(context.rootContext, context.resourcePath) + localName,
20
+ 'md5',
21
+ 'base64',
22
+ 5,
23
+ );
24
+ // Use loaderUtils to find the file or folder name
25
+ const className = loaderUtils.interpolateName(context, fileNameOrFolder + '_' + localName + '__' + hash, options);
26
+ // Remove the .module that appears in every classname when based on the file and replace all "." with "_".
27
+ return className.replace('.module_', '_').replace(/\./g, '_');
28
+ };