svgo-v2 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +294 -0
  3. package/bin/svgo +10 -0
  4. package/dist/svgo.browser.js +1 -0
  5. package/lib/css-tools.js +239 -0
  6. package/lib/parser.js +259 -0
  7. package/lib/path.js +347 -0
  8. package/lib/stringifier.js +326 -0
  9. package/lib/style.js +283 -0
  10. package/lib/svgo/coa.js +517 -0
  11. package/lib/svgo/config.js +138 -0
  12. package/lib/svgo/css-class-list.js +72 -0
  13. package/lib/svgo/css-select-adapter.d.ts +2 -0
  14. package/lib/svgo/css-select-adapter.js +120 -0
  15. package/lib/svgo/css-style-declaration.js +232 -0
  16. package/lib/svgo/jsAPI.d.ts +2 -0
  17. package/lib/svgo/jsAPI.js +443 -0
  18. package/lib/svgo/plugins.js +109 -0
  19. package/lib/svgo/tools.js +137 -0
  20. package/lib/svgo-node.js +106 -0
  21. package/lib/svgo.js +83 -0
  22. package/lib/types.ts +172 -0
  23. package/lib/xast.js +102 -0
  24. package/package.json +130 -0
  25. package/plugins/_applyTransforms.js +335 -0
  26. package/plugins/_collections.js +2168 -0
  27. package/plugins/_path.js +816 -0
  28. package/plugins/_transforms.js +379 -0
  29. package/plugins/addAttributesToSVGElement.js +87 -0
  30. package/plugins/addClassesToSVGElement.js +87 -0
  31. package/plugins/cleanupAttrs.js +55 -0
  32. package/plugins/cleanupEnableBackground.js +75 -0
  33. package/plugins/cleanupIDs.js +297 -0
  34. package/plugins/cleanupListOfValues.js +154 -0
  35. package/plugins/cleanupNumericValues.js +113 -0
  36. package/plugins/collapseGroups.js +135 -0
  37. package/plugins/convertColors.js +152 -0
  38. package/plugins/convertEllipseToCircle.js +39 -0
  39. package/plugins/convertPathData.js +1023 -0
  40. package/plugins/convertShapeToPath.js +175 -0
  41. package/plugins/convertStyleToAttrs.js +132 -0
  42. package/plugins/convertTransform.js +432 -0
  43. package/plugins/inlineStyles.js +379 -0
  44. package/plugins/mergePaths.js +104 -0
  45. package/plugins/mergeStyles.js +93 -0
  46. package/plugins/minifyStyles.js +148 -0
  47. package/plugins/moveElemsAttrsToGroup.js +130 -0
  48. package/plugins/moveGroupAttrsToElems.js +62 -0
  49. package/plugins/plugins.js +56 -0
  50. package/plugins/prefixIds.js +241 -0
  51. package/plugins/preset-default.js +80 -0
  52. package/plugins/removeAttributesBySelector.js +99 -0
  53. package/plugins/removeAttrs.js +159 -0
  54. package/plugins/removeComments.js +31 -0
  55. package/plugins/removeDesc.js +41 -0
  56. package/plugins/removeDimensions.js +43 -0
  57. package/plugins/removeDoctype.js +42 -0
  58. package/plugins/removeEditorsNSData.js +68 -0
  59. package/plugins/removeElementsByAttr.js +78 -0
  60. package/plugins/removeEmptyAttrs.js +33 -0
  61. package/plugins/removeEmptyContainers.js +58 -0
  62. package/plugins/removeEmptyText.js +57 -0
  63. package/plugins/removeHiddenElems.js +318 -0
  64. package/plugins/removeMetadata.js +29 -0
  65. package/plugins/removeNonInheritableGroupAttrs.js +38 -0
  66. package/plugins/removeOffCanvasPaths.js +138 -0
  67. package/plugins/removeRasterImages.js +33 -0
  68. package/plugins/removeScriptElement.js +29 -0
  69. package/plugins/removeStyleElement.js +29 -0
  70. package/plugins/removeTitle.js +29 -0
  71. package/plugins/removeUnknownsAndDefaults.js +218 -0
  72. package/plugins/removeUnusedNS.js +61 -0
  73. package/plugins/removeUselessDefs.js +65 -0
  74. package/plugins/removeUselessStrokeAndFill.js +144 -0
  75. package/plugins/removeViewBox.js +51 -0
  76. package/plugins/removeXMLNS.js +30 -0
  77. package/plugins/removeXMLProcInst.js +30 -0
  78. package/plugins/reusePaths.js +113 -0
  79. package/plugins/sortAttrs.js +113 -0
  80. package/plugins/sortDefsChildren.js +60 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Kir Belevich
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,294 @@
1
+ <div align="center">
2
+ <img src="./logo/logo-web.svg" width="348.61" height="100" alt="SVGO logo"/>
3
+ </div>
4
+
5
+ ## SVGO [![npm version](https://img.shields.io/npm/v/svgo)](https://npmjs.org/package/svgo) [![Discord](https://img.shields.io/discord/815166721315831868)](https://discord.gg/z8jX8NYxrE)
6
+
7
+ **SVG O**ptimizer is a Node.js-based tool for optimizing SVG vector graphics files.
8
+
9
+ ## Why?
10
+
11
+ SVG files, especially those exported from various editors, usually contain a lot of redundant and useless information. This can include editor metadata, comments, hidden elements, default or non-optimal values and other stuff that can be safely removed or converted without affecting the SVG rendering result.
12
+
13
+ ## Installation
14
+
15
+ ```sh
16
+ npm -g install svgo
17
+ ```
18
+
19
+ or
20
+
21
+ ```sh
22
+ yarn global add svgo
23
+ ```
24
+
25
+ ## CLI usage
26
+
27
+ ```sh
28
+ svgo one.svg two.svg -o one.min.svg two.min.svg
29
+ ```
30
+
31
+ Or use the `--folder`/`-f` flag to optimize a whole folder of SVG icons
32
+
33
+ ```sh
34
+ svgo -f ./path/to/folder/with/svg/files -o ./path/to/folder/with/svg/output
35
+ ```
36
+
37
+ See help for advanced usage
38
+
39
+ ```sh
40
+ svgo --help
41
+ ```
42
+
43
+ ## Configuration
44
+
45
+ Some options can be configured with CLI though it may be easier to have the configuration in a separate file.
46
+ SVGO automatically loads configuration from `svgo.config.js` or module specified with `--config` flag.
47
+
48
+ ```js
49
+ module.exports = {
50
+ multipass: true, // boolean. false by default
51
+ datauri: 'enc', // 'base64', 'enc' or 'unenc'. 'base64' by default
52
+ js2svg: {
53
+ indent: 2, // string with spaces or number of spaces. 4 by default
54
+ pretty: true, // boolean, false by default
55
+ },
56
+ };
57
+ ```
58
+
59
+ SVGO has a plugin-based architecture, so almost every optimization is a separate plugin.
60
+ There is a set of [built-in plugins](#built-in-plugins). See how to configure them:
61
+
62
+ ```js
63
+ module.exports = {
64
+ plugins: [
65
+ // enable a built-in plugin by name
66
+ 'prefixIds',
67
+
68
+ // or by expanded version
69
+ {
70
+ name: 'prefixIds',
71
+ },
72
+
73
+ // some plugins allow/require to pass options
74
+ {
75
+ name: 'prefixIds',
76
+ params: {
77
+ prefix: 'my-prefix',
78
+ },
79
+ },
80
+ ],
81
+ };
82
+ ```
83
+
84
+ The default preset of plugins is fully overridden if the `plugins` field is specified.
85
+ Use `preset-default` plugin to customize plugins options.
86
+
87
+ ```js
88
+ module.exports = {
89
+ plugins: [
90
+ {
91
+ name: 'preset-default',
92
+ params: {
93
+ overrides: {
94
+ // customize options for plugins included in preset
95
+ inlineStyles: {
96
+ onlyMatchedOnce: false,
97
+ },
98
+
99
+ // or disable plugins
100
+ removeDoctype: false,
101
+ },
102
+ },
103
+ },
104
+
105
+ // enable builtin plugin not included in default preset
106
+ 'prefixIds',
107
+
108
+ // enable and configure builtin plugin not included in preset
109
+ {
110
+ name: 'sortAttrs',
111
+ params: {
112
+ xmlnsOrder: 'alphabetical',
113
+ },
114
+ },
115
+ ],
116
+ };
117
+ ```
118
+
119
+ Default preset includes the following list of plugins:
120
+
121
+ - removeDoctype
122
+ - removeXMLProcInst
123
+ - removeComments
124
+ - removeMetadata
125
+ - removeEditorsNSData
126
+ - cleanupAttrs
127
+ - mergeStyles
128
+ - inlineStyles
129
+ - minifyStyles
130
+ - cleanupIDs
131
+ - removeUselessDefs
132
+ - cleanupNumericValues
133
+ - convertColors
134
+ - removeUnknownsAndDefaults
135
+ - removeNonInheritableGroupAttrs
136
+ - removeUselessStrokeAndFill
137
+ - removeViewBox
138
+ - cleanupEnableBackground
139
+ - removeHiddenElems
140
+ - removeEmptyText
141
+ - convertShapeToPath
142
+ - convertEllipseToCircle
143
+ - moveElemsAttrsToGroup
144
+ - moveGroupAttrsToElems
145
+ - collapseGroups
146
+ - convertPathData
147
+ - convertTransform
148
+ - removeEmptyAttrs
149
+ - removeEmptyContainers
150
+ - mergePaths
151
+ - removeUnusedNS
152
+ - sortDefsChildren
153
+ - removeTitle
154
+ - removeDesc
155
+
156
+ It's also possible to specify a custom plugin:
157
+
158
+ ```js
159
+ const anotherCustomPlugin = require('./another-custom-plugin.js');
160
+ module.exports = {
161
+ plugins: [
162
+ {
163
+ name: 'customPluginName',
164
+ type: 'perItem', // 'perItem', 'perItemReverse' or 'full'
165
+ params: {
166
+ optionName: 'optionValue',
167
+ },
168
+ fn: (ast, params, info) => {},
169
+ },
170
+ anotherCustomPlugin,
171
+ ],
172
+ };
173
+ ```
174
+
175
+ ## API usage
176
+
177
+ SVGO provides a few low level utilities.
178
+
179
+ ### optimize
180
+
181
+ The core of SVGO is `optimize` function.
182
+
183
+ ```js
184
+ const { optimize } = require('svgo');
185
+ const result = optimize(svgString, {
186
+ // optional but recommended field
187
+ path: 'path-to.svg',
188
+ // all config fields are also available here
189
+ multipass: true,
190
+ });
191
+ const optimizedSvgString = result.data;
192
+ ```
193
+
194
+ ### loadConfig
195
+
196
+ If you write a tool on top of SVGO you might need a way to load SVGO config.
197
+
198
+ ```js
199
+ const { loadConfig } = require('svgo');
200
+ const config = await loadConfig();
201
+
202
+ // you can also specify a relative or absolute path and customize the current working directory
203
+ const config = await loadConfig(configFile, cwd);
204
+ ```
205
+
206
+ ## Built-in plugins
207
+
208
+ | Plugin | Description | Default |
209
+ | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
210
+ | [cleanupAttrs](https://github.com/svg/svgo/blob/master/plugins/cleanupAttrs.js) | cleanup attributes from newlines, trailing, and repeating spaces | `enabled` |
211
+ | [mergeStyles](https://github.com/svg/svgo/blob/master/plugins/mergeStyles.js) | merge multiple style elements into one | `enabled` |
212
+ | [inlineStyles](https://github.com/svg/svgo/blob/master/plugins/inlineStyles.js) | move and merge styles from `<style>` elements to element `style` attributes | `enabled` |
213
+ | [removeDoctype](https://github.com/svg/svgo/blob/master/plugins/removeDoctype.js) | remove `doctype` declaration | `enabled` |
214
+ | [removeXMLProcInst](https://github.com/svg/svgo/blob/master/plugins/removeXMLProcInst.js) | remove XML processing instructions | `enabled` |
215
+ | [removeComments](https://github.com/svg/svgo/blob/master/plugins/removeComments.js) | remove comments | `enabled` |
216
+ | [removeMetadata](https://github.com/svg/svgo/blob/master/plugins/removeMetadata.js) | remove `<metadata>` | `enabled` |
217
+ | [removeTitle](https://github.com/svg/svgo/blob/master/plugins/removeTitle.js) | remove `<title>` | `enabled` |
218
+ | [removeDesc](https://github.com/svg/svgo/blob/master/plugins/removeDesc.js) | remove `<desc>` | `enabled` |
219
+ | [removeUselessDefs](https://github.com/svg/svgo/blob/master/plugins/removeUselessDefs.js) | remove elements of `<defs>` without `id` | `enabled` |
220
+ | [removeXMLNS](https://github.com/svg/svgo/blob/master/plugins/removeXMLNS.js) | removes the `xmlns` attribute (for inline SVG) | `disabled` |
221
+ | [removeEditorsNSData](https://github.com/svg/svgo/blob/master/plugins/removeEditorsNSData.js) | remove editors namespaces, elements, and attributes | `enabled` |
222
+ | [removeEmptyAttrs](https://github.com/svg/svgo/blob/master/plugins/removeEmptyAttrs.js) | remove empty attributes | `enabled` |
223
+ | [removeHiddenElems](https://github.com/svg/svgo/blob/master/plugins/removeHiddenElems.js) | remove hidden elements | `enabled` |
224
+ | [removeEmptyText](https://github.com/svg/svgo/blob/master/plugins/removeEmptyText.js) | remove empty Text elements | `enabled` |
225
+ | [removeEmptyContainers](https://github.com/svg/svgo/blob/master/plugins/removeEmptyContainers.js) | remove empty Container elements | `enabled` |
226
+ | [removeViewBox](https://github.com/svg/svgo/blob/master/plugins/removeViewBox.js) | remove `viewBox` attribute when possible | `enabled` |
227
+ | [cleanupEnableBackground](https://github.com/svg/svgo/blob/master/plugins/cleanupEnableBackground.js) | remove or cleanup `enable-background` attribute when possible | `enabled` |
228
+ | [minifyStyles](https://github.com/svg/svgo/blob/master/plugins/minifyStyles.js) | minify `<style>` elements content with [CSSO](https://github.com/css/csso) | `enabled` |
229
+ | [convertStyleToAttrs](https://github.com/svg/svgo/blob/master/plugins/convertStyleToAttrs.js) | convert styles into attributes | `disabled` |
230
+ | [convertColors](https://github.com/svg/svgo/blob/master/plugins/convertColors.js) | convert colors (from `rgb()` to `#rrggbb`, from `#rrggbb` to `#rgb`) | `enabled` |
231
+ | [convertPathData](https://github.com/svg/svgo/blob/master/plugins/convertPathData.js) | convert Path data to relative or absolute (whichever is shorter), convert one segment to another, trim useless delimiters, smart rounding, and much more | `enabled` |
232
+ | [convertTransform](https://github.com/svg/svgo/blob/master/plugins/convertTransform.js) | collapse multiple transforms into one, convert matrices to the short aliases, and much more | `enabled` |
233
+ | [removeUnknownsAndDefaults](https://github.com/svg/svgo/blob/master/plugins/removeUnknownsAndDefaults.js) | remove unknown elements content and attributes, remove attributes with default values | `enabled` |
234
+ | [removeNonInheritableGroupAttrs](https://github.com/svg/svgo/blob/master/plugins/removeNonInheritableGroupAttrs.js) | remove non-inheritable group's "presentation" attributes | `enabled` |
235
+ | [removeUselessStrokeAndFill](https://github.com/svg/svgo/blob/master/plugins/removeUselessStrokeAndFill.js) | remove useless `stroke` and `fill` attributes | `enabled` |
236
+ | [removeUnusedNS](https://github.com/svg/svgo/blob/master/plugins/removeUnusedNS.js) | remove unused namespaces declaration | `enabled` |
237
+ | [prefixIds](https://github.com/svg/svgo/blob/master/plugins/prefixIds.js) | prefix IDs and classes with the SVG filename or an arbitrary string | `disabled` |
238
+ | [cleanupIDs](https://github.com/svg/svgo/blob/master/plugins/cleanupIDs.js) | remove unused and minify used IDs | `enabled` |
239
+ | [cleanupNumericValues](https://github.com/svg/svgo/blob/master/plugins/cleanupNumericValues.js) | round numeric values to the fixed precision, remove default `px` units | `enabled` |
240
+ | [cleanupListOfValues](https://github.com/svg/svgo/blob/master/plugins/cleanupListOfValues.js) | round numeric values in attributes that take a list of numbers (like `viewBox` or `enable-background`) | `disabled` |
241
+ | [moveElemsAttrsToGroup](https://github.com/svg/svgo/blob/master/plugins/moveElemsAttrsToGroup.js) | move elements' attributes to their enclosing group | `enabled` |
242
+ | [moveGroupAttrsToElems](https://github.com/svg/svgo/blob/master/plugins/moveGroupAttrsToElems.js) | move some group attributes to the contained elements | `enabled` |
243
+ | [collapseGroups](https://github.com/svg/svgo/blob/master/plugins/collapseGroups.js) | collapse useless groups | `enabled` |
244
+ | [removeRasterImages](https://github.com/svg/svgo/blob/master/plugins/removeRasterImages.js) | remove raster images | `disabled` |
245
+ | [mergePaths](https://github.com/svg/svgo/blob/master/plugins/mergePaths.js) | merge multiple Paths into one | `enabled` |
246
+ | [convertShapeToPath](https://github.com/svg/svgo/blob/master/plugins/convertShapeToPath.js) | convert some basic shapes to `<path>` | `enabled` |
247
+ | [convertEllipseToCircle](https://github.com/svg/svgo/blob/master/plugins/convertEllipseToCircle.js) | convert non-eccentric `<ellipse>` to `<circle>` | `enabled` |
248
+ | [sortAttrs](https://github.com/svg/svgo/blob/master/plugins/sortAttrs.js) | sort element attributes for epic readability | `disabled` |
249
+ | [sortDefsChildren](https://github.com/svg/svgo/blob/master/plugins/sortDefsChildren.js) | sort children of `<defs>` in order to improve compression | `enabled` |
250
+ | [removeDimensions](https://github.com/svg/svgo/blob/master/plugins/removeDimensions.js) | remove `width`/`height` and add `viewBox` if it's missing (opposite to removeViewBox, disable it first) | `disabled` |
251
+ | [removeAttrs](https://github.com/svg/svgo/blob/master/plugins/removeAttrs.js) | remove attributes by pattern | `disabled` |
252
+ | [removeAttributesBySelector](https://github.com/svg/svgo/blob/master/plugins/removeAttributesBySelector.js) | removes attributes of elements that match a CSS selector | `disabled` |
253
+ | [removeElementsByAttr](https://github.com/svg/svgo/blob/master/plugins/removeElementsByAttr.js) | remove arbitrary elements by `ID` or `className` | `disabled` |
254
+ | [addClassesToSVGElement](https://github.com/svg/svgo/blob/master/plugins/addClassesToSVGElement.js) | add classnames to an outer `<svg>` element | `disabled` |
255
+ | [addAttributesToSVGElement](https://github.com/svg/svgo/blob/master/plugins/addAttributesToSVGElement.js) | adds attributes to an outer `<svg>` element | `disabled` |
256
+ | [removeOffCanvasPaths](https://github.com/svg/svgo/blob/master/plugins/removeOffCanvasPaths.js) | removes elements that are drawn outside of the viewbox | `disabled` |
257
+ | [removeStyleElement](https://github.com/svg/svgo/blob/master/plugins/removeStyleElement.js) | remove `<style>` elements | `disabled` |
258
+ | [removeScriptElement](https://github.com/svg/svgo/blob/master/plugins/removeScriptElement.js) | remove `<script>` elements | `disabled` |
259
+ | [reusePaths](https://github.com/svg/svgo/blob/master/plugins/reusePaths.js) | Find duplicated <path> elements and replace them with <use> links | `disabled` |
260
+
261
+ ## Other Ways to Use SVGO
262
+
263
+ - as a web app – [SVGOMG](https://jakearchibald.github.io/svgomg/)
264
+ - as a GitHub Action – [SVGO Action](https://github.com/marketplace/actions/svgo-action)
265
+ - as a Grunt task – [grunt-svgmin](https://github.com/sindresorhus/grunt-svgmin)
266
+ - as a Gulp task – [gulp-svgmin](https://github.com/ben-eb/gulp-svgmin)
267
+ - as a Mimosa module – [mimosa-minify-svg](https://github.com/dbashford/mimosa-minify-svg)
268
+ - as an OSX Folder Action – [svgo-osx-folder-action](https://github.com/svg/svgo-osx-folder-action)
269
+ - as a webpack loader – [image-webpack-loader](https://github.com/tcoopman/image-webpack-loader)
270
+ - as a Telegram Bot – [svgo_bot](https://github.com/maksugr/svgo_bot)
271
+ - as a PostCSS plugin – [postcss-svgo](https://github.com/ben-eb/postcss-svgo)
272
+ - as an Inkscape plugin – [inkscape-svgo](https://github.com/konsumer/inkscape-svgo)
273
+ - as a Sketch plugin - [svgo-compressor](https://github.com/BohemianCoding/svgo-compressor)
274
+ - as a macOS app - [Image Shrinker](https://image-shrinker.com)
275
+ - as a Rollup plugin - [rollup-plugin-svgo](https://github.com/porsager/rollup-plugin-svgo)
276
+ - as a VS Code plugin - [vscode-svgo](https://github.com/1000ch/vscode-svgo)
277
+ - as a Atom plugin - [atom-svgo](https://github.com/1000ch/atom-svgo)
278
+ - as a Sublime plugin - [Sublime-svgo](https://github.com/1000ch/Sublime-svgo)
279
+ - as a Figma plugin - [Advanced SVG Export](https://www.figma.com/c/plugin/782713260363070260/Advanced-SVG-Export)
280
+ - as a Linux app - [Oh My SVG](https://github.com/sonnyp/OhMySVG)
281
+ - as a Browser extension - [SVG Gobbler](https://github.com/rossmoody/svg-gobbler)
282
+ - as an API - [Vector Express](https://github.com/smidyo/vectorexpress-api#convertor-svgo)
283
+
284
+ ## Donators
285
+
286
+ | [<img src="https://sheetjs.com/sketch128.png" width="80">](https://sheetjs.com/) | [<img src="https://raw.githubusercontent.com/fontello/fontello/master/fontello-image.svg" width="80">](https://fontello.com/) |
287
+ | :------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------: |
288
+ | [SheetJS LLC](https://sheetjs.com/) | [Fontello](https://fontello.com/) |
289
+
290
+ ## License and Copyright
291
+
292
+ This software is released under the terms of the [MIT license](https://github.com/svg/svgo/blob/master/LICENSE).
293
+
294
+ Logo by [André Castillo](https://github.com/DerianAndre).
package/bin/svgo ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const colors = require('picocolors');
4
+ const { program } = require('commander');
5
+ const makeProgram = require('../lib/svgo/coa');
6
+ makeProgram(program);
7
+ program.parseAsync(process.argv).catch(error => {
8
+ console.error(colors.red(error.stack));
9
+ process.exit(1);
10
+ });