fengdie-ast-analysis
v0.2.2
Published
fengdie static analysis.
Downloads
4
Readme
Usage
const { analyze } = require('fengdie-ast-analysis');
const start = new Date();
const result = analyze({
sourcePath: '../Demo',
outputFile: './.ast-info.json', // optional, default is ./ast-info.json
});
const { injectComponent } = require('fengdie-ast-analysis');
const result = injectComponent({
filePath: resolve(__dirname, './fixtures/pages/index.js'),
component: {
name: 'ByeBye',
filePath: resolve(__dirname, './fixtures/components/ByeBye.js'),
},
});
console.log(result);
/*
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import { FengdieContainer as MyContainer } from 'fengdie-component';
import Hello from '../components/Hello';
import Bye from '../components/Bye';
import Normal from '../components/Normal';
import ByeBye from '../components/ByeBye.js'; // added here
function App() {
return (
<div>
<MyContainer>
<Hello />
<Bye />
<Normal />
<ByeBye /> {// add here //}
</MyContainer>
</div>
);
}
ReactDOM.render(<App />, document.getElementById('root'));
*/
TODO
- [x] 支持 default import
- [x] 支持 fengdie component 参数表达式
- [x] multiple fengdie containers/components warning
- [ ] 增加 ignore 配置
- [x] add component inject