@cloudbase/framework-plugin-low-code 0.7.2 → 0.7.5
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.
package/lib/utils/dataSource.js
CHANGED
|
@@ -142,7 +142,7 @@ function _generateDynamicDataset(dataset) {
|
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
let jsExp = (0, util_1.generateDataBind)(bind);
|
|
145
|
-
processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (\n${jsExp}\n)${config_1.REPLACE_SIGN}`;
|
|
145
|
+
processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (\n${jsExp || 'undefined'}\n)${config_1.REPLACE_SIGN}`;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
config.initMethod.params = processed;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
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",
|
|
@@ -30,6 +30,14 @@ function createGlboalApi() {
|
|
|
30
30
|
getConfig: function () {
|
|
31
31
|
return <%= appConfig %>;
|
|
32
32
|
},
|
|
33
|
+
resolveStaticResourceUrl(staticUrl) {
|
|
34
|
+
if (/^\//.test(staticUrl)) {
|
|
35
|
+
const domain = globalAPI?.__internal__?.getConfig?.()?.staticResourceDomain || globalAPI?.domain || ''
|
|
36
|
+
const url = `https://${domain}${staticUrl}`;
|
|
37
|
+
return url;
|
|
38
|
+
}
|
|
39
|
+
return staticUrl;
|
|
40
|
+
}
|
|
33
41
|
},
|
|
34
42
|
dataSources: DS_SDK,
|
|
35
43
|
pages: {},
|
|
@@ -56,7 +64,7 @@ function createGlboalApi() {
|
|
|
56
64
|
}
|
|
57
65
|
},
|
|
58
66
|
invoke(params) {
|
|
59
|
-
return app.activePage.invokeComponentMethod(params)
|
|
67
|
+
return app.__internal__.activePage.invokeComponentMethod(params)
|
|
60
68
|
},
|
|
61
69
|
utils: {
|
|
62
70
|
formatDate,
|
|
@@ -34,6 +34,14 @@ function createGlboalApi() {
|
|
|
34
34
|
getConfig: function () {
|
|
35
35
|
return <%= appConfig %>;
|
|
36
36
|
},
|
|
37
|
+
resolveStaticResourceUrl(staticUrl) {
|
|
38
|
+
if (/^\//.test(staticUrl)) {
|
|
39
|
+
const domain = globalAPI?.__internal__?.getConfig?.()?.staticResourceDomain || globalAPI?.domain || ''
|
|
40
|
+
const url = `https://${domain}${staticUrl}`;
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
return staticUrl;
|
|
44
|
+
}
|
|
37
45
|
},
|
|
38
46
|
formActions: {},
|
|
39
47
|
pages: {},
|
|
@@ -141,12 +141,8 @@ export function resolveComponentProps(props, isPlainProps) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export function getStaticResourceAttribute(staticUrl) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const url = `https://${domain}${staticUrl}`;
|
|
147
|
-
return url;
|
|
148
|
-
}
|
|
149
|
-
return staticUrl;
|
|
144
|
+
const { __internal__ = {} } = window.app || {};
|
|
145
|
+
return __internal__?.resolveStaticResourceUrl?.(staticUrl) || staticUrl
|
|
150
146
|
}
|
|
151
147
|
|
|
152
148
|
export function findLoginPage(app = window.app) {
|
|
@@ -16,7 +16,6 @@ module.exports = function (options) {
|
|
|
16
16
|
context,
|
|
17
17
|
entry,
|
|
18
18
|
output,
|
|
19
|
-
mode,
|
|
20
19
|
watch,
|
|
21
20
|
externals,
|
|
22
21
|
resolveModules,
|
|
@@ -27,7 +26,6 @@ module.exports = function (options) {
|
|
|
27
26
|
definePlugin = {},
|
|
28
27
|
devtool = false,
|
|
29
28
|
} = options;
|
|
30
|
-
const isDevelopment = mode !== 'production';
|
|
31
29
|
|
|
32
30
|
const babelLoader = {
|
|
33
31
|
loader: 'babel-loader',
|
|
@@ -139,22 +137,16 @@ module.exports = function (options) {
|
|
|
139
137
|
},
|
|
140
138
|
],
|
|
141
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
|
+
}),
|
|
142
149
|
];
|
|
143
|
-
if (isDevelopment) {
|
|
144
|
-
plugins.concat([new HardSourceWebpackPlugin()]);
|
|
145
|
-
} else {
|
|
146
|
-
plugins = plugins.concat([
|
|
147
|
-
new webpack.HashedModuleIdsPlugin({
|
|
148
|
-
hashFunction: 'sha256',
|
|
149
|
-
hashDigest: 'hex',
|
|
150
|
-
hashDigestLength: 20,
|
|
151
|
-
}),
|
|
152
|
-
new webpack.EnvironmentPlugin({
|
|
153
|
-
SSR: false,
|
|
154
|
-
WEBPACK_ENV: 'production',
|
|
155
|
-
}),
|
|
156
|
-
]);
|
|
157
|
-
}
|
|
158
150
|
|
|
159
151
|
const cssLoaders = [
|
|
160
152
|
MiniCssExtractPlugin.loader,
|
|
@@ -188,7 +180,10 @@ module.exports = function (options) {
|
|
|
188
180
|
return {
|
|
189
181
|
context,
|
|
190
182
|
entry,
|
|
191
|
-
|
|
183
|
+
/**
|
|
184
|
+
* 只要是构建都开启 production 以使用精简
|
|
185
|
+
*/
|
|
186
|
+
mode: 'production',
|
|
192
187
|
watch,
|
|
193
188
|
output,
|
|
194
189
|
externals,
|
|
@@ -266,12 +261,12 @@ module.exports = function (options) {
|
|
|
266
261
|
concatenateModules: true,
|
|
267
262
|
noEmitOnErrors: true,
|
|
268
263
|
splitChunks: {
|
|
269
|
-
maxSize:
|
|
264
|
+
maxSize: 3000000,
|
|
270
265
|
cacheGroups: {
|
|
271
266
|
base: {
|
|
272
267
|
test: /(react|react-dom|react-router|react-router-dom|mobx|mobx-react-lite|@cloudbase\/js-sdk)/,
|
|
273
268
|
chunks: 'all',
|
|
274
|
-
minSize:
|
|
269
|
+
minSize: 500000,
|
|
275
270
|
priority: 100, // 优先级
|
|
276
271
|
},
|
|
277
272
|
utils: {
|
|
@@ -291,25 +286,17 @@ module.exports = function (options) {
|
|
|
291
286
|
},
|
|
292
287
|
},
|
|
293
288
|
},
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
parallel: true,
|
|
306
|
-
sourceMap: false,
|
|
307
|
-
terserOptions: {
|
|
308
|
-
safari10: true,
|
|
309
|
-
},
|
|
310
|
-
}),
|
|
311
|
-
],
|
|
312
|
-
}),
|
|
289
|
+
minimizer: [
|
|
290
|
+
new TerserPlugin({
|
|
291
|
+
test: /\.js(\?.*)?$/i,
|
|
292
|
+
cache: false,
|
|
293
|
+
parallel: true,
|
|
294
|
+
sourceMap: false,
|
|
295
|
+
terserOptions: {
|
|
296
|
+
safari10: true,
|
|
297
|
+
},
|
|
298
|
+
}),
|
|
299
|
+
],
|
|
313
300
|
},
|
|
314
301
|
};
|
|
315
302
|
};
|