Skip to content

Commit

Permalink
Miscellaneous cleanup. (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkenny54 authored Oct 16, 2024
1 parent 9947fb4 commit af547e5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
19 changes: 12 additions & 7 deletions lib/svgo/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,23 @@ export default function makeProgram() {
'--exclude <PATTERN...>',
"Use with '--folder'. Exclude files matching regular expression pattern.",
)
.option(
'--preset <default | next | none>',
'Specify which set of predefined plugins to use',
'default',
.addOption(
new Option(
'--preset <default | none | next>',
'Specify which set of predefined plugins to use',
)
.default('default')
.choices(['default', 'none', 'next']),
)
.option(
'--enable <plugin...>',
'Specify one or more builtin plugins to run in addition to those in the preset or config',
)
.option(
'--options <FILENAME>',
'Path to a JSON file containing configuration parameters for enabled plugins',
.addOption(
new Option(
'--options <FILENAME>',
'Path to a JSON file containing configuration parameters for enabled plugins',
).conflicts('config'),
)
.option(
'--disable <plugin...>',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.4",
"@types/csso": "^5.0.4",
Expand Down
6 changes: 3 additions & 3 deletions plugins/round.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function getCoordContext(element, digits) {
}

const viewBox = element.attributes.viewBox;
if (viewBox) {
if (typeof viewBox === 'string' && viewBox) {
const vbParsed = viewBox.trim().split(/\s+/);
if (vbParsed.length === 4) {
const width = parseFloat(vbParsed[2]);
Expand Down Expand Up @@ -275,13 +275,13 @@ function roundOpacity(attValue, digits) {
}

/**
* @param {string} attValue
* @param {import('../lib/types.js').SVGAttValue} attValue
* @param {number|null} xDigits
* @param {number|null} yDigits
* @returns {string|null}
*/
function roundPath(attValue, xDigits, yDigits) {
if (xDigits === null || yDigits === null) {
if (typeof attValue !== 'string' || xDigits === null || yDigits === null) {
return null;
}
const commands = parsePathCommands(attValue);
Expand Down
23 changes: 15 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -858,23 +858,23 @@ __metadata:
languageName: node
linkType: hard

"@rollup/plugin-commonjs@npm:^28.0.0":
version: 28.0.0
resolution: "@rollup/plugin-commonjs@npm:28.0.0"
"@rollup/plugin-commonjs@npm:^28.0.1":
version: 28.0.1
resolution: "@rollup/plugin-commonjs@npm:28.0.1"
dependencies:
"@rollup/pluginutils": ^5.0.1
commondir: ^1.0.1
estree-walker: ^2.0.2
fdir: ^6.1.1
fdir: ^6.2.0
is-reference: 1.2.1
magic-string: ^0.30.3
picomatch: ^2.3.1
picomatch: ^4.0.2
peerDependencies:
rollup: ^2.68.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: cd2dbb85375a077dae326da482b8590552e18267f17b6213bfa638824c50384e01376579535a9ab7d42a8fc2c674cc0ef8d850a8c36878cc182f8e32b634d0ad
checksum: b230b2733b7198fca1b585f6b237ab05f3305ef7a50083caff28baef0fd611c0e90399ea7548181f97a4d0b0372487ca27f81327e355db495396a0fb8934244d
languageName: node
linkType: hard

Expand Down Expand Up @@ -2249,7 +2249,7 @@ __metadata:
languageName: node
linkType: hard

"fdir@npm:^6.1.1":
"fdir@npm:^6.2.0":
version: 6.4.0
resolution: "fdir@npm:6.4.0"
peerDependencies:
Expand Down Expand Up @@ -3914,6 +3914,13 @@ __metadata:
languageName: node
linkType: hard

"picomatch@npm:^4.0.2":
version: 4.0.2
resolution: "picomatch@npm:4.0.2"
checksum: a7a5188c954f82c6585720e9143297ccd0e35ad8072231608086ca950bee672d51b0ef676254af0788205e59bd4e4deb4e7708769226bed725bf13370a7d1464
languageName: node
linkType: hard

"pirates@npm:^4.0.4":
version: 4.0.6
resolution: "pirates@npm:4.0.6"
Expand Down Expand Up @@ -4533,7 +4540,7 @@ __metadata:
resolution: "svgo-ll@workspace:."
dependencies:
"@eslint/js": ^9.12.0
"@rollup/plugin-commonjs": ^28.0.0
"@rollup/plugin-commonjs": ^28.0.1
"@rollup/plugin-node-resolve": ^15.3.0
"@rollup/plugin-terser": ^0.4.4
"@types/csso": ^5.0.4
Expand Down

0 comments on commit af547e5

Please sign in to comment.