neo-cmp-cli 1.8.26 → 1.9.1

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.
@@ -0,0 +1,55 @@
1
+
2
+ /**
3
+ * 自定义组件 共享出来的依赖模块
4
+ * 备注:可在其他模块中通过 neoRequire 中使用
5
+ */
6
+ import { isPlainObject } from 'lodash';
7
+ const CustomCmpCommonModules = {
8
+ "entityFormC": require('/Users/liudan/neo-custom-widget/neo-cmp-cli/template/neo-custom-cmp-template/src/components/entityForm_c/index.tsx')
9
+ };
10
+ const CustomCmpRemoteDeps = {};
11
+
12
+ // 用于添加共享的依赖模块
13
+ const addNeoCommonModules = (modules) => {
14
+ if (!window.__NeoCommonModules) {
15
+ window.__NeoCommonModules = {}
16
+ }
17
+ if (isPlainObject(modules)) {
18
+ const moduleIds = Object.keys(modules)
19
+ moduleIds.forEach((moduleId) => {
20
+ const curModule = modules[moduleId];
21
+ const curCommonModule = window.__NeoCommonModules[moduleId];
22
+
23
+ if (curCommonModule && Object.keys(curCommonModule).length < 3) {
24
+ window.__NeoCommonModules[moduleId] = Object.assign(window.__NeoCommonModules[moduleId], curModule);
25
+
26
+ // 处理模块中的特殊属性
27
+ if (curModule.__esModule !== undefined) {
28
+ window.__NeoCommonModules[moduleId].__esModule = curModule.__esModule;
29
+ }
30
+ if (curModule.default !== undefined) {
31
+ window.__NeoCommonModules[moduleId].default = curModule.default;
32
+ }
33
+ } else {
34
+ window.__NeoCommonModules[moduleId] = curModule;
35
+ }
36
+ })
37
+ }
38
+ }
39
+
40
+ // 用于添加自定义组件的远程依赖组件(关联使用)
41
+ const addNeoRemoteDeps = (remoteDeps) => {
42
+ if (!window.__NeoCommonModules) {
43
+ window.__NeoCommonModules = {}
44
+ }
45
+ if (!window.__NeoCommonModules.__neoRemoteDeps) {
46
+ window.__NeoCommonModules.__neoRemoteDeps = {}
47
+ }
48
+ if (isPlainObject(remoteDeps)) {
49
+ window.__NeoCommonModules.__neoRemoteDeps = Object.assign(window.__NeoCommonModules.__neoRemoteDeps, remoteDeps)
50
+ }
51
+ }
52
+
53
+ addNeoCommonModules(CustomCmpCommonModules);
54
+ addNeoRemoteDeps(CustomCmpRemoteDeps);
55
+