[TOC]
* * * * *
# 1 配置目录(config\\)
~~~
inferno-master\config\
DOM.js ;jsdom配置
index.html ;测试结果显示页面
karma.conf.js ;karma测试配置
mocha.opts ;mocha测试配置
rollup.config.js ;rollup打包配置
webpack.dev.conf.js ;webpack测试打包配置
~~~
# 2 配置功能
> 包含框架的测试,构建等配置文件。
# 3 框架模块组织
~~~
config\rollup.config.js
......
;框架模块组织(7个模块)
;Inferno,InfernoDOM,InfernoServer
;InfernoComponent,InfernoTestUtils
;InfernoCreateElement,InfernoRouter
const bundles = [
{
moduleGlobal: 'Inferno',
moduleName: 'inferno',
moduleEntry: 'packages/inferno/src/index.js'
},
{
moduleGlobal: 'InfernoDOM',
moduleName: 'inferno-dom',
moduleEntry: 'packages/inferno-dom/src/index.js'
},
{
moduleGlobal: 'InfernoServer',
moduleName: 'inferno-server',
moduleEntry: 'packages/inferno-server/src/index.js'
},
{
moduleGlobal: 'InfernoComponent',
moduleName: 'inferno-component',
moduleEntry: 'packages/inferno-component/src/index.js'
},
{
moduleGlobal: 'InfernoTestUtils',
moduleName: 'inferno-test-utils',
moduleEntry: 'packages/inferno-test-utils/src/index.js'
},
{
moduleGlobal: 'InfernoCreateElement',
moduleName: 'inferno-create-element',
moduleEntry: 'packages/inferno-create-element/src/index.js'
},
{
moduleGlobal: 'InfernoRouter',
moduleName: 'inferno-router',
moduleEntry: 'packages/inferno-router/src/index.js'
}
];
......
;打包过程
;根据上面框架模块配置
;打包输出到packages/inferno/dis/moduleName/xx.js
function createBundle({moduleGlobal, moduleName, moduleEntry}) {
const copyright =
'/*!\n' +
' * ' + moduleName + ' v' + pack.version + '\n' +
' * (c) ' + new Date().getFullYear() + ' ' + pack.author.name + '\n' +
' * Released under the ' + pack.license + ' License.\n' +
' */';
const entry = p.resolve(moduleEntry);
const dest = p.resolve(`packages/inferno/dist/${ moduleName }.${ process.env.NODE_ENV === 'production' ? 'min.js' : 'js' }`);
const bundleConfig = {
dest,
format: 'umd',
moduleName: moduleGlobal,
globals: {
moduleGlobal: moduleGlobal
},
banner: copyright,
sourceMap: false
};
return rollup({entry, plugins}).then(({write}) => write(bundleConfig)).catch(err => {
console.log(err)
});
}
......
~~~
- 框架概述
- 框架目录
- 总目录(inferno-master)
- 配置目录(config)
- 示例目录(examples)
- 包目录(packages)
- 源代码目录(src)
- 工具目录(tools)
- 其他文件
- 框架结构
- (0)依赖关系
- (1)Inferno模块
- (2)InfernoDOM模块
- (3)InfernoServer模块
- (4)InfernoComponent模块
- (5)InfernoTestUtils模块
- (6)InfernoCreateElement模块
- (7)InfernoRouter模块
- 框架实现
- (1)Router
- (2)Redux
- (3)Component
- (4)CreateElement
- (5)Core(Vnode)
- (6)Dom(Render)
- (7)Server
- (8)TestUtils
- (9)Utils
- 框架流程
- 框架示例
- 框架更新
- 基础原理
- 框架总结