@cloudbase/framework-plugin-low-code 1.0.3-beta.1 → 1.0.3-beta.12

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 (96) hide show
  1. package/lib/builder/config/common.js +5 -1
  2. package/lib/builder/config/index.js +5 -1
  3. package/lib/builder/config/mp.js +5 -1
  4. package/lib/builder/core/copy.js +5 -1
  5. package/lib/builder/core/material.js +5 -1
  6. package/lib/builder/core/prepare.js +5 -1
  7. package/lib/builder/mp/index.js +5 -1
  8. package/lib/builder/mp/materials.js +5 -1
  9. package/lib/builder/mp/mixMode.js +5 -1
  10. package/lib/builder/mp/mp_config.js +7 -3
  11. package/lib/builder/service/builder/copy.js +5 -1
  12. package/lib/builder/service/builder/generate.js +8 -8
  13. package/lib/builder/service/builder/plugin.js +5 -1
  14. package/lib/builder/util/console.js +5 -1
  15. package/lib/builder/util/generateFiles.js +5 -1
  16. package/lib/builder/util/index.js +5 -1
  17. package/lib/builder/util/mp.js +5 -1
  18. package/lib/builder/util/net.js +5 -1
  19. package/lib/builder/util/process.d.ts +1 -0
  20. package/lib/builder/util/process.d.ts.map +1 -1
  21. package/lib/builder/util/style.js +5 -1
  22. package/lib/builder/util/weapp.js +5 -1
  23. package/lib/generator/config/index.js +5 -1
  24. package/lib/generator/core/generate.js +10 -10
  25. package/lib/generator/core/material.js +5 -1
  26. package/lib/generator/util/index.js +5 -1
  27. package/lib/index.js +6 -3
  28. package/lib/utils/dataSource.d.ts +4 -0
  29. package/lib/utils/dataSource.d.ts.map +1 -1
  30. package/lib/utils/dataSource.js +27 -12
  31. package/lib/utils/index.js +5 -1
  32. package/lib/utils/postProcess.js +5 -1
  33. package/lib/weapps-core/config/index.js +5 -1
  34. package/lib/weapps-core/index.js +5 -1
  35. package/lib/weapps-core/types/index.js +5 -1
  36. package/lib/weapps-core/utils/index.js +5 -1
  37. package/package.json +11 -32
  38. package/scripts/build-plugin-tar.sh +31 -0
  39. package/scripts/generateTemplate.js +31 -0
  40. package/scripts/link-packages.js +11 -0
  41. package/scripts/link.js +91 -0
  42. package/scripts/postinstall.js +47 -0
  43. package/scripts/preinstall.js +16 -0
  44. package/template/html/index.html.ejs +0 -456
  45. package/template/package.json +0 -63
  46. package/template/src/app/common.js +0 -13
  47. package/template/src/app/global-api.js +0 -132
  48. package/template/src/app/handlers.js +0 -13
  49. package/template/src/app/material-actions.js +0 -16
  50. package/template/src/app/mountAppApis.js +0 -25
  51. package/template/src/app/mountMpApis.js +0 -4
  52. package/template/src/datasources/config.js.tpl +0 -27
  53. package/template/src/datasources/dataset-profiles.js.tpl +0 -5
  54. package/template/src/datasources/datasource-profiles.js.tpl +0 -4
  55. package/template/src/datasources/index.js.tpl +0 -27
  56. package/template/src/handlers/FieldMiddleware/renderer.jsx +0 -536
  57. package/template/src/handlers/HotAreas.js +0 -36
  58. package/template/src/handlers/PositionHandler.jsx +0 -8
  59. package/template/src/handlers/actionHandler/utils.js +0 -154
  60. package/template/src/handlers/componentEventActionEmitter.js +0 -29
  61. package/template/src/handlers/componentNodeMap.js +0 -24
  62. package/template/src/handlers/controller.js +0 -5
  63. package/template/src/handlers/emitComponentEvent.js +0 -8
  64. package/template/src/handlers/eventListener/componentEventListener.js +0 -15
  65. package/template/src/handlers/eventListener/hotAreaEventListener.js +0 -32
  66. package/template/src/handlers/eventListener/index.js +0 -29
  67. package/template/src/handlers/eventListener/pageEventListener.js +0 -11
  68. package/template/src/handlers/eventListener/types.js +0 -32
  69. package/template/src/handlers/hooks/index.js +0 -15
  70. package/template/src/handlers/initWebEnv.js +0 -4
  71. package/template/src/handlers/injectStyle.js +0 -14
  72. package/template/src/handlers/instanceMap.js +0 -39
  73. package/template/src/handlers/lifecycle.js +0 -222
  74. package/template/src/handlers/render.jsx +0 -170
  75. package/template/src/handlers/utils/common.js +0 -297
  76. package/template/src/handlers/utils/eventProxy.js +0 -64
  77. package/template/src/handlers/utils/events.js +0 -8
  78. package/template/src/handlers/utils/index.js +0 -4
  79. package/template/src/handlers/utils/widgets.js +0 -307
  80. package/template/src/index.jsx +0 -185
  81. package/template/src/index.less +0 -119
  82. package/template/src/libraries/default-lib/wx_yypt_report_v2.js +0 -441
  83. package/template/src/pages/app.tpl +0 -200
  84. package/template/src/pages/composite.tpl +0 -171
  85. package/template/src/router/index.tpl +0 -29
  86. package/template/src/store/computed.js +0 -11
  87. package/template/src/store/index.js +0 -40
  88. package/template/src/utils/formatEnum.js +0 -42
  89. package/template/src/utils/history.js +0 -66
  90. package/template/src/utils/index.js +0 -82
  91. package/template/src/utils/kbone.js +0 -18
  92. package/template/src/utils/monitor-jssdk.min.js +0 -763
  93. package/template/src/utils/request.js +0 -5
  94. package/template/webpack/devServer.js +0 -119
  95. package/template/webpack/getCSSModuleLocalIdent.js +0 -28
  96. package/template/webpack/web.prod.js +0 -306
@@ -1,5 +0,0 @@
1
- import axios from 'axios'
2
-
3
- export const request = axios
4
-
5
- export { axios }
@@ -1,119 +0,0 @@
1
- const webpackDevServer = require('webpack-dev-server')
2
- const webpack = require('webpack')
3
- const os = require('os')
4
- const fs = require('fs')
5
- const path = require('path')
6
- const argv = require('yargs').argv
7
- const config = require('./webpack.web.prod')
8
- const { appConfig } = require('../mainAppData.json')
9
- const { window = {} } = appConfig
10
- const isApp = <%=isApp %>
11
-
12
-
13
- function getDevServerConf() {
14
- if (!argv.devServerConf) {
15
- return {}
16
- }
17
- if (!argv.devServerConf.endsWith('.js')) {
18
- console.error('参数请输入 --devServerConf config.js')
19
- } else {
20
- const devServerConfPath = path.resolve(process.cwd(), argv.devServerConf || '')
21
- if (!fs.existsSync(devServerConfPath)) {
22
- console.error(devServerConfPath, 'does not exists')
23
- return {}
24
- }
25
- let conf = require(devServerConfPath)
26
- if (!conf || typeof conf !== 'object') {
27
- console.error(devServerConfPath, 'must have module.exports={}')
28
- } else {
29
- return conf
30
- }
31
- }
32
- return {}
33
- }
34
-
35
- // const openBrowser = require('open');
36
- function getIPAdress() {
37
- const interfaces = os.networkInterfaces()
38
- for (const devName in interfaces) {
39
- const iface = interfaces[devName]
40
- for (let i = 0; i < iface.length; i++) {
41
- const alias = iface[i]
42
- if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
43
- return alias.address
44
- }
45
- }
46
- }
47
- }
48
-
49
- const port = 8001
50
- const ip = getIPAdress()
51
- let basename = ''
52
- let publicPath = ''
53
- if (!isApp) {
54
- basename = window.basename || ''
55
- if (basename.startsWith('/')) {
56
- basename = basename.replace('/', '')
57
- }
58
- publicPath = window.publicPath || ''
59
- }
60
-
61
- console.log('>>>>>>>>>>>>>>>>>>>>> basename is ', basename)
62
- console.log('>>>>>>>>>>>>>>>>>>>>> publicPath is:', publicPath)
63
- const options = {
64
- hot: true,
65
- host: ip,
66
- hotOnly: true,
67
- historyApiFallback: {
68
- verbose: true,
69
- rewrites: [
70
- {
71
- from: /^\/(.*)\.(css|js)$/,
72
- to: function(context) {
73
- // /^\/([^\.]*)\.(css|js)$/
74
- console.log('>>>>>>>>>>>>>>>>> got in css|js!', context.parsedUrl.pathname)
75
- const { assets = [] } = window
76
- const isInAssets = assets.includes(context.parsedUrl.pathname)
77
- return context.parsedUrl.pathname.replace(publicPath, '/')
78
- },
79
- },
80
- {
81
- from: new RegExp(`${basename}\/?(.*)$`),
82
- to: function(context) {
83
- console.log('>>>>>>>>>>>>>>>>> got in html!')
84
- return 'index.html'
85
- },
86
- },
87
- ],
88
- },
89
- contentBase: [path.join(__dirname, 'assets')],
90
- watchOptions: {
91
- poll: 600,
92
- ignored: /node_modules|preview|dist|html|webpack|gsd-kbone-react/,
93
- },
94
- open: {
95
- app: ['Google Chrome', '--incognito', '--other-flag'],
96
- },
97
- openPage: basename,
98
- disableHostCheck: true,
99
- compress: true
100
- }
101
-
102
- function startDevServer(conf) {
103
- console.log('start startDevServer in webpack, env:', process.env.NODE_PATH)
104
- let _options = Object.assign(options, conf)
105
- console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
106
- console.log('Current webpack-dev-server config is: ')
107
- console.log(_options)
108
- console.log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
109
- webpackDevServer.addDevServerEntrypoints(config, _options)
110
-
111
- const compiler = webpack(config)
112
- const server = new webpackDevServer(compiler, _options)
113
-
114
- server.listen(port, '0.0.0.0', () => {
115
- console.log(`调试环境端口启动在 http://${ip}:${port}/${basename}`)
116
- })
117
- }
118
-
119
- startDevServer(getDevServerConf())
@@ -1,28 +0,0 @@
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
- };
@@ -1,306 +0,0 @@
1
- const path = require('path');
2
- const webpack = require('webpack');
3
- const TerserPlugin = require('terser-webpack-plugin');
4
- const HtmlWebpackPlugin = require('html-webpack-plugin');
5
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
- const CopyWebpackPlugin = require('copy-webpack-plugin');
7
- const themeVars = require('./themeVars');
8
- const getCSSModuleLocalIdent = require('./getCSSModuleLocalIdent');
9
- const HappyPack = require('happypack');
10
- const core = 4;
11
- const happyThreadPool = HappyPack.ThreadPool({ size: core });
12
-
13
- const TS_LOADER_ID = 'ts-loader';
14
- module.exports = function (options) {
15
- const {
16
- context,
17
- entry,
18
- output,
19
- watch,
20
- externals,
21
- resolveModules,
22
- htmlTemplatePath,
23
- htmlTemplateData = {
24
- meta: {},
25
- },
26
- definePlugin = {},
27
- devtool = false,
28
- } = options;
29
-
30
- const babelLoader = {
31
- loader: 'babel-loader',
32
- options: {
33
- compact: false,
34
- cacheDirectory: true,
35
- cwd: context,
36
- presets: [
37
- [
38
- '@babel/preset-env',
39
- {
40
- modules: false,
41
- targets: {
42
- // esmodules: true,
43
- browsers: ['defaults', 'iOS >= 10', 'safari >= 10'],
44
- },
45
- },
46
- ],
47
- '@babel/preset-react',
48
- ],
49
- plugins: [
50
- [
51
- 'babel-plugin-import',
52
- {
53
- libraryName: '@govcloud/gsd-kbone-react',
54
- libraryDirectory: 'lib/components',
55
- camel2DashComponentName: false,
56
- },
57
- ],
58
- '@babel/plugin-proposal-class-properties',
59
- ['@babel/plugin-proposal-decorators', { legacy: true }],
60
- '@babel/plugin-proposal-export-default-from',
61
- '@babel/plugin-proposal-export-namespace-from',
62
- '@babel/plugin-proposal-optional-chaining',
63
- '@babel/plugin-proposal-partial-application',
64
- ['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }],
65
- ].filter(Boolean),
66
- },
67
- };
68
- const typescriptLoader = {
69
- loader: 'ts-loader',
70
- options: {
71
- compilerOptions: {
72
- target: 'ESNext',
73
- module: 'ESNext',
74
- esModuleInterop: true,
75
- },
76
- happyPackMode: true,
77
- transpileOnly: true,
78
- },
79
- };
80
-
81
- let plugins = [
82
- new HappyPack({
83
- id: 'vue',
84
- cache: true,
85
- verbose: true,
86
- loaders: [
87
- babelLoader,
88
- typescriptLoader,
89
- {
90
- loader: 'vue-loader',
91
- options: {
92
- threadMode: true,
93
- loaders: {
94
- js: [babelLoader],
95
- ts: [babelLoader, typescriptLoader],
96
- },
97
- },
98
- },
99
- ],
100
- threadPool: happyThreadPool,
101
- }),
102
- new HappyPack({
103
- id: TS_LOADER_ID,
104
- loaders: [babelLoader, typescriptLoader],
105
- threadPool: happyThreadPool,
106
- }),
107
- new HappyPack({
108
- id: 'babel',
109
- loaders: [babelLoader],
110
- threadPool: happyThreadPool,
111
- }),
112
- new HtmlWebpackPlugin({
113
- template: htmlTemplatePath,
114
- filename: 'index.html',
115
- cache: false,
116
- templateParameters: htmlTemplateData,
117
- }),
118
- new MiniCssExtractPlugin({
119
- filename: '[name].[contenthash].css',
120
- chunkFilename: '[id].[contenthash].css',
121
- }),
122
- new webpack.DefinePlugin(
123
- Object.assign(
124
- {
125
- 'process.env.isMiniprogram': false, // 注入环境变量,用于业务代码判断
126
- 'process.env.SSR': false,
127
- },
128
- definePlugin,
129
- ),
130
- ),
131
- new CopyWebpackPlugin({
132
- patterns: [
133
- {
134
- from: path.resolve(__dirname, '../assets'),
135
- to: '.',
136
- noErrorOnMissing: true,
137
- },
138
- ],
139
- }),
140
- new webpack.HashedModuleIdsPlugin({
141
- hashFunction: 'sha256',
142
- hashDigest: 'hex',
143
- hashDigestLength: 20,
144
- }),
145
- new webpack.EnvironmentPlugin({
146
- SSR: false,
147
- WEBPACK_ENV: 'production',
148
- }),
149
- ];
150
-
151
- const cssLoaders = [
152
- MiniCssExtractPlugin.loader,
153
- {
154
- loader: 'css-loader',
155
- options: {
156
- modules: {
157
- auto: true,
158
- getLocalIdent: getCSSModuleLocalIdent,
159
- },
160
- importLoaders: 2,
161
- },
162
- },
163
- {
164
- loader: 'postcss-loader',
165
- options: {
166
- postcssOptions: {
167
- plugins: [
168
- [
169
- 'postcss-pxtorem',
170
- {
171
- rootValue: 14,
172
- propList: ['*'],
173
- // todo
174
- selectorBlackList: ['.weui-picker__indicator'],
175
- },
176
- ],
177
- ],
178
- },
179
- },
180
- },
181
- ];
182
-
183
- return {
184
- context,
185
- entry,
186
- /**
187
- * 只要是构建都开启 production 以使用精简
188
- */
189
- mode: 'production',
190
- watch,
191
- output,
192
- externals,
193
- cache: {
194
- type: 'memory',
195
- },
196
- devtool: devtool,
197
- resolve: {
198
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.scss', '.css'],
199
- modules: [...resolveModules],
200
- symlinks: false,
201
- cacheWithContext: false,
202
- alias: {
203
- '@': path.resolve(__dirname, '../src'),
204
- // react: 'preact/compat',
205
- // 'react-dom/test-utils': 'preact/test-utils',
206
- // 'react-dom': 'preact/compat',
207
- },
208
- },
209
- module: {
210
- rules: [
211
- {
212
- test: /\.vue$/,
213
- loader: 'happypack/loader?id=vue',
214
- },
215
- {
216
- test: /\.tsx?$/,
217
- exclude: /node_modules\/(?!@cloudbase\/weda-ui)|gsd-kbone-react/,
218
- use: [`happypack/loader?id=${TS_LOADER_ID}`],
219
- },
220
- {
221
- test: /\.(js|jsx)$/,
222
- exclude:
223
- /node_modules\/(?!(@cloudbase\/weda-ui)|(@tcwd\/vuera)|(@tcwd\/weapps-core)|(@tcwd\/weapps-core))|gsd-kbone-react/,
224
- use: ['happypack/loader?id=babel'],
225
- },
226
- {
227
- test: /\.(scss|sass)$/,
228
- use: [
229
- ...cssLoaders,
230
- {
231
- loader: 'sass-loader',
232
- options: {
233
- implementation: require('dart-sass'),
234
- },
235
- },
236
- ],
237
- },
238
- {
239
- test: /\.css$/,
240
- use: [...cssLoaders],
241
- },
242
- {
243
- test: /\.less$/,
244
- use: [
245
- ...cssLoaders,
246
- {
247
- loader: 'less-loader',
248
- options: {
249
- lessOptions: {
250
- modifyVars: themeVars,
251
- javascriptEnabled: true,
252
- },
253
- },
254
- },
255
- ],
256
- },
257
- {
258
- test: /\.(jpe?g|png|gif|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
259
- loader: 'base64-inline-loader',
260
- },
261
- ],
262
- },
263
- plugins,
264
- optimization: {
265
- concatenateModules: true,
266
- noEmitOnErrors: true,
267
- splitChunks: {
268
- maxSize: 3000000,
269
- cacheGroups: {
270
- base: {
271
- test: /(react|react-dom|react-router|react-router-dom|mobx|mobx-react-lite|@cloudbase\/js-sdk)/,
272
- chunks: 'all',
273
- minSize: 500000,
274
- priority: 100, // 优先级
275
- },
276
- utils: {
277
- test: /(lodash|dayjs|axios|kbone-api)/,
278
- chunks: 'all',
279
- priority: 100, // 优先级
280
- },
281
- 'async-commons': {
282
- chunks: 'async',
283
- minChunks: 2,
284
- priority: 20,
285
- },
286
- commons: {
287
- chunks: 'all',
288
- minChunks: 2,
289
- priority: 20,
290
- },
291
- },
292
- },
293
- minimizer: [
294
- new TerserPlugin({
295
- test: /\.js(\?.*)?$/i,
296
- cache: false,
297
- parallel: true,
298
- sourceMap: false,
299
- terserOptions: {
300
- safari10: true,
301
- },
302
- }),
303
- ],
304
- },
305
- };
306
- };