preact源码分析:入口代码
先分析一下代码结构,选取重要的源码进行阅读
版本
此次阅读的源码版本为 v10.6.2
,此版本为线上较新的版本
结构
.
├── cjs.js
├── clone-element.js
├── component.js
├── constants.js
├── create-context.js
├── create-element.js
├── diff
│ ├── catch-error.js
│ ├── children.js
│ ├── index.js
│ └── props.js
├── index.d.ts
├── index.js
├── internal.d.ts
├── jsx.d.ts
├── options.js
├── render.js
└── util.js
重点入口文件
.
├── component.js
├── create-element.js
├── index.js
└── render.js
index.js
export { render, hydrate } from './render';
export {
createElement,
createElement as h,
Fragment,
createRef,
isValidElement
} from './create-element';
export { Component } from './component';
export { cloneElement } from './clone-element';
export { createContext } from './create-context';
export { toChildArray } from './diff/children';
export { default as options } from './options';