File tree Expand file tree Collapse file tree 5 files changed +12
-19
lines changed Expand file tree Collapse file tree 5 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ language: node_js
22os :
33 - linux
44node_js :
5+ - " 15"
6+ - " 14"
7+ - " 12"
58 - " 10"
6- - " 9"
7- - " 8"
8- - " 6"
9+ - " 10.13"
910before_install :
1011 - ' nvm install-latest-npm'
1112script :
Original file line number Diff line number Diff line change 5050 "@babel/parser" : " ^7.0.0" ,
5151 "lodash.isplainobject" : " ^4.0.6" ,
5252 "resolve" : " ^1.20.0" ,
53- "svgo" : " ^0.7.2"
53+ "svgo" : " ^2.0.0"
54+ },
55+ "engines" : {
56+ "node" : " >=10.13"
5457 }
5558}
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ export default function escapeBraces(raw) {
77 // <style> .class1 {} .class2{}</style>
88 // to
99 // <style> .class1 {`{`}{`}`} .class2{`{`}{`}`}</style>
10- return raw . replace ( / ( \{ | \} ) / g, '{`$1`}' ) ;
10+ return { ... raw , data : raw . data . replace ( / ( \{ | \} ) / g, '{`$1`}' ) } ;
1111}
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export default declare(({
7575
7676 const escapeSvgSource = escapeBraces ( optimizedSource ) ;
7777
78- const parsedSvgAst = parse ( escapeSvgSource , {
78+ const parsedSvgAst = parse ( escapeSvgSource . data , {
7979 sourceType : 'module' ,
8080 plugins : [ 'jsx' ] ,
8181 } ) ;
Original file line number Diff line number Diff line change 11// validates svgo opts
22// to contain minimal set of plugins that will strip some stuff
33// for the babylon JSX parser to work
4- import Svgo from 'svgo' ;
4+ import * as SVGO from 'svgo' ;
55import isPlainObject from 'lodash.isplainobject' ;
66
77const essentialPlugins = [ 'removeDoctype' , 'removeComments' ] ;
@@ -54,17 +54,6 @@ function validateAndFix(opts) {
5454
5555export default function optimize ( content , opts = { } ) {
5656 validateAndFix ( opts ) ;
57- const svgo = new Svgo ( opts ) ;
5857
59- // Svgo isn't _really_ async, so let's do it this way:
60- let returnValue ;
61- svgo . optimize ( content , ( response ) => {
62- if ( response . error ) {
63- returnValue = response . error ;
64- } else {
65- returnValue = response . data ;
66- }
67- } ) ;
68-
69- return returnValue ;
58+ return SVGO . optimize ( content , opts ) ;
7059}
You can’t perform that action at this time.
0 commit comments