oslllo-svg-fixer 2.0.1 → 2.1.2
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.
- package/CHANGELOG.md +28 -3
- package/package.json +12 -13
- package/scripts/debug.js +7 -0
- package/src/cli.js +7 -0
- package/src/option.js +1 -0
- package/src/processor.js +2 -1
- package/src/svg.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,32 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
### [2.
|
|
8
|
+
### [2.1.2](https://www.github.com/oslllo/svg-fixer/compare/v2.1.0...v2.1.2) (2022-07-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* release 2.1.2 ([fd8cdaf](https://www.github.com/oslllo/svg-fixer/commit/fd8cdaf08b4645fe3fad229fefa9a97ec9124c9e))
|
|
14
|
+
|
|
15
|
+
## 2.1.1 (2022-05-1)
|
|
16
|
+
|
|
17
|
+
### Chore
|
|
18
|
+
|
|
19
|
+
- update dependencies
|
|
20
|
+
- npm audit fix
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [2.1.0](https://www.github.com/oslllo/svg-fixer/compare/v2.0.1...v2.1.1) (2022-03-8)
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- add configurable trace resolution ([#72](https://github.com/oslllo/svg-fixer/pull/72))
|
|
28
|
+
|
|
29
|
+
### Updated
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
33
|
+
## [2.0.1](https://www.github.com/oslllo/svg-fixer/compare/v2.0.0...v2.0.1) (2022-01-21)
|
|
9
34
|
|
|
10
35
|
|
|
11
36
|
### Refactor
|
|
@@ -14,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
14
39
|
|
|
15
40
|
## [2.0.0](https://www.github.com/oslllo/svg-fixer/compare/v1.4.1...v2.0.0) (2022-01-12)
|
|
16
41
|
|
|
17
|
-
This version did not break the api so upgrading from
|
|
42
|
+
This version did not break the api so upgrading from `v1.0.0` without any changes should be fine. The reason for the major version change is just in case something did break.
|
|
18
43
|
|
|
19
44
|
### Changed
|
|
20
45
|
|
|
@@ -26,7 +51,7 @@ This version did not break the api so upgrading from `< v0.3.1` without any chan
|
|
|
26
51
|
- Updated dependencies
|
|
27
52
|
|
|
28
53
|
|
|
29
|
-
|
|
54
|
+
## [1.4.1](https://www.github.com/oslllo/svg-fixer/compare/v1.4.0...v1.4.1) (2021-09-05)
|
|
30
55
|
|
|
31
56
|
|
|
32
57
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oslllo-svg-fixer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Converts SVG Strokes To Fill.",
|
|
5
5
|
"bin": "src/cli.js",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -42,26 +42,25 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://docs.oslllo.com/svg-fixer/master",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"ansi-colors": "^4.1.
|
|
46
|
-
"cli-progress": "^3.
|
|
47
|
-
"fast-glob": "^3.2.
|
|
48
|
-
"oslllo-potrace": "^2.0.
|
|
49
|
-
"oslllo-svg2": "^2.0.
|
|
50
|
-
"oslllo-validator": "^3.
|
|
45
|
+
"ansi-colors": "^4.1.3",
|
|
46
|
+
"cli-progress": "^3.11.2",
|
|
47
|
+
"fast-glob": "^3.2.11",
|
|
48
|
+
"oslllo-potrace": "^2.0.1",
|
|
49
|
+
"oslllo-svg2": "^2.0.2",
|
|
50
|
+
"oslllo-validator": "^3.1.0",
|
|
51
51
|
"yargs": "^16.2.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"
|
|
55
|
-
"chai": "^4.3.4",
|
|
54
|
+
"chai": "^4.3.6",
|
|
56
55
|
"chai-as-promised": "^7.1.1",
|
|
57
56
|
"coveralls": "^3.1.1",
|
|
58
57
|
"eslint": "^7.32.0",
|
|
59
|
-
"fs-extra": "^10.
|
|
60
|
-
"inquirer": "^8.2.
|
|
58
|
+
"fs-extra": "^10.1.0",
|
|
59
|
+
"inquirer": "^8.2.4",
|
|
61
60
|
"looks-same": "^7.3.0",
|
|
62
|
-
"mocha": "^9.
|
|
61
|
+
"mocha": "^9.2.2",
|
|
63
62
|
"mocha-lcov-reporter": "^1.3.0",
|
|
64
63
|
"nyc": "^15.1.0",
|
|
65
64
|
"stopwatch-node": "^1.1.0"
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
}
|
package/scripts/debug.js
CHANGED
|
@@ -54,6 +54,12 @@ var questions = [
|
|
|
54
54
|
message: "Throw if destination does not exist?",
|
|
55
55
|
default: "Y",
|
|
56
56
|
},
|
|
57
|
+
{
|
|
58
|
+
type: "input",
|
|
59
|
+
name: "traceResolution",
|
|
60
|
+
message: "Enter the resolution of the trace image",
|
|
61
|
+
default: 600,
|
|
62
|
+
},
|
|
57
63
|
];
|
|
58
64
|
|
|
59
65
|
inquirer.prompt(questions).then(async (answers) => {
|
|
@@ -68,6 +74,7 @@ inquirer.prompt(questions).then(async (answers) => {
|
|
|
68
74
|
var options = {
|
|
69
75
|
showProgressBar: answers.showProgressBar,
|
|
70
76
|
throwIfDestinationDoesNotExist: answers.throwIfDestinationDoesNotExist,
|
|
77
|
+
traceResolution: answers.traceResolution,
|
|
71
78
|
};
|
|
72
79
|
var stopwatch;
|
|
73
80
|
fs.emptyDirSync(destination);
|
package/src/cli.js
CHANGED
|
@@ -32,6 +32,12 @@ argvs
|
|
|
32
32
|
default: true,
|
|
33
33
|
type: "boolean",
|
|
34
34
|
})
|
|
35
|
+
.option("trace-resolution", {
|
|
36
|
+
alias: "tr",
|
|
37
|
+
describe: "resolution of trace image: larger == higher quality and slower processing",
|
|
38
|
+
default: 600,
|
|
39
|
+
type: "number",
|
|
40
|
+
})
|
|
35
41
|
.help();
|
|
36
42
|
|
|
37
43
|
argvs = argvs.argv;
|
|
@@ -41,6 +47,7 @@ const destination = argvs["destination"]; // eslint-disable-line dot-notation
|
|
|
41
47
|
const options = {
|
|
42
48
|
showProgressBar: argvs["show-progress"],
|
|
43
49
|
throwIfDestinationDoesNotExist: argvs["strict-destination"],
|
|
50
|
+
traceResolution: argvs["trace-resolution"],
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
(async () => {
|
package/src/option.js
CHANGED
package/src/processor.js
CHANGED
|
@@ -71,7 +71,8 @@ Processor.prototype = {
|
|
|
71
71
|
instance: function ({ source, destination }) {
|
|
72
72
|
return new Promise(async (resolve, reject) => {
|
|
73
73
|
try {
|
|
74
|
-
var
|
|
74
|
+
var resolution = this.fixer.options.get("traceResolution");
|
|
75
|
+
var svg = new Svg(source, resolution);
|
|
75
76
|
var fixed = await svg.process();
|
|
76
77
|
fs.writeFileSync(destination, fixed);
|
|
77
78
|
this.tick(() => resolve());
|
package/src/svg.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
const Svg2 = require("oslllo-svg2");
|
|
4
4
|
const Potrace = require("oslllo-potrace");
|
|
5
5
|
|
|
6
|
-
const Svg = function (path) {
|
|
6
|
+
const Svg = function (path, traceResolution) {
|
|
7
7
|
this.filled = false;
|
|
8
8
|
this.path = path;
|
|
9
|
+
this.traceResolution = traceResolution;
|
|
9
10
|
this.png = new Object();
|
|
10
11
|
this.resized = new Object();
|
|
11
12
|
this.svg2 = Svg2(this.path);
|
|
@@ -25,13 +26,12 @@ Svg.prototype = {
|
|
|
25
26
|
return { element, svg2, dimensions };
|
|
26
27
|
},
|
|
27
28
|
getResizeDimensions() {
|
|
28
|
-
const width =
|
|
29
|
-
|
|
29
|
+
const width = this.traceResolution;
|
|
30
|
+
|
|
31
|
+
return {
|
|
30
32
|
width: width,
|
|
31
33
|
height: (width / this.original.dimensions.width) * this.original.dimensions.height,
|
|
32
34
|
};
|
|
33
|
-
|
|
34
|
-
return dimensions;
|
|
35
35
|
},
|
|
36
36
|
getOriginal: function () {
|
|
37
37
|
var element = this.element.cloneNode(true);
|