neo-cmp-cli 1.5.1 → 1.5.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/README.md +52 -15
- package/package.json +1 -1
- package/src/cmpUtils/createCmpByTemplate.js +52 -0
- package/src/cmpUtils/createCommonModulesCode.js +15 -15
- package/src/cmpUtils/{getCmpModelRegister.js → getCmpModelRegisterCode.js} +2 -2
- package/src/cmpUtils/{getCmpPreview.js → getCmpPreviewCode.js} +2 -2
- package/src/cmpUtils/{getCmpRegister.js → getCmpRegisterCode.js} +2 -2
- package/src/cmpUtils/getCmpTypeByDir.js +41 -0
- package/src/cmpUtils/hasCmpTypeByDir.js +11 -0
- package/src/{module → cmpUtils}/previewCmp.js +2 -2
- package/src/cmpUtils/{publishCmp.js → pushCmp.js} +54 -42
- package/src/config/default.config.js +14 -2
- package/src/module/index.js +144 -21
- package/src/module/main.js +17 -13
- package/src/module/neoInit.js +3 -0
- package/src/module/neoInitByCopy.js +3 -0
- package/src/neo/NeoUMDContent.js +29 -0
- package/src/neo/neoRequire.js +7 -7
- package/src/neo/neoService.js +174 -72
- package/src/neo/wrapperContent.js +2 -1
- package/src/oss/publish2oss.js +1 -1
- package/src/plugins/AddNeoRequirePlugin.js +5 -2
- package/src/projectUtils/createCmpProjectByTemplate.js +49 -0
- package/src/{cmpUtils → projectUtils}/getEntriesWithAutoRegister.js +4 -4
- package/src/template/antd-custom-cmp-template/README.md +2 -2
- package/src/template/antd-custom-cmp-template/neo.config.js +22 -14
- package/src/template/antd-custom-cmp-template/package.json +3 -3
- package/src/template/develop/neo-custom-cmp-template/neo.config.js +1 -1
- package/src/template/echarts-custom-cmp-template/README.md +2 -2
- package/src/template/echarts-custom-cmp-template/neo.config.js +19 -13
- package/src/template/echarts-custom-cmp-template/package.json +3 -3
- package/src/template/empty-cmp/index.tsx +51 -0
- package/src/template/empty-cmp/model.ts +77 -0
- package/src/template/empty-cmp/style.scss +72 -0
- package/src/template/empty-custom-cmp-template/.prettierrc.js +12 -0
- package/src/template/empty-custom-cmp-template/README.md +45 -0
- package/src/template/empty-custom-cmp-template/commitlint.config.js +59 -0
- package/src/template/empty-custom-cmp-template/neo.config.js +126 -0
- package/src/template/empty-custom-cmp-template/package.json +57 -0
- package/src/template/empty-custom-cmp-template/public/css/base.css +283 -0
- package/src/template/empty-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/src/template/empty-custom-cmp-template/public/template.html +13 -0
- package/src/template/empty-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/src/template/empty-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/src/template/empty-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/src/template/empty-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/src/template/empty-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/src/template/empty-custom-cmp-template/src/assets/img/map.svg +1 -0
- package/src/template/empty-custom-cmp-template/src/components/README.md +3 -0
- package/src/template/empty-custom-cmp-template/tsconfig.json +68 -0
- package/src/template/neo-custom-cmp-template/README.md +2 -2
- package/src/template/neo-custom-cmp-template/neo.config.js +6 -26
- package/src/template/neo-custom-cmp-template/package.json +3 -4
- package/src/template/react-custom-cmp-template/README.md +2 -2
- package/src/template/react-custom-cmp-template/neo.config.js +20 -15
- package/src/template/react-custom-cmp-template/package.json +3 -3
- package/src/template/react-ts-custom-cmp-template/README.md +2 -2
- package/src/template/react-ts-custom-cmp-template/neo.config.js +19 -14
- package/src/template/react-ts-custom-cmp-template/package.json +3 -3
- package/src/template/vue2-custom-cmp-template/README.md +2 -2
- package/src/template/vue2-custom-cmp-template/neo.config.js +20 -15
- package/src/template/vue2-custom-cmp-template/package.json +3 -3
- package/src/utils/autoEntryRootDir.js +75 -0
- package/src/utils/replaceInFilesByMap.js +54 -0
- package/test/demo.js +2 -2
- package/src/template/neo-custom-cmp-template/auth.config.js +0 -12
- /package/src/{cmpUtils → projectUtils}/getEntries.js +0 -0
- /package/src/{cmpUtils → projectUtils}/updatePublishLog.js +0 -0
package/src/module/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const inspect = require('./inspect.js'); // 输出当前项目配置文件
|
|
|
9
9
|
const neoConfigInit = require('../utils/neoConfigInit.js');
|
|
10
10
|
const { validateProjectName } = require('../utils/projectNameValidator.js');
|
|
11
11
|
const mainAction = require('./main.js'); // 入口文件
|
|
12
|
+
const getCmpTypeByDir = require('../cmpUtils/getCmpTypeByDir.js');
|
|
12
13
|
|
|
13
14
|
// neo 的 package 文件
|
|
14
15
|
const neoPackage = require('../../package.json');
|
|
@@ -151,6 +152,81 @@ yargs
|
|
|
151
152
|
neoConfigInit('neo.config.js');
|
|
152
153
|
}
|
|
153
154
|
)
|
|
155
|
+
.command(
|
|
156
|
+
'createProject [options]',
|
|
157
|
+
'创建自定义组件项目(含工程代码)',
|
|
158
|
+
(yargs) => {
|
|
159
|
+
yargs
|
|
160
|
+
.reset()
|
|
161
|
+
.usage(titleTip('Usage') + ': $0 preview [options]')
|
|
162
|
+
.option('name', {
|
|
163
|
+
alias: 'n',
|
|
164
|
+
describe: '自定义组件项目名称'
|
|
165
|
+
})
|
|
166
|
+
.alias('h', 'help');
|
|
167
|
+
},
|
|
168
|
+
(argv) => {
|
|
169
|
+
if (argv.name) {
|
|
170
|
+
mainAction.createCmpProjectByTemplate(argv.name);
|
|
171
|
+
} else {
|
|
172
|
+
const questions = [{
|
|
173
|
+
name: 'name',
|
|
174
|
+
type: 'input',
|
|
175
|
+
message: '请设置自定义组件项目名称:',
|
|
176
|
+
}];
|
|
177
|
+
|
|
178
|
+
inquirer.prompt(questions).then((ans) => {
|
|
179
|
+
// 验证项目名称是否合法
|
|
180
|
+
const { isValid, errors } = validateProjectName(ans.name);
|
|
181
|
+
if (!isValid) {
|
|
182
|
+
console.error(errors.join('\n'));
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!ans.name) {
|
|
187
|
+
console.error(errors.join('\n'));
|
|
188
|
+
process.exit(1);
|
|
189
|
+
} else {
|
|
190
|
+
mainAction.createCmpProjectByTemplate(ans.name);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
.command(
|
|
197
|
+
'createCmp [options]',
|
|
198
|
+
'创建自定义组件',
|
|
199
|
+
(yargs) => {
|
|
200
|
+
yargs
|
|
201
|
+
.reset()
|
|
202
|
+
.usage(titleTip('Usage') + ': $0 preview [options]')
|
|
203
|
+
.option('name', {
|
|
204
|
+
alias: 'n',
|
|
205
|
+
describe: '自定义组件名称'
|
|
206
|
+
})
|
|
207
|
+
.alias('h', 'help');
|
|
208
|
+
},
|
|
209
|
+
(argv) => {
|
|
210
|
+
if (argv.name) {
|
|
211
|
+
mainAction.createCmpByTemplate(argv.name);
|
|
212
|
+
} else {
|
|
213
|
+
const questions = [{
|
|
214
|
+
name: 'name',
|
|
215
|
+
type: 'input',
|
|
216
|
+
message: '请设置自定义组件名称:',
|
|
217
|
+
}];
|
|
218
|
+
|
|
219
|
+
inquirer.prompt(questions).then((ans) => {
|
|
220
|
+
if (!ans.name) {
|
|
221
|
+
console.error('自定义组件名称不能为空。');
|
|
222
|
+
process.exit(1);
|
|
223
|
+
} else {
|
|
224
|
+
mainAction.createCmpByTemplate(ans.name);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
)
|
|
154
230
|
.command(
|
|
155
231
|
'preview [options]',
|
|
156
232
|
'预览指定自定义组件(仅预览组件本身内容)',
|
|
@@ -158,26 +234,36 @@ yargs
|
|
|
158
234
|
yargs
|
|
159
235
|
.reset()
|
|
160
236
|
.usage(titleTip('Usage') + ': $0 preview [options]')
|
|
161
|
-
.option('
|
|
162
|
-
alias: '
|
|
163
|
-
describe: '
|
|
237
|
+
.option('name', {
|
|
238
|
+
alias: 'n',
|
|
239
|
+
describe: '自定义组件名称'
|
|
164
240
|
})
|
|
165
241
|
.alias('h', 'help');
|
|
166
242
|
},
|
|
167
243
|
(argv) => {
|
|
168
|
-
if (argv.
|
|
169
|
-
mainAction.previewCmp(argv.
|
|
244
|
+
if (argv.name) {
|
|
245
|
+
mainAction.previewCmp(argv.name);
|
|
170
246
|
} else {
|
|
247
|
+
const cmpTypes = getCmpTypeByDir();
|
|
248
|
+
if (cmpTypes.length === 0) {
|
|
249
|
+
console.error('当前自定义组件目录中未找到自定义组件。(./src/components 目录下)');
|
|
250
|
+
process.exit(1);
|
|
251
|
+
}
|
|
252
|
+
const cmpTypeChoices = cmpTypes.map((cmpType) => ({
|
|
253
|
+
name: cmpType,
|
|
254
|
+
value: cmpType
|
|
255
|
+
}));
|
|
171
256
|
const questions = [
|
|
172
257
|
{
|
|
173
258
|
name: 'cmpType',
|
|
174
|
-
type: '
|
|
175
|
-
message: '
|
|
259
|
+
type: 'list',
|
|
260
|
+
message: '请选择要预览的自定义组件:',
|
|
261
|
+
choices: cmpTypeChoices
|
|
176
262
|
}
|
|
177
263
|
];
|
|
178
264
|
inquirer.prompt(questions).then((ans) => {
|
|
179
265
|
if (!ans.cmpType) {
|
|
180
|
-
console.error('
|
|
266
|
+
console.error('未选择要预览的自定义组件。');
|
|
181
267
|
process.exit(1);
|
|
182
268
|
}
|
|
183
269
|
mainAction.previewCmp(ans.cmpType);
|
|
@@ -244,46 +330,83 @@ yargs
|
|
|
244
330
|
yargs
|
|
245
331
|
.reset()
|
|
246
332
|
.usage(titleTip('Usage') + ': $0 publish2oss [options]')
|
|
247
|
-
.option('
|
|
248
|
-
alias: '
|
|
333
|
+
.option('name', {
|
|
334
|
+
alias: 'n',
|
|
249
335
|
describe: '自定义组件名称'
|
|
250
336
|
})
|
|
251
337
|
.alias('h', 'help');
|
|
252
338
|
},
|
|
253
339
|
(argv) => {
|
|
254
|
-
|
|
340
|
+
if (argv.name) {
|
|
341
|
+
mainAction.publish2oss(argv.name); // 构建并发布脚本到oss
|
|
342
|
+
} else {
|
|
343
|
+
const cmpTypes = getCmpTypeByDir();
|
|
344
|
+
if (cmpTypes.length === 0) {
|
|
345
|
+
console.error('当前自定义组件目录中未找到自定义组件。(./src/components 目录下)');
|
|
346
|
+
process.exit(1);
|
|
347
|
+
}
|
|
348
|
+
const cmpTypeChoices = cmpTypes.map((cmpType) => ({
|
|
349
|
+
name: cmpType,
|
|
350
|
+
value: cmpType
|
|
351
|
+
}));
|
|
352
|
+
const questions = [
|
|
353
|
+
{
|
|
354
|
+
name: 'cmpType',
|
|
355
|
+
type: 'list',
|
|
356
|
+
message: '请选择要发布的自定义组件:',
|
|
357
|
+
choices: cmpTypeChoices
|
|
358
|
+
}
|
|
359
|
+
];
|
|
360
|
+
inquirer.prompt(questions).then((ans) => {
|
|
361
|
+
if (!ans.cmpType) {
|
|
362
|
+
console.error('未选择要发布的自定义组件。');
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
mainAction.publish2oss(ans.cmpType);
|
|
366
|
+
});
|
|
367
|
+
}
|
|
255
368
|
}
|
|
256
369
|
)
|
|
257
370
|
.command(
|
|
258
|
-
'
|
|
371
|
+
'pushCmp [options]',
|
|
259
372
|
'发布组件到 NeoCRM 平台',
|
|
260
373
|
(yargs) => {
|
|
261
374
|
yargs
|
|
262
375
|
.reset()
|
|
263
|
-
.usage(titleTip('Usage') + ': $0
|
|
264
|
-
.option('
|
|
265
|
-
alias: '
|
|
376
|
+
.usage(titleTip('Usage') + ': $0 pushCmp [options]')
|
|
377
|
+
.option('name', {
|
|
378
|
+
alias: 'n',
|
|
266
379
|
describe: '自定义组件名称'
|
|
267
380
|
})
|
|
268
381
|
.alias('h', 'help');
|
|
269
382
|
},
|
|
270
383
|
(argv) => {
|
|
271
|
-
if (argv.
|
|
272
|
-
mainAction.
|
|
384
|
+
if (argv.name) {
|
|
385
|
+
mainAction.pushCmp(argv.name); // 构建并发布组件到 NeoCRM
|
|
273
386
|
} else {
|
|
387
|
+
const cmpTypes = getCmpTypeByDir();
|
|
388
|
+
if (cmpTypes.length === 0) {
|
|
389
|
+
console.error('当前自定义组件目录中未找到自定义组件。(./src/components 目录下)');
|
|
390
|
+
process.exit(1);
|
|
391
|
+
}
|
|
392
|
+
const cmpTypeChoices = cmpTypes.map((cmpType) => ({
|
|
393
|
+
name: cmpType,
|
|
394
|
+
value: cmpType
|
|
395
|
+
}));
|
|
274
396
|
const questions = [
|
|
275
397
|
{
|
|
276
398
|
name: 'cmpType',
|
|
277
|
-
type: '
|
|
278
|
-
message: '
|
|
399
|
+
type: 'list',
|
|
400
|
+
message: '请选择要发布的自定义组件:',
|
|
401
|
+
choices: cmpTypeChoices
|
|
279
402
|
}
|
|
280
403
|
];
|
|
281
404
|
inquirer.prompt(questions).then((ans) => {
|
|
282
405
|
if (!ans.cmpType) {
|
|
283
|
-
console.error('
|
|
406
|
+
console.error('未选择要发布的自定义组件。');
|
|
284
407
|
process.exit(1);
|
|
285
408
|
}
|
|
286
|
-
mainAction.
|
|
409
|
+
mainAction.pushCmp(ans.cmpType);
|
|
287
410
|
});
|
|
288
411
|
}
|
|
289
412
|
}
|
package/src/module/main.js
CHANGED
|
@@ -7,14 +7,16 @@ const neoConfigInit = require('../utils/neoConfigInit.js');
|
|
|
7
7
|
const { consoleTag } = require('../utils/neoParams');
|
|
8
8
|
const curConfig = require('../config/index'); // 获取当前项目根目录下的配置文件
|
|
9
9
|
const publish2oss = require('../oss/publish2oss');
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
const pushCmp = require('../cmpUtils/pushCmp');
|
|
11
|
+
const previewCmp = require('../cmpUtils/previewCmp');
|
|
12
|
+
const getEntries = require('../projectUtils/getEntries');
|
|
13
|
+
const getEntriesWithAutoRegister = require('../projectUtils/getEntriesWithAutoRegister');
|
|
14
14
|
const AddNeoRequirePlugin = require('../plugins/AddNeoRequirePlugin');
|
|
15
15
|
const { getExternalsByNeoCommonModules } = require('../neo/neoRequire');
|
|
16
16
|
// const { MFPlugins } = require('../neo/webpack.mf');
|
|
17
17
|
const createCommonModulesCode = require('../cmpUtils/createCommonModulesCode');
|
|
18
|
+
const createCmpByTemplate = require('../cmpUtils/createCmpByTemplate');
|
|
19
|
+
const createCmpProjectByTemplate = require('../projectUtils/createCmpProjectByTemplate');
|
|
18
20
|
|
|
19
21
|
const getValue = (originValue, defaultValue) => {
|
|
20
22
|
return originValue !== undefined ? originValue : defaultValue;
|
|
@@ -29,6 +31,8 @@ module.exports = {
|
|
|
29
31
|
neoInitByCopy,
|
|
30
32
|
inspect,
|
|
31
33
|
neoConfigInit,
|
|
34
|
+
createCmpProjectByTemplate,
|
|
35
|
+
createCmpByTemplate,
|
|
32
36
|
dev: () => {
|
|
33
37
|
if (!curConfig.dev) {
|
|
34
38
|
console.error('未找到 dev 相关配置。');
|
|
@@ -272,10 +276,10 @@ module.exports = {
|
|
|
272
276
|
});
|
|
273
277
|
},
|
|
274
278
|
// 发布组件到 NeoCRM 平台
|
|
275
|
-
|
|
276
|
-
// 将
|
|
277
|
-
const
|
|
278
|
-
curConfig.build2lib = Object.assign(curConfig.build2lib,
|
|
279
|
+
pushCmp: (cmpType) => {
|
|
280
|
+
// 将 pushCmp 相关配置设置给 build2lib
|
|
281
|
+
const pushCmpConfig = curConfig.pushCmp;
|
|
282
|
+
curConfig.build2lib = Object.assign(curConfig.build2lib, pushCmpConfig);
|
|
279
283
|
|
|
280
284
|
const curEntry = curConfig.build2lib.entry;
|
|
281
285
|
let curCmpTypes = [];
|
|
@@ -315,7 +319,7 @@ module.exports = {
|
|
|
315
319
|
/*
|
|
316
320
|
// 说明:自定义组件和平台模块联邦使用异常,所以暂时注释掉
|
|
317
321
|
// 添加模块联邦插件
|
|
318
|
-
if (curConfig.
|
|
322
|
+
if (curConfig.pushCmp.enableMF) {
|
|
319
323
|
curConfig.webpack.plugins.push(...MFPlugins);
|
|
320
324
|
}
|
|
321
325
|
*/
|
|
@@ -326,9 +330,9 @@ module.exports = {
|
|
|
326
330
|
curConfig.webpack.plugins &&
|
|
327
331
|
Array.isArray(curConfig.webpack.plugins)
|
|
328
332
|
) {
|
|
329
|
-
curConfig.webpack.plugins.push(new AddNeoRequirePlugin(
|
|
333
|
+
curConfig.webpack.plugins.push(new AddNeoRequirePlugin());
|
|
330
334
|
} else {
|
|
331
|
-
curConfig.webpack.plugins = [new AddNeoRequirePlugin(
|
|
335
|
+
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
332
336
|
}
|
|
333
337
|
|
|
334
338
|
// 添加 内置 Neo 的 externals 配置
|
|
@@ -355,8 +359,8 @@ module.exports = {
|
|
|
355
359
|
}
|
|
356
360
|
|
|
357
361
|
akfun.build('lib', curConfig, consoleTag, () => {
|
|
358
|
-
// 构建完成后,执行
|
|
359
|
-
|
|
362
|
+
// 构建完成后,执行 pushCmp
|
|
363
|
+
pushCmp(pushCmpConfig, cmpType);
|
|
360
364
|
});
|
|
361
365
|
},
|
|
362
366
|
build2esm: (fileName) => akfun.build2esm(fileName, curConfig, consoleTag) // 构建esm输出模块
|
package/src/module/neoInit.js
CHANGED
|
@@ -2,6 +2,7 @@ const { gitClone } = require('akfun');
|
|
|
2
2
|
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
3
3
|
const { replaceInPackage } = require('../utils/replaceInPackage');
|
|
4
4
|
const { resetPackageVersion } = require('../utils/resetPackageVersion');
|
|
5
|
+
const autoEntryRootDir = require('../utils/autoEntryRootDir');
|
|
5
6
|
|
|
6
7
|
const templateList = {
|
|
7
8
|
react: {
|
|
@@ -43,6 +44,8 @@ const neoInit = function (type, projectName) {
|
|
|
43
44
|
replaceInPackage(finalProjectPath, 'wibetter', 'xxx');
|
|
44
45
|
replaceInPackage(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
45
46
|
resetPackageVersion(finalProjectPath);
|
|
47
|
+
// 自动切换到项目根目录
|
|
48
|
+
autoEntryRootDir(finalProjectPath);
|
|
46
49
|
},
|
|
47
50
|
consoleTag
|
|
48
51
|
);
|
|
@@ -3,6 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
4
4
|
const { replaceInPackage } = require('../utils/replaceInPackage');
|
|
5
5
|
const { resetPackageVersion } = require('../utils/resetPackageVersion');
|
|
6
|
+
const autoEntryRootDir = require('../utils/autoEntryRootDir');
|
|
6
7
|
|
|
7
8
|
const templateList = {
|
|
8
9
|
react: {
|
|
@@ -50,6 +51,8 @@ const neoInitByCopy = function (type, projectName) {
|
|
|
50
51
|
resetPackageVersion(finalProjectPath);
|
|
51
52
|
|
|
52
53
|
console.log(`${consoleTag}已创建自定义组件(${finalProjectName})!`);
|
|
54
|
+
// 自动切换到项目根目录
|
|
55
|
+
autoEntryRootDir(finalProjectPath);
|
|
53
56
|
})
|
|
54
57
|
.catch((err) => console.error(`${consoleTag}自定义组件模板下载失败:`, err));
|
|
55
58
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 内置 UMD 模块,用于在 Node cli 端加载自定义组件模型
|
|
3
|
+
* 特别说明:这个文件内容会通过 AddNeoRequirePlugin 插入的构建代码中。
|
|
4
|
+
*/
|
|
5
|
+
(function (root, factory) {
|
|
6
|
+
// AMD 环境检测
|
|
7
|
+
if (typeof define === 'function' && define.amd) {
|
|
8
|
+
define([], factory);
|
|
9
|
+
}
|
|
10
|
+
// CommonJS 环境检测
|
|
11
|
+
else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
|
12
|
+
module.exports = factory();
|
|
13
|
+
}
|
|
14
|
+
// 浏览器全局变量
|
|
15
|
+
else {
|
|
16
|
+
root.NeoCustomCmpModel = factory();
|
|
17
|
+
}
|
|
18
|
+
}(typeof self !== 'undefined' ? self : this, function () {
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
const getCustomModels = (cmpType) => {
|
|
22
|
+
// 自定义组件模型列表
|
|
23
|
+
const NEOEditorCustomModels = window.NEOEditorCustomModels || {};
|
|
24
|
+
return NEOEditorCustomModels[cmpType] || {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 导出模块
|
|
28
|
+
return getCustomModels;
|
|
29
|
+
}));
|
package/src/neo/neoRequire.js
CHANGED
|
@@ -67,16 +67,16 @@ const addNeoCommonModules = (modules) => {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
const
|
|
70
|
+
// 用于添加自定义组件的远程依赖组件
|
|
71
|
+
const addNeoRemoteDeps = (remoteDeps) => {
|
|
72
72
|
if (!window.__NeoCommonModules) {
|
|
73
73
|
window.__NeoCommonModules = {}
|
|
74
74
|
}
|
|
75
|
-
if (!window.__NeoCommonModules.
|
|
76
|
-
window.__NeoCommonModules.
|
|
75
|
+
if (!window.__NeoCommonModules.__neoRemoteDeps) {
|
|
76
|
+
window.__NeoCommonModules.__neoRemoteDeps = {}
|
|
77
77
|
}
|
|
78
|
-
if (_.isPlainObject(
|
|
79
|
-
window.__NeoCommonModules.
|
|
78
|
+
if (_.isPlainObject(remoteDeps)) {
|
|
79
|
+
window.__NeoCommonModules.__neoRemoteDeps = Object.assign(window.__NeoCommonModules.__neoRemoteDeps, remoteDeps);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -110,6 +110,6 @@ const neoRequire = (moduleName) => {
|
|
|
110
110
|
module.exports = {
|
|
111
111
|
initNeoRequire,
|
|
112
112
|
addNeoCommonModules,
|
|
113
|
-
|
|
113
|
+
addNeoRemoteDeps,
|
|
114
114
|
getExternalsByNeoCommonModules
|
|
115
115
|
};
|