neo-cmp-cli 1.2.0 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -66,15 +66,25 @@ const addNeoCommonModules = (modules) => {
66
66
  window.__NeoCommonModules = {}
67
67
  }
68
68
  if (isPlainObject(modules)) {
69
- const moduleIds = Object.keys(modules);
69
+ const moduleIds = Object.keys(modules)
70
70
  moduleIds.forEach((moduleId) => {
71
71
  const curModule = modules[moduleId];
72
- if (window.__NeoCommonModules[moduleId]) {
72
+ const curCommonModule = window.__NeoCommonModules[moduleId];
73
+
74
+ if (curCommonModule && Object.keys(curCommonModule).length < 3) {
73
75
  window.__NeoCommonModules[moduleId] = Object.assign(window.__NeoCommonModules[moduleId], curModule);
76
+
77
+ // 处理模块中的特殊属性
78
+ if (curModule.__esModule !== undefined) {
79
+ window.__NeoCommonModules[moduleId].__esModule = curModule.__esModule;
80
+ }
81
+ if (curModule.default !== undefined) {
82
+ window.__NeoCommonModules[moduleId].default = curModule.default;
83
+ }
74
84
  } else {
75
- window.__NeoCommonModules[moduleId] = curModule;
85
+ window.__NeoCommonModules[moduleId] = curModule
76
86
  }
77
- });
87
+ })
78
88
  }
79
89
  }
80
90
 
@@ -13,7 +13,7 @@ const getEntriesWithAutoRegister = require('../cmpUtils/getEntriesWithAutoRegist
13
13
  const previewCmp = require('./previewCmp');
14
14
  const AddNeoRequirePlugin = require('../plugins/AddNeoRequirePlugin');
15
15
  const { getExternalsByNeoCommonModules } = require('../neo/neoRequire');
16
- // const { MFPlugins } = require('../utils/webpack.mf');
16
+ // const { MFPlugins } = require('../neo/webpack.mf');
17
17
  const createCommonModulesCode = require('../cmpUtils/createCommonModulesCode');
18
18
 
19
19
  const getValue = (originValue, defaultValue) => {
@@ -254,9 +254,10 @@ module.exports = {
254
254
  // 所有入口文件添加 commonModulesFile
255
255
  if (commonModulesFilePath && curConfig.build2lib.entry) {
256
256
  Object.keys(curConfig.build2lib.entry).forEach((name) => {
257
- curConfig.build2lib.entry[name] = [commonModulesFilePath].concat(
258
- curConfig.build2lib.entry[name]
259
- );
257
+ // 判断不是以Model结尾的文件
258
+ if (!name.endsWith('Model')) {
259
+ curConfig.build2lib.entry[name] = [commonModulesFilePath].concat(curConfig.build2lib.entry[name]);
260
+ }
260
261
  });
261
262
  }
262
263
 
@@ -43,15 +43,25 @@ const addNeoCommonModules = (modules) => {
43
43
  window.__NeoCommonModules = {}
44
44
  }
45
45
  if (isPlainObject(modules)) {
46
- const moduleIds = Object.keys(modules);
46
+ const moduleIds = Object.keys(modules)
47
47
  moduleIds.forEach((moduleId) => {
48
48
  const curModule = modules[moduleId];
49
- if (window.__NeoCommonModules[moduleId]) {
49
+ const curCommonModule = window.__NeoCommonModules[moduleId];
50
+
51
+ if (curCommonModule && Object.keys(curCommonModule).length < 3) {
50
52
  window.__NeoCommonModules[moduleId] = Object.assign(window.__NeoCommonModules[moduleId], curModule);
53
+
54
+ // 处理模块中的特殊属性
55
+ if (curModule.__esModule !== undefined) {
56
+ window.__NeoCommonModules[moduleId].__esModule = curModule.__esModule;
57
+ }
58
+ if (curModule.default !== undefined) {
59
+ window.__NeoCommonModules[moduleId].default = curModule.default;
60
+ }
51
61
  } else {
52
- window.__NeoCommonModules[moduleId] = curModule;
62
+ window.__NeoCommonModules[moduleId] = curModule
53
63
  }
54
- });
64
+ })
55
65
  }
56
66
  }
57
67
 
@@ -39,14 +39,12 @@ module.exports = {
39
39
  // babelPlugins: [],
40
40
  },
41
41
  // 用于添加 Neo 共享依赖模块和剔除模块
42
- /*
43
42
  neoCommonModule: {
44
43
  // neoExports: ['xxModule'], // 自定义组件 共享出来的模块,支持数组和对象形式
45
44
  // neoExports: { 'xxModule': path.resolve('./src/components/xxModule') }, // 对象写法
46
45
  neoExternals: ['chart-widget'], // 自定义组件中需要剔除的模块,仅支持数组写法
47
46
  remotes: ['chart-widget'], // 远程组件,表示当前自定义组件会用到的远程组件,需要和 neoExternals 配合使用
48
47
  },
49
- */
50
48
  preview: {
51
49
  // 用于开启本地预览模式的相关配置信息
52
50
  /*
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-custom-cmp-template",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "neo自定义组件模板(react&ts技术栈)",
5
5
  "keywords": [
6
6
  "自定义组件模板",
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.2.0",
50
+ "neo-cmp-cli": "^1.2.2",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -39,7 +39,7 @@ module.exports = {
39
39
  // babelPlugins: [],
40
40
  },
41
41
  // 用于添加 Neo 共享依赖模块的配置信息
42
- /*
42
+ ///*
43
43
  neoCommonModule: {
44
44
  // neoExports: ['xxModule'], // 自定义组件 共享出来的模块,支持数组和对象形式
45
45
  neoExports: { // 对象写法
@@ -49,7 +49,7 @@ module.exports = {
49
49
  // neoExternals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
50
50
  // remotes: ['xxModule'], // 远程组件,表示当前自定义组件会用到的远程组件,需要和 neoExternals 配合使用
51
51
  },
52
- */
52
+ //*/
53
53
  preview: {
54
54
  // 用于开启本地预览模式的相关配置信息
55
55
  /*
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echarts-custom-cmp-template",
3
- "version": "1.1.3",
3
+ "version": "1.1.18",
4
4
  "description": "neo自定义组件模板(react&ts技术栈)",
5
5
  "keywords": [
6
6
  "自定义组件模板",
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.2.0",
50
+ "neo-cmp-cli": "^1.2.2",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5",
@@ -48,7 +48,7 @@
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
50
  "@types/axios": "^0.14.0",
51
- "neo-cmp-cli": "^1.2.0",
51
+ "neo-cmp-cli": "^1.2.2",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@commitlint/cli": "^8.3.5",
46
46
  "@commitlint/config-conventional": "^9.1.1",
47
- "neo-cmp-cli": "^1.2.0",
47
+ "neo-cmp-cli": "^1.2.2",
48
48
  "husky": "^4.2.5",
49
49
  "lint-staged": "^10.2.9",
50
50
  "prettier": "^2.0.5"
@@ -46,7 +46,7 @@
46
46
  "@commitlint/config-conventional": "^9.1.1",
47
47
  "@types/react": "^16.9.11",
48
48
  "@types/react-dom": "^16.9.15",
49
- "neo-cmp-cli": "^1.2.0",
49
+ "neo-cmp-cli": "^1.2.2",
50
50
  "husky": "^4.2.5",
51
51
  "lint-staged": "^10.2.9",
52
52
  "prettier": "^2.0.5"
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@commitlint/cli": "^8.3.5",
46
46
  "@commitlint/config-conventional": "^9.1.1",
47
- "neo-cmp-cli": "^1.2.0",
47
+ "neo-cmp-cli": "^1.2.2",
48
48
  "husky": "^4.2.5",
49
49
  "lint-staged": "^10.2.9",
50
50
  "prettier": "^2.0.5",
File without changes