File tree Expand file tree Collapse file tree
babel-plugin-transform-svg-component/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 },
1717 "devDependencies" : {
1818 "@babel/cli" : " ^7.1.5" ,
19- "@babel/core" : " ^7.1.5 " ,
20- "@babel/generator" : " ^7.1.5 " ,
19+ "@babel/core" : " ^7.1.6 " ,
20+ "@babel/generator" : " ^7.1.6 " ,
2121 "@babel/node" : " ^7.0.0" ,
2222 "@babel/plugin-proposal-class-properties" : " ^7.1.0" ,
23- "@babel/preset-env" : " ^7.1.5" ,
23+ "@babel/plugin-syntax-typescript" : " ^7.1.5" ,
24+ "@babel/preset-env" : " ^7.1.6" ,
2425 "babel-core" : " ^7.0.0-bridge.0" ,
2526 "babel-eslint" : " ^10.0.1" ,
2627 "babel-jest" : " ^23.6.0" ,
3435 "jest" : " ^23.6.0" ,
3536 "lerna" : " ^3.4.3" ,
3637 "react" : " ^16.6.3" ,
37- "rehype-parse" : " ^5 .0.0" ,
38- "unified" : " ^7.0.1 " ,
38+ "rehype-parse" : " ^6 .0.0" ,
39+ "unified" : " ^7.0.2 " ,
3940 "vfile" : " ^3.0.1"
4041 }
4142}
Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ export default SvgComponent;"
4141
4242const MyComponent = () => <svg><div /></svg>;
4343
44+ export default MyComponent;"
45+ ` )
46+ } )
47+
48+ it ( 'should support custom typescript template' , ( ) => {
49+ const { code } = testPlugin ( '<svg><div /></svg>' , {
50+ template : ( { template } , opts , { jsx } ) => {
51+ const typescriptTemplate = template . smart ( { plugins : [ 'typescript' ] } )
52+ return typescriptTemplate . ast `
53+ import * as React from 'react';
54+ const MyComponent = (props: React.SVGProps<SVGSVGElement>) => ${ jsx } ;
55+ export default MyComponent;
56+ `
57+ } ,
58+ state : { componentName : 'SvgComponent' } ,
59+ } )
60+ expect ( code ) . toMatchInlineSnapshot ( `
61+ "import * as React from 'react';
62+
63+ const MyComponent = (props: React.SVGProps<SVGSVGElement>) => <svg><div /></svg>;
64+
4465export default MyComponent;"
4566` )
4667 } )
Original file line number Diff line number Diff line change 3333 "camelcase" : " ^5.0.0" ,
3434 "chalk" : " ^2.4.1" ,
3535 "commander" : " ^2.19.0" ,
36- "dashify" : " ^1 .0.0" ,
36+ "dashify" : " ^2 .0.0" ,
3737 "glob" : " ^7.1.3" ,
3838 "output-file-sync" : " ^2.0.1" ,
3939 "recursive-readdir" : " ^2.2.2"
Original file line number Diff line number Diff line change 2626 "prepublishOnly" : " yarn run build"
2727 },
2828 "dependencies" : {
29- "@babel/types" : " ^7.1.5 "
29+ "@babel/types" : " ^7.1.6 "
3030 }
3131}
Original file line number Diff line number Diff line change 2121 "prepublishOnly" : " yarn run build"
2222 },
2323 "dependencies" : {
24- "@babel/core" : " ^7.1.5 " ,
24+ "@babel/core" : " ^7.1.6 " ,
2525 "@svgr/babel-preset" : " ^4.0.3" ,
2626 "@svgr/hast-util-to-babel-ast" : " ^4.0.3" ,
27- "rehype-parse" : " ^5 .0.0" ,
28- "unified" : " ^7.0.1 " ,
27+ "rehype-parse" : " ^6 .0.0" ,
28+ "unified" : " ^7.0.2 " ,
2929 "vfile" : " ^3.0.1"
3030 }
3131}
Original file line number Diff line number Diff line change 2525 "prepublishOnly" : " yarn run build"
2626 },
2727 "dependencies" : {
28- "@babel/core" : " ^7.1.5 " ,
28+ "@babel/core" : " ^7.1.6 " ,
2929 "@babel/plugin-transform-react-constant-elements" : " ^7.0.0" ,
30- "@babel/preset-env" : " ^7.1.5 " ,
30+ "@babel/preset-env" : " ^7.1.6 " ,
3131 "@babel/preset-react" : " ^7.0.0" ,
3232 "@svgr/core" : " ^4.0.3" ,
3333 "@svgr/plugin-jsx" : " ^4.0.3" ,
3434 "@svgr/plugin-svgo" : " ^4.0.3" ,
3535 "rollup-pluginutils" : " ^2.3.3"
3636 },
3737 "devDependencies" : {
38- "rollup" : " ^0.67.1 " ,
38+ "rollup" : " ^0.67.3 " ,
3939 "rollup-plugin-image" : " ^1.0.2" ,
4040 "rollup-plugin-url" : " ^2.0.1"
4141 }
Original file line number Diff line number Diff line change 2525 "prepublishOnly" : " yarn run build"
2626 },
2727 "dependencies" : {
28- "@babel/core" : " ^7.1.5 " ,
28+ "@babel/core" : " ^7.1.6 " ,
2929 "@babel/plugin-transform-react-constant-elements" : " ^7.0.0" ,
30- "@babel/preset-env" : " ^7.1.5 " ,
30+ "@babel/preset-env" : " ^7.1.6 " ,
3131 "@babel/preset-react" : " ^7.0.0" ,
3232 "@svgr/core" : " ^4.0.3" ,
3333 "@svgr/plugin-jsx" : " ^4.0.3" ,
3838 "babel-loader" : " ^8.0.4" ,
3939 "memory-fs" : " ^0.4.1" ,
4040 "url-loader" : " ^1.1.2" ,
41- "webpack" : " ^4.24 .0"
41+ "webpack" : " ^4.26 .0"
4242 }
4343}
You can’t perform that action at this time.
0 commit comments