webpack的启动是通过dora服务器来完成的?
服务器启动了就会启动webpack开始编译,这个编译和我们的wcf这个tool有关系,因为dora-webpack-plugin会通过wcf来获取通用的配置!然后通过这个配置来开启webpack编译过程
### 如果是demo页面,在dora-plugin-antd中,我们会为meta添加id
metaid = metafilename;
如果是demo页面,我们会将content切割为zh-CN,en-US两部分
if chineseIntroStart > -1 markdownDatacontent = 'zh-CN': contentChildren 'en-US': contentChildren ; else markdownDatacontent = contentChildren;
为markdownData添加highlightedCode和preview属性,其中highlightedCode就是pre标签的属性和code标签内容,preview就是将pre标签下的code标签内的lib包下的组件引用转化到mdw/components文件夹下
if sourceCodeObjectisES6 //if we are in jsx syntax markdownDatahighlightedCode = contentChildrencodeIndex; //codeIndex is pre tag with jsx attribute, so here we will get pre attribute and code tag markdownDatapreview = utils; else const requireString = `require('!!babel!!')`; markdownDatahighlightedCode = __BISHENG_EMBEDED_CODE: true code: `.highlightedCode` ; markdownDatapreview = __BISHENG_EMBEDED_CODE: true code: `.preview` ;
previews如下:
'use strict'; const path = ;const pkgPath = path;const pkgName = name;//Name of our projectconst componentsPath = path;//utils.getPreview(sourceCodeObject.code);,sourceCode is content of code tagexports { const preview = 'pre' lang: '__react' ; preview; //In code tag of pre with jsx attribute of demo page, we change lib/mdw to cwd/components //because our react components are all placed in components folder. return preview;};
TypeScript的处理已经被删除了,dora-plugin-antd/lib/loader/watch删除了。添加style、highlightedStyle属性
const styleNode = ; if markdownDatastyle = JsonML0; else if styleNode const styleTag = contentChildren0; markdownDatastyle = + styleTag ? JsonML0 : ''; markdownDatahighlightedStyle = JsonMLhighlighted;
如果meta中指定了src,那么我们需要生产demo的html页面,同时将src指定到markdownData上,这里也指定了将jsonml转化为code代码并推送到html页面中
if metaiframe const html = nunjucks; const fileName = `demo-.html`; fs; markdownDatasrc = path; //src
如果URL中不含有demo,那么我们就是经过process-doc处理,处理方式如下:
module { const contentChildren = JsonML; const apiStartIndex = contentChildren; //get h2 tag with label of API. Previous is content and latter is API if apiStartIndex > -1 const content = contentChildren; markdownDatacontent = 'section'; const api = contentChildren; markdownDataapi = 'section'; return markdownData;};
下面将jsonml转化为可视化的元素
converters: JsonML && { const children = JsonML; //get h1-h6 tag`s content const sluggedId = ; //generate id, for example 'when to use' will be replaced with "when-to-use" return React; }