-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"use strict"; | ||
module.exports = require('./lib/index.js'); | ||
module.exports = require('./lib/jsx-runtime.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import render from './render'; | ||
import jsx from './jsx'; | ||
import Fragment from './fragment'; | ||
import jsx from './jsx-classic'; | ||
|
||
export { | ||
render, | ||
Fragment, | ||
jsx, | ||
jsx as jsxs | ||
}; | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { batch2hd, extendArray, isFunction } from './util'; | ||
|
||
// 实现jsx-classic 入口 | ||
export default function(type: string | Function, props: any, ...children: any[]) { | ||
props = props || {}; | ||
if (isFunction(type)) { | ||
// f2组件,需要在外部实例化 | ||
// @ts-ignore | ||
if (type.prototype && type.prototype.isF2Component) { | ||
return { | ||
type, | ||
props, | ||
key: props.key, | ||
}; | ||
} | ||
// 如果是方法,直接执行,生成G的定义树 | ||
// @ts-ignore | ||
return type(props); | ||
} | ||
|
||
const { style, attrs, key } = props; | ||
|
||
return { | ||
type, | ||
props, | ||
key, | ||
style: batch2hd(style) || {}, | ||
attrs: batch2hd(attrs), | ||
children: extendArray(children), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import jsx from './jsx-automatic'; | ||
import Fragment from './fragment'; | ||
|
||
export { | ||
Fragment, | ||
jsx, | ||
jsx as jsxs | ||
}; |