1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00
Commit Graph

1243 Commits

Author SHA1 Message Date
7a4217db4b Replace fs-extra with del 2021-02-16 19:51:05 +03:00
2236d0fd60 Upgrade mocha and refactor cli tests with async/await 2021-02-16 19:45:25 +03:00
d761decc0e Drop --enable and --disable flags 2021-02-16 19:17:53 +03:00
fd5e6406b1 Upgrade css-select 2021-02-16 19:14:20 +03:00
a6f14018ee Implement loadConfig utility (#1328)
Ref https://github.com/svg/svgo/issues/1327

Config file now can only be js. `svgo.config.js` is searched by default.
Otherwise any js module specified in `--config` cli flag.

Config loader is exposed in entry point as `loadConfig(configFile, cwd)`.
2021-02-16 19:11:13 +03:00
d273b26605 Provide es module bundle for browser (#1326)
The was a lot of requests to provide browser compatible module. In this
diff I added `svgo/dist/svgo.browser.js` bundle and tested it with
playwright.
2021-02-16 19:11:01 +03:00
70d1f2b2f8 Upgrade css-tree and csso 2021-02-16 18:14:10 +03:00
b1dafc6780 Implement default plugins and plugins list extending 2021-02-15 22:20:05 +03:00
c9c7871e0d Simplify svgo api (#1325)
Dropped SVGO class and provided "optimize" function with svg and config
as inputs and "createContentItem".
2021-02-15 18:32:50 +03:00
225bfbb053 Move config processing into optimize 2021-02-15 16:57:01 +03:00
1b776ffea5 Simplify plugins configuration (#1324)
- replaced named plugin object with "name" field
- dropped support for params in plugin object; use only params to pass plugin options
- dropped support for "boolean plugins"; use active field instead

```diff
-{
-  pluginName: {
-    fn,
-    params: {},
-    ...params
-  }
-}
+{
+  name: 'pluginName',
+  fn,
+  params: {}
+}
```
2021-02-15 14:30:09 +03:00
6cecd76f62 Remove config extending and full flag support 2021-02-15 13:12:29 +03:00
2965e8ccdb Drop plugin by path support and load builtins statically 2021-02-15 12:00:45 +03:00
8899f682b8 Remove coverage imports from tests 2021-02-15 02:41:28 +03:00
a1c1b7f443 Remove json string as --config value support 2021-02-14 17:44:18 +03:00
cb14e3c0b3 Upgrade commander 2021-02-14 17:35:05 +03:00
a1dc0ffc1f Enable coverage (#1323)
Nyc is much simpler to setup and use.
2021-02-14 16:06:27 +03:00
bc44ab3f29 Refactor assertions with chai expect 2021-02-14 15:12:41 +03:00
1dc5ee3ee1 Make optimize synchronous (#1322)
Ref https://github.com/svg/svgo/issues/1015

Looks like `sax` is synchronous and we do not need to listen "end"
event. This allows to avoid all callbacks and make `optimize` method
synchronous.
2021-02-14 14:59:50 +03:00
b85d7f9885 Update README with note on glob support on Windows (#1295)
See issue #1233 .
2021-02-13 23:53:40 +03:00
ce2ce0de48 Cleanup LICENSE (#1157) 2021-02-13 23:47:09 +03:00
57aecc50ac Replace coa with commander (#1293)
Ref https://packagephobia.com/result?p=coa https://packagephobia.com/result?p=commander

Coa was not updated for 2 years already and has outdated dependencies.

In this diff I replaced it with commander which has simpler syntax, none
dependencies and require arguments out of the box. Also array argument
is set syntactically which means more user-friendly "help".
2021-02-13 22:23:19 +03:00
1a35a58324 Replace util.promisify with fs.promises (#1290)
Node 10 add support for promisified fs methods.
https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_promises_api

In this diff I replaced util.promisify package with the new methods.
Though this requires to bump end-of-life node versions.
2021-02-13 22:21:30 +03:00
7706192809 Replace travis with github actions (#1321)
Github is closer to the source.
2021-02-13 22:16:40 +03:00
4a08c6d039 Replace mkdirp with fs.mkdir with recursive flag (#1291)
Ref https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_mkdir_path_options_callback

Node 10 add "recursive" flag support to fs.mkdir which behaves similar
to mkdirp package.

Though this requires to bump node support.
2021-02-13 21:46:15 +03:00
5f1d59340a Merge pull request #1292 from TrySound/drop-object-values-polyfill
Drop object.values polyfill
2021-02-13 21:41:28 +03:00
93170d3870 Drop object.values polyfill
Ref https://packagephobia.com/result?p=object.values

Object.values is supported since node 7. It can be removed with major
bump especially since it's quite heavy.
2020-10-02 23:16:51 +03:00
07ca9764f7 Add Figma plugin link to Readme 2019-12-10 21:57:12 +03:00
77464801e7 Fix cleanupIDs if defs is last elem of svg 2019-11-09 21:41:17 +03:00
1152257505 Perform cleanupIDs optimization when style/script tag is empty
cleanupIDs plugin is disabled when a script or style tag is present. I
assume that this is because they might contain an id.

If these tags are empty there is no point in not cleaning the id though.
When running svgo with the option `multipass: true`, it allows us to
first run `inlineStyles` plugin to empty the style tag. Then, we can run
`cleanupIDs` plugin.
2019-11-08 22:58:43 +03:00
6db82a3323 Correct test 2019-11-08 18:40:25 +03:00
fafcbd7bd0 Fix prefixIds plugin error with animations
Fix #848
2019-11-08 18:36:45 +03:00
fdf9236d12 Add test for collapsing of repeated commands 2019-11-05 19:32:02 +03:00
dfe649fa8d Fix collapsing of repeated commands in convertPathData plugin
This fixes #1166
2019-11-05 19:22:43 +03:00
72db8ebbbf Change wording of API doc comment 2019-11-02 12:14:38 +03:00
d17c429c4f v1.3.2 v1.3.2 2019-10-30 14:00:29 +03:00
99d9c3c13a Default info on SVGO.optimize API 2019-10-30 13:52:26 +03:00
58232a323a v1.3.1 v1.3.1 2019-10-29 23:06:01 +03:00
0e6b0ad8e5 Fix 'cleanupIDs' minify bug due to preserved IDs
Prevent 'cleanupIDs' plugin from producing a preserved ID, including one
which matches a preserved prefix, when minifying.

Closes #1158
2019-10-29 22:54:36 +03:00
71c7fe74b9 Add multipassCount to info object passed to the plugins.
Use info object to skip subsequent passes in prefixIds plugin to prevent unintended, multiple prefixing.
2019-10-29 22:50:59 +03:00
67be534d30 Update csso to 4.0.2 (+semicola in styles test) (#1172)
Add test with SVG with double semicola (;;) in styles for reproducing csso bug.
Update css-tree to 1.0.0-alpha.37 (as it is also used by csso 4.0.2).
2019-10-29 22:47:09 +03:00
11f9c79741 Add active column in plugins table to readme 2019-10-03 18:13:53 +03:00
9160a41fef added node v12 in travis 2019-10-03 18:11:55 +03:00
10a302f73d v1.3.0 v1.3.0 2019-07-14 19:44:48 +03:00
cc9ad33082 Add ‘sortDefsChildren’ to default plugins list and readme 2019-07-14 19:37:58 +03:00
023013abf9 Use ’force’ option in ‘mergePaths’ only for paths with same attributes 2019-07-14 19:22:59 +03:00
e1dd31cf84 Fix 180deg ‘convertTransform’
Fix NaN after Math.acos due to error making illegal value out of bounds
Fix #1101
2019-07-14 18:51:50 +03:00
8671c4c3df Fix incorrect prev arc segment angle calculation.
Close #1109
2019-07-14 12:07:59 +03:00
27cdeb7c1c Add a warning about plugin configuration error
Usual error by not proper YML syntax like #1115
2019-07-13 23:23:40 +03:00
ac34386466 Copy plugin params when initializing plugin by name 2019-07-13 22:52:56 +03:00