@easyv/react-component-builder 0.20.0 → 0.21.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.
|
@@ -187,6 +187,36 @@ module.exports = function (content, map, meta) {
|
|
|
187
187
|
callback(error);
|
|
188
188
|
return true;
|
|
189
189
|
}
|
|
190
|
+
/----------- common assets start -------------/
|
|
191
|
+
let commonAssets;
|
|
192
|
+
try {
|
|
193
|
+
let dataJsonFile = fs.existsSync(
|
|
194
|
+
path.join(configPath, name + '.common.assets.json'),
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
if (dataJsonFile) {
|
|
198
|
+
commonAssets = JSON.parse(
|
|
199
|
+
fs.readFileSync(
|
|
200
|
+
path.resolve(configPath, name + '.common.assets.json'),
|
|
201
|
+
{ encoding: 'utf8' },
|
|
202
|
+
),
|
|
203
|
+
);
|
|
204
|
+
} else {
|
|
205
|
+
delete require.cache[
|
|
206
|
+
require.resolve(path.resolve(configPath, name + '.common.assets.js'))
|
|
207
|
+
];
|
|
208
|
+
commonAssets = require(path.resolve(
|
|
209
|
+
configPath,
|
|
210
|
+
name + '.common.assets.js',
|
|
211
|
+
)).default;
|
|
212
|
+
}
|
|
213
|
+
} catch (error) {
|
|
214
|
+
// 公共资源配置非必填,若不存在可跳过
|
|
215
|
+
// error.message += ` in ${configPath}${name}.common.assets.json or ${configPath}${name}.common.assets.js`;
|
|
216
|
+
// callback(error);
|
|
217
|
+
}
|
|
218
|
+
/----------- common assets end -------------/
|
|
219
|
+
|
|
190
220
|
|
|
191
221
|
if (names.has(config.base.module_name)) {
|
|
192
222
|
callback(
|
|
@@ -201,6 +231,7 @@ module.exports = function (content, map, meta) {
|
|
|
201
231
|
if (name === 'main') {
|
|
202
232
|
main.config = config;
|
|
203
233
|
main.data = data;
|
|
234
|
+
main.commonAssets = commonAssets;
|
|
204
235
|
return;
|
|
205
236
|
}
|
|
206
237
|
const id = Math.random().toString(16).slice(2);
|
|
@@ -344,6 +375,10 @@ module.exports = function (content, map, meta) {
|
|
|
344
375
|
};
|
|
345
376
|
mainConfig.configuration.unshift(chart);
|
|
346
377
|
}
|
|
378
|
+
// 公共资源配置
|
|
379
|
+
if (main.commonAssets && Array.isArray(main.commonAssets)) {
|
|
380
|
+
mainConfig.commonAssets = main.commonAssets
|
|
381
|
+
}
|
|
347
382
|
|
|
348
383
|
// 子组件排序,有配置项则以chilren排序,否则以文件顺序排序
|
|
349
384
|
if (mainConfig.children) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyv/react-component-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"launcher",
|
|
6
6
|
"templates",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@babel/core": "7.9.0",
|
|
21
21
|
"@babel/register": "^7.10.4",
|
|
22
22
|
"@easyv/react-gui": "1.6.6",
|
|
23
|
-
"@easyv/simulator": "0.5.
|
|
23
|
+
"@easyv/simulator": "0.5.3",
|
|
24
24
|
"@svgr/webpack": "8.1.0",
|
|
25
25
|
"acorn": "^7.3.1",
|
|
26
26
|
"acorn-jsx": "^5.2.0",
|
|
@@ -73,4 +73,4 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"registry": "https://registry.npmjs.org/"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|