1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00
Commit Graph

225 Commits

Author SHA1 Message Date
Seth Falco
96fedb4855 chore: change link to homepage in package.json (#1824)
Change the link of the homepage from this Git repository (which is
already documented in `bugs` and `repository` to a link to the
documentation.
2023-11-08 16:00:36 +00:00
Seth Falco
5aad38bcc7 fix(inlineStyles): empty css block created empty attribute (#1823)
When running this plugin on an SVG with an empty block in the CSS, it
would apply it to the matched elements by adding an empty `style`
attribute. See the test for an example.

This resolves that by just dropping the declaration if it's empty.
2023-11-07 23:20:48 +00:00
Seth Falco
6eac770ba5 feat: convert one stop gradients plugin (#1790)
Detects if a redundant linearGradient or radialGradient is used with
only a single stop, which effectively means a solid color.

If this is found, just remove the gradient and replace references to it
with the color of the first and only stop defined.
2023-10-22 13:53:39 +01:00
Seth Falco
027e110f9d chore: increment patch version (#1804) 2023-09-27 17:45:32 +01:00
Seth Falco
42f7752db1 fix(cleanupIds): handle when 2 ids referenced in one attr (#1795) 2023-09-25 19:04:31 +01:00
Seth Falco
82593c6134 test: update jest (#1792) 2023-09-24 17:50:38 +01:00
Seth Falco
59ab80eed2 test: fix regression testing action (#1788)
The regression-test GitHub Action was failing for all pull requests due
to not handling the gzipped archive properly.

This resolved it by piping the response body to zlib#createGunzip
first. Also updates the relevant dependencies.

Signed-off-by: Seth Falco <seth@falco.fun>
Co-authored-by: strarsis <strarsis@gmail.com>
Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
2023-09-23 07:47:30 +01:00
Bogdan Chadkin
ae32acf514 3.0.2 2022-11-18 19:46:18 +03:00
Bogdan Chadkin
2f8adced74 Upgrade css-tree types 2022-11-18 12:00:54 +03:00
Bogdan Chadkin
da8840c0e1 v3.0.1 2022-11-11 13:21:59 +03:00
Bogdan Chadkin
216082c591 Remove unused json plugin 2022-11-11 13:11:54 +03:00
Bogdan Chadkin
a40fa216b6 3.0.0 2022-10-23 17:03:45 +03:00
Bogdan Chadkin
53ed57c7e1 Expose typescript types 2022-10-17 00:10:39 +03:00
Bogdan Chadkin
12272958db Upgrade csso and csstree 2022-10-08 14:57:57 +03:00
Raphael Boidol
2ea65860f0 Remove stable package in favor of native stable sort (#1681) 2022-10-01 21:21:09 +03:00
Bogdan Chadkin
fdc9ceb914 Upgrade to css-select 5 2022-10-01 16:33:51 +03:00
Bogdan Chadkin
5fa6bf0e21 Upgrade checks 2022-10-01 16:08:01 +03:00
Bogdan Chadkin
4769027865 Upgrade build 2022-10-01 16:00:07 +03:00
Bogdan Chadkin
07588be807 Require node 14+ 2022-10-01 15:42:02 +03:00
Álvaro Mondéjar
a9834efa16 Add funding key to package.json (#1662) 2022-03-15 16:37:10 +03:00
Bogdan Chadkin
b37d90e12a 2.8.0 2021-11-02 10:54:54 +03:00
Bogdan Chadkin
4b4391fbe3 Refactor basic cli tests (#1595)
Moved some tests to cli.test.js and got rid from mock-stdin dependency.
2021-10-15 12:34:24 +03:00
Bogdan Chadkin
d29cec48e3 Migrate to picocolors (#1606)
Ref https://github.com/ai/nanocolors#nano-colors

Nanocolors is deprecated in favour of picocolors to avoid drama.
All dependencies already migrated. Also fixed one vulnerability.

The main change is step away from named exports and dual modules
support in favour of smaller package.
2021-10-15 12:09:54 +03:00
Bogdan Chadkin
65b6bf4c16 Refactor svg stringifier (#1593)
- rewrote prototype class with functions
- covered with tsdoc
- added a few TODOs for v3
2021-10-07 14:06:55 +03:00
Bogdan Chadkin
5fb42ab47a Migrate to yarn 2 (#1602)
Yarn supports windows with custom shell, has better tools for
dependencies upgrade and more readable lockfile.

Migrated with preserving lockfile data.
2021-10-05 16:06:12 +03:00
Bogdan Chadkin
203db9aaec Replace strip-ansi with --no-color flag (#1588)
nanocolors checks for --color and --no-color flags to force or disable
output coloring. Which can be used instead of strip-ansi package which
btw introduced vulnerability recently.
2021-09-30 14:39:12 +03:00
Bogdan Chadkin
acd91835f5 2.7.0 2021-09-24 00:18:26 +03:00
Bogdan Chadkin
7111c52f96 Support es modules (#1583)
Ref https://github.com/svg/svgo/issues/1579

In config of course. Projects with type:module can now use modules to
export config

```js
export default {
  plugins: []
}
```

Also added support for resolving svgo.config.mjs and svgo.config.cjs.

Moved loadConfig tests to svgo-node tests.

mjs test is skipped for now in node 10, just don't use modules there
2021-09-23 21:44:55 +03:00
Bogdan Chadkin
4c6a091a90 Replace colorette with nanocolors (#1586)
Ref https://github.com/ai/nanocolors

Nanocolors is the new player in color libraries. And it's perfectly
packaged as all @ai packages. Colorette is already replaced even
in transitive dependencies.
2021-09-23 21:44:40 +03:00
Bogdan Chadkin
4e7b903a23 2.6.1 2021-09-15 23:07:41 +03:00
XhmikosR
42f3f8c230 Update dependencies (#1569)
* colorette    ^1.3.0  →   ^1.4.0
* jest        ^27.1.1  →  ^27.2.0
* node-fetch   ^2.6.1  →   ^2.6.2
* prettier     ^2.3.2  →   ^2.4.0
* typescript   ^4.4.2  →   ^4.4.3
2021-09-13 17:40:33 +03:00
Bogdan Chadkin
f602e10eb1 Pick from https://github.com/svg/svgo/pull/1567 2021-09-13 16:59:05 +03:00
Bogdan Chadkin
721a1e591d 2.6.0 2021-09-13 16:56:14 +03:00
Bogdan Chadkin
77102ed096 Add better parser errors (#1553)
Old SVGO errors were not very helpful. Packages like cssnano
(postcss-svgo) had to deal with a lot of issues which are hard to debug
with old errors.

```
Error: Error in parsing SVG: Unquoted attribute value
Line: 1
Column: 29
Char: 6
File: input.svg
```

New errors are more informative and may solve many struggles

```
Error: SvgoParserError: input.svg:2:29: Unquoted attribute value

  1 | <svg viewBox="0 0 120 120">
> 2 |   <circle fill="#ff0000" cx=60.444444" cy="60" r="50"/>
    |                             ^
  3 | </svg>
  4 |
```
2021-09-12 01:09:10 +03:00
XhmikosR
c80ffca0fb Update devDependencies (#1550)
* @rollup/plugin-commonjs      ^17.1.0  →  ^20.0.0
* @rollup/plugin-node-resolve  ^11.2.1  →  ^13.0.4
* jest                         ^27.0.6  →  ^27.1.0
* playwright                   ^1.14.0  →  ^1.14.1
* rollup                       ^2.56.2  →  ^2.56.3
* typescript                    ^4.3.5  →   ^4.4.2
2021-09-01 15:46:49 +03:00
Bogdan Chadkin
cf03c2398d 2.5.0 2021-08-28 12:15:56 +03:00
Bogdan Chadkin
e4918ccdd1 Covert removeHiddenElems with types (#1532)
Covered removeHiddenElems plugin and big part of our code
- path parser and stringifier
- style manager
2021-08-21 14:55:05 +03:00
XhmikosR
75ec2943b0 Update minor and patch dependencies (#1528)
* @rollup/plugin-node-resolve  ^11.2.0  →  ^11.2.1
* @types/jest                  ^27.0.0  →  ^27.0.1
* colorette                     ^1.2.2  →   ^1.3.0
* commander                     ^7.1.0  →   ^7.2.0
* css-tree                      ^1.1.2  →   ^1.1.3
* eslint                       ^7.22.0  →  ^7.32.0
* playwright                    ^1.9.2  →  ^1.14.0
* prettier                      ^2.2.1  →   ^2.3.2
* rollup                       ^2.42.1  →  ^2.56.2
* typescript                    ^4.2.3  →   ^4.3.5
2021-08-15 13:57:58 +03:00
Bogdan Chadkin
87ad664659 2.4.0 2021-08-13 20:00:44 +03:00
Bogdan Chadkin
c3695ae533 Migrate to jest (#1520)
Mocha doesn't have a lot of features provided by jest.
There is a great assertion library out of the box.
And the most cool feature is inline snapshots.
Mocha also hides errors which makes debugging a nightmare sometimes.
2021-08-12 18:06:10 +03:00
XhmikosR
69d01746cd Exclude test files from the npm package. (#1458) 2021-08-12 02:04:08 +03:00
Ludovico Fischer
c4ae19e250 Replace chalk with colorette (#1511)
Remove 5 deps from production install:
`ansi-styles`, `supports-color`, `color-convert`, `has-flag`, `color-name`.

Also reduce deps when using PostCSS and SVGO together, since PostCSS
uses colorette.

Tested with `yarn install svgo`.
2021-08-04 18:40:33 +03:00
Bogdan Chadkin
daf2f88ef3 2.3.1 2021-06-26 10:47:00 +03:00
Eric Cornelissen
25d0f87e33 Upgrade css-select from ^3.1.2 to ^4.1.3 (#1485) 2021-06-26 10:43:36 +03:00
Bogdan Chadkin
e381ccc132 2.3.0 2021-03-28 13:59:48 +03:00
Bogdan Chadkin
d89d36eace Split regression extracter and runner (#1451)
A lot of new sources of regression tests may come and it's important to
make debug simpler.

Now regression-extract.js downloads and write svg files into
test/regression-fixtures. regression.js run each svg in this folder.
Mismatched svg diff is written into test/regression-diffs.
2021-03-25 00:12:13 +03:00
XhmikosR
13a0ad056b Specify --ignore-path for ESLint (#1443)
Otherwise, all files are included
2021-03-21 17:57:55 +03:00
XhmikosR
de0572c799 Update devDependencies (#1442)
* @types/mocha   ^8.2.1  →   ^8.2.2
* chai           ^4.3.0  →   ^4.3.4
* eslint        ^7.20.0  →  ^7.22.0
* mocha          ^8.3.0  →   ^8.3.2
* playwright     ^1.8.1  →   ^1.9.2
* rollup        ^2.39.0  →  ^2.42.1
* typescript     ^4.2.2  →   ^4.2.3
2021-03-21 10:30:09 +03:00
Bogdan Chadkin
e4ce31a287 Add fix script 2021-03-19 15:29:24 +03:00
Vlad Shilov
279962207e Remove whitespaces and comments from the browser bundle 2021-03-10 18:20:58 +03:00