node-poppler 5.1.0 → 5.1.1
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 +39 -0
- package/package.json +94 -92
- package/src/index.js +18 -32
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### [5.1.1](https://www.github.com/Fdawgs/node-poppler/compare/v5.1.0...v5.1.1) (2021-12-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **index:** correct message thrown for missing binaries ([#363](https://www.github.com/Fdawgs/node-poppler/issues/363)) ([5249d61](https://www.github.com/Fdawgs/node-poppler/commit/5249d6183b11f6c9eded643359e05d4f3ecf9f01))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Continuous Integration
|
|
14
|
+
|
|
15
|
+
* trigger workflows when drafts marked as "ready to review" ([#354](https://www.github.com/Fdawgs/node-poppler/issues/354)) ([de922a2](https://www.github.com/Fdawgs/node-poppler/commit/de922a20494d8bc87333da156248342805e37a15))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Documentation
|
|
19
|
+
|
|
20
|
+
* **coc:** reduce verbosity ([b38d954](https://www.github.com/Fdawgs/node-poppler/commit/b38d9549a890e434868cc26a59867a26a49b8167))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Improvements
|
|
24
|
+
|
|
25
|
+
* **index:** remove unused `if` conditional ([d56589d](https://www.github.com/Fdawgs/node-poppler/commit/d56589d41caa60533718bee24eb5797aec0f40eb))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Miscellaneous
|
|
29
|
+
|
|
30
|
+
* ignore `.yarnclean` ([#360](https://www.github.com/Fdawgs/node-poppler/issues/360)) ([196b528](https://www.github.com/Fdawgs/node-poppler/commit/196b528c860bd0bd191e1dbc53c1dfc2867aa334))
|
|
31
|
+
* **package/scripts:** add `lint:licenses` ([#361](https://www.github.com/Fdawgs/node-poppler/issues/361)) ([a010434](https://www.github.com/Fdawgs/node-poppler/commit/a0104344c0569887e3af82263aa091cde0027afc))
|
|
32
|
+
* turn off `security/detect-object-injection` eslint rule ([1d6dc35](https://www.github.com/Fdawgs/node-poppler/commit/1d6dc35bfe4c0e54391745a3ff45485b0c76fac0))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Dependencies
|
|
36
|
+
|
|
37
|
+
* **dependabot:** ignore minor and patch github-actions updates ([#356](https://www.github.com/Fdawgs/node-poppler/issues/356)) ([56d1a86](https://www.github.com/Fdawgs/node-poppler/commit/56d1a86e20681a8b747da0713176522be7de258e))
|
|
38
|
+
* **dependabot:** ignore minor and patch release-please-action updates ([#367](https://www.github.com/Fdawgs/node-poppler/issues/367)) ([b77729f](https://www.github.com/Fdawgs/node-poppler/commit/b77729f4764f7536fda9ead8cac0b08dc75b269a))
|
|
39
|
+
* **deps-dev:** bump @commitlint/cli from 14.1.0 to 15.0.0 ([08d87b5](https://www.github.com/Fdawgs/node-poppler/commit/08d87b55891b56d81fe73db9db1a0b0eb98b9d17))
|
|
40
|
+
* **deps-dev:** bump @commitlint/config-conventional ([c5452ee](https://www.github.com/Fdawgs/node-poppler/commit/c5452eef69ef09503ee7a357f09595c8526a2e0a))
|
|
41
|
+
* **deps-dev:** bump prettier from 2.4.1 to 2.5.0 ([74f9e90](https://www.github.com/Fdawgs/node-poppler/commit/74f9e907ef9cdabb039463845055316d42a21ad5))
|
|
42
|
+
* **deps-dev:** bump prettier from 2.5.0 to 2.5.1 ([d51ca9b](https://www.github.com/Fdawgs/node-poppler/commit/d51ca9b64884715b47eed2db64229b84c9dd9f4a))
|
|
43
|
+
|
|
5
44
|
## [5.1.0](https://www.github.com/Fdawgs/node-poppler/compare/v5.0.3...v5.1.0) (2021-11-10)
|
|
6
45
|
|
|
7
46
|
|
package/package.json
CHANGED
|
@@ -1,94 +1,96 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
2
|
+
"name": "node-poppler",
|
|
3
|
+
"version": "5.1.1",
|
|
4
|
+
"description": "Asynchronous node.js wrapper for the Poppler PDF rendering library",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"async",
|
|
7
|
+
"attach",
|
|
8
|
+
"cairo",
|
|
9
|
+
"converter",
|
|
10
|
+
"detach",
|
|
11
|
+
"eps",
|
|
12
|
+
"html",
|
|
13
|
+
"jpg",
|
|
14
|
+
"jpeg",
|
|
15
|
+
"pdf",
|
|
16
|
+
"pdf-converter",
|
|
17
|
+
"pdf-to-cairo",
|
|
18
|
+
"pdf-to-html",
|
|
19
|
+
"pdf-to-image",
|
|
20
|
+
"pdf-to-ppm",
|
|
21
|
+
"pdf-to-ps",
|
|
22
|
+
"pdf-to-text",
|
|
23
|
+
"png",
|
|
24
|
+
"poppler",
|
|
25
|
+
"ppm",
|
|
26
|
+
"ps",
|
|
27
|
+
"separate",
|
|
28
|
+
"svg",
|
|
29
|
+
"text",
|
|
30
|
+
"tiff",
|
|
31
|
+
"txt",
|
|
32
|
+
"unite"
|
|
33
|
+
],
|
|
34
|
+
"main": "src/index.js",
|
|
35
|
+
"repository": "git+https://github.com/Fdawgs/node-poppler.git",
|
|
36
|
+
"homepage": "https://github.com/Fdawgs/node-poppler",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/Fdawgs/node-poppler/issues"
|
|
39
|
+
},
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"author": "Frazer Smith <frazer.dev@outlook.com>",
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=12.0.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc",
|
|
47
|
+
"doc": "tsc && jsdoc2md src/index.js > API.md && npm run lint:prettier",
|
|
48
|
+
"jest": "jest --detectOpenHandles --runInBand",
|
|
49
|
+
"jest:coverage": "jest --coverage --runInBand",
|
|
50
|
+
"lint": "eslint . --cache --ext js,jsx --ignore-path .gitignore",
|
|
51
|
+
"lint:licenses": "license-checker --direct --onlyAllow=\"0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;MIT;Unlicense\" --production --summary",
|
|
52
|
+
"lint:prettier": "prettier . --write --ignore-unknown",
|
|
53
|
+
"lint:prettier:ci": "prettier . --check --ignore-unknown",
|
|
54
|
+
"prepare": "",
|
|
55
|
+
"test": "npm run lint && npm run jest"
|
|
56
|
+
},
|
|
57
|
+
"commitlint": {
|
|
58
|
+
"extends": [
|
|
59
|
+
"@commitlint/config-conventional"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"jest": {
|
|
63
|
+
"clearMocks": true,
|
|
64
|
+
"coverageReporters": [
|
|
65
|
+
"text",
|
|
66
|
+
"lcovonly"
|
|
67
|
+
],
|
|
68
|
+
"resetMocks": true,
|
|
69
|
+
"testEnvironment": "node",
|
|
70
|
+
"testTimeout": 60000
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@commitlint/cli": "^15.0.0",
|
|
74
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
75
|
+
"eslint": "^7.32.0",
|
|
76
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
77
|
+
"eslint-config-prettier": "^8.3.0",
|
|
78
|
+
"eslint-plugin-import": "^2.25.3",
|
|
79
|
+
"eslint-plugin-jest": "^25.2.4",
|
|
80
|
+
"eslint-plugin-jsdoc": "^37.0.3",
|
|
81
|
+
"eslint-plugin-promise": "^5.1.1",
|
|
82
|
+
"eslint-plugin-security": "^1.4.0",
|
|
83
|
+
"eslint-plugin-security-node": "^1.0.14",
|
|
84
|
+
"glob": "^7.2.0",
|
|
85
|
+
"husky": "^7.0.4",
|
|
86
|
+
"jest": "^27.3.1",
|
|
87
|
+
"jsdoc-to-markdown": "^7.1.0",
|
|
88
|
+
"license-checker": "^25.0.1",
|
|
89
|
+
"prettier": "2.5.1",
|
|
90
|
+
"typescript": "^4.4.4"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"camelcase": "^6.2.0",
|
|
94
|
+
"upath": "^2.0.1"
|
|
95
|
+
}
|
|
94
96
|
}
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/* eslint-disable security/detect-child-process */
|
|
2
2
|
const camelCase = require("camelcase");
|
|
3
|
-
const os = require("os");
|
|
4
3
|
const path = require("upath");
|
|
5
4
|
const { execFile } = require("child_process");
|
|
6
5
|
const util = require("util");
|
|
7
6
|
|
|
8
7
|
const execFileAsync = util.promisify(execFile);
|
|
9
|
-
const platform = os.platform();
|
|
10
8
|
|
|
11
9
|
const errorMessages = {
|
|
12
10
|
0: "No Error",
|
|
@@ -59,16 +57,6 @@ function parseOptions(acceptedOptions, options, version) {
|
|
|
59
57
|
`Invalid option provided for the current version of the binary used. '${key}' was introduced in v${acceptedOptions[key].minVersion}, but received v${version}`
|
|
60
58
|
);
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
acceptedOptions[key].maxVersion &&
|
|
65
|
-
version &&
|
|
66
|
-
version > acceptedOptions[key].maxVersion
|
|
67
|
-
) {
|
|
68
|
-
invalidArgs.push(
|
|
69
|
-
`Invalid option provided for the current version of the binary used. '${key}' is only present up to v${acceptedOptions[key].maxVersion}, but received v${version}`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
60
|
} else {
|
|
73
61
|
invalidArgs.push(`Invalid option provided '${key}'`);
|
|
74
62
|
}
|
|
@@ -89,27 +77,19 @@ class Poppler {
|
|
|
89
77
|
constructor(binPath) {
|
|
90
78
|
if (binPath) {
|
|
91
79
|
this.popplerPath = path.normalizeTrim(binPath);
|
|
80
|
+
} else if (process.platform === "win32") {
|
|
81
|
+
this.popplerPath = path.joinSafe(
|
|
82
|
+
__dirname,
|
|
83
|
+
"lib",
|
|
84
|
+
"win32",
|
|
85
|
+
"poppler-21.11.0",
|
|
86
|
+
"Library",
|
|
87
|
+
"bin"
|
|
88
|
+
);
|
|
92
89
|
} else {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
switch (platform) {
|
|
97
|
-
// Windows OS
|
|
98
|
-
case "win32":
|
|
99
|
-
popplerPath = path.joinSafe(
|
|
100
|
-
__dirname,
|
|
101
|
-
"lib",
|
|
102
|
-
"win32",
|
|
103
|
-
"poppler-21.11.0",
|
|
104
|
-
"Library",
|
|
105
|
-
"bin"
|
|
106
|
-
);
|
|
107
|
-
break;
|
|
108
|
-
default:
|
|
109
|
-
throw new Error(`${platform} is NOT supported.`);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this.popplerPath = popplerPath;
|
|
90
|
+
throw new Error(
|
|
91
|
+
`${process.platform} poppler-util binaries are not provided, please pass the installation directory as a parameter to the Poppler instance.`
|
|
92
|
+
);
|
|
113
93
|
}
|
|
114
94
|
}
|
|
115
95
|
|
|
@@ -380,6 +360,7 @@ class Poppler {
|
|
|
380
360
|
} else if (stdErr !== "") {
|
|
381
361
|
reject(new Error(stdErr.trim()));
|
|
382
362
|
} else {
|
|
363
|
+
/* istanbul ignore next */
|
|
383
364
|
reject(new Error(errorMessages[code]));
|
|
384
365
|
}
|
|
385
366
|
});
|
|
@@ -787,6 +768,7 @@ class Poppler {
|
|
|
787
768
|
} else if (stdErr !== "") {
|
|
788
769
|
reject(new Error(stdErr.trim()));
|
|
789
770
|
} else {
|
|
771
|
+
/* istanbul ignore next */
|
|
790
772
|
reject(new Error(errorMessages[code]));
|
|
791
773
|
}
|
|
792
774
|
});
|
|
@@ -923,6 +905,7 @@ class Poppler {
|
|
|
923
905
|
} else if (stdErr !== "") {
|
|
924
906
|
reject(new Error(stdErr.trim()));
|
|
925
907
|
} else {
|
|
908
|
+
/* istanbul ignore next */
|
|
926
909
|
reject(new Error(errorMessages[code]));
|
|
927
910
|
}
|
|
928
911
|
});
|
|
@@ -1123,6 +1106,7 @@ class Poppler {
|
|
|
1123
1106
|
} else if (code === 0) {
|
|
1124
1107
|
resolve(errorMessages[code]);
|
|
1125
1108
|
} else {
|
|
1109
|
+
/* istanbul ignore next */
|
|
1126
1110
|
reject(new Error(errorMessages[code]));
|
|
1127
1111
|
}
|
|
1128
1112
|
});
|
|
@@ -1368,6 +1352,7 @@ class Poppler {
|
|
|
1368
1352
|
} else if (stdErr !== "") {
|
|
1369
1353
|
reject(new Error(stdErr.trim()));
|
|
1370
1354
|
} else {
|
|
1355
|
+
/* istanbul ignore next */
|
|
1371
1356
|
reject(new Error(errorMessages[code]));
|
|
1372
1357
|
}
|
|
1373
1358
|
});
|
|
@@ -1518,6 +1503,7 @@ class Poppler {
|
|
|
1518
1503
|
} else if (stdErr !== "") {
|
|
1519
1504
|
reject(new Error(stdErr.trim()));
|
|
1520
1505
|
} else {
|
|
1506
|
+
/* istanbul ignore next */
|
|
1521
1507
|
reject(new Error(errorMessages[code]));
|
|
1522
1508
|
}
|
|
1523
1509
|
});
|