-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support module #422 #424
Changes from 2 commits
1747f4a
1731beb
8ad3d99
edf1a87
1d11bcd
72ec730
04b447c
62e0c8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
import jSXStylePlugin from '../index'; | ||
import syntaxJSX from 'babel-plugin-syntax-jsx'; | ||
import { transform } from 'babel-core'; | ||
import { mergeStylesFunctionString, getClassNameFunctionString, getStyleFunctionString } from '../constants'; | ||
|
||
function getTransfromCode(code, opts) { | ||
return transform(code, { | ||
plugins: [ | ||
[jSXStylePlugin, opts], | ||
syntaxJSX | ||
] | ||
}).code; | ||
} | ||
import getTransfromCode from '../getTransfromCode'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. transfrom -> transform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
||
describe('jsx style plugin', () => { | ||
it('transform only one className to style as member', () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import getTransfromCode from '../getTransfromCode'; | ||
|
||
describe('css module', () => { | ||
it('should transform css module', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ci 看下 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
expect(getTransfromCode(` | ||
import { createElement, render } from 'rax'; | ||
import styles from './app.css'; | ||
|
||
render(<div className={styles.header} />); | ||
`)).toBe(` | ||
import { createElement, render } from 'rax'; | ||
import styles from './app.css'; | ||
|
||
render(<div style={styles.header} />);`); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import syntaxJSX from 'babel-plugin-syntax-jsx'; | ||
import { transform } from 'babel-core'; | ||
import jSXStylePlugin from './index'; | ||
|
||
export default function getTransfromCode(code, opts) { | ||
return transform(code, { | ||
plugins: [ | ||
[jSXStylePlugin, opts], | ||
syntaxJSX | ||
] | ||
}).code; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个版本变化是啥操作。。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed