From 740cccbc4d695b3a238dbf02b7efbaa90d728ad7 Mon Sep 17 00:00:00 2001 From: copmerbenjamin <39121555+copmerbenjamin@users.noreply.github.com> Date: Sat, 23 Apr 2022 10:27:21 +0200 Subject: [PATCH] fix(deps): Update pdf2json to version 2 (#116) By @copmerbenjamin: * Update pdf2json to version 2 MozBlobBuilder is not defined in newer versions of node, pdf2json 2 resolves this but drops node versions below 14 (#101, #103, #114) * BREAKING CHANGE: drop support for Node.js < 14 * Increase ecmaVersion, according to node.js version upgrade --- .eslintrc.json | 2 +- .github/workflows/nodejs.yml | 18 +- PdfReader.js | 14 +- README.md | 1 + package-lock.json | 368 ++++++----------------------------- package.json | 5 +- test/snapshots/test.js.md | 29 +-- test/snapshots/test.js.snap | Bin 3300 -> 3331 bytes 8 files changed, 94 insertions(+), 343 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2247494..cc47cd4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,4 +1,4 @@ { "extends": ["plugin:prettier/recommended"], - "parserOptions": { "ecmaVersion": 6 } + "parserOptions": { "ecmaVersion": 2020 } } diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index a9cec38..eede32a 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -9,27 +9,12 @@ on: - master jobs: - # Make sure that pdfreader can still run on old Node.js versions - old-node: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [8.x, 10.x] - steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci # install dependencies - - run: npm run test:samples - # Prevent functional regressions on supported Node.js versions tests: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x] + node-version: [14.x, 16.x] steps: - uses: actions/checkout@v1 - name: Use Node.js ${{ matrix.node-version }} @@ -53,7 +38,6 @@ jobs: release: needs: - tests - - old-node - formatting runs-on: ubuntu-latest steps: diff --git a/PdfReader.js b/PdfReader.js index 5be4976..7bacd74 100644 --- a/PdfReader.js +++ b/PdfReader.js @@ -47,10 +47,13 @@ function PdfReader(options) { **/ PdfReader.prototype.parseFileItems = function (pdfFilePath, itemHandler) { itemHandler(null, { file: { path: pdfFilePath } }); - var pdfParser = new PFParser(); + var pdfParser; if (this.options.password) { - pdfParser.setPassword(this.options.password); + pdfParser = new PFParser(null, null, this.options.password); + } else { + pdfParser = new PFParser(); } + pdfParser.on("pdfParser_dataError", itemHandler); pdfParser.on("pdfParser_dataReady", function (pdfData) { forEachItem(pdfData, itemHandler); @@ -64,10 +67,13 @@ PdfReader.prototype.parseFileItems = function (pdfFilePath, itemHandler) { */ PdfReader.prototype.parseBuffer = function (pdfBuffer, itemHandler) { itemHandler(null, { file: { buffer: pdfBuffer } }); - var pdfParser = new PFParser(); + var pdfParser; if (this.options.password) { - pdfParser.setPassword(this.options.password); + pdfParser = new PFParser(null, null, this.options.password); + } else { + pdfParser = new PFParser(); } + pdfParser.on("pdfParser_dataError", itemHandler); pdfParser.on("pdfParser_dataReady", function (pdfData) { forEachItem(pdfData, itemHandler); diff --git a/README.md b/README.md index 2586f7f..380de5e 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Supports **tabular data** with automatic column detection, and **rule-based pars Dependencies: it is based on [pdf2json](https://www.npmjs.com/package/pdf2json), which itself relies on Mozilla's [pdf.js](https://github.com/mozilla/pdf.js/). ℹ️ Important notes: + - This module is meant to be run using Node.js only. **It does not work from a web browser.** - This module extracts text entries from PDF files. It does not support photographed text. If you cannot select text from the PDF file, **you may need to use OCR software first**. diff --git a/package-lock.json b/package-lock.json index 21e94e5..c85eaf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { - "pdf2json": "1.2.5" + "pdf2json": "2.0.1" }, "devDependencies": { "@semantic-release/changelog": "^6.0.1", @@ -22,6 +22,9 @@ "execa": "^6.1.0", "prettier": "2.6.1", "semantic-release": "^19.0.2" + }, + "engines": { + "node": ">=14" } }, "node_modules/@babel/code-frame": { @@ -713,6 +716,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -1521,6 +1525,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -1927,7 +1932,8 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/end-of-stream": { "version": "1.4.4", @@ -1996,6 +2002,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, "engines": { "node": ">=6" } @@ -2633,6 +2640,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -3032,6 +3040,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -3344,7 +3353,8 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lodash.capitalize": { "version": "4.2.1", @@ -6463,26 +6473,21 @@ } }, "node_modules/pdf2json": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/pdf2json/-/pdf2json-1.2.5.tgz", - "integrity": "sha512-pkzyyPpil+jd+qQZVFzO9ZeeNFGZNLv6eNsz/P3l8QDztLkG4e/PhPYwr0IjGEv+PvgfzEniHZMgMCxadF+W3w==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pdf2json/-/pdf2json-2.0.1.tgz", + "integrity": "sha512-gj1kZOV2cA+bHyyZiwNU8AVduT4L+7dQODtJZRev7/23TZ0Mz5ILVLsaCLX2p7A8cdBYyDq6zXEBUBvtXgpIZg==", "bundleDependencies": [ - "async", - "lodash", - "@xmldom/xmldom", - "yargs" + "@xmldom/xmldom" ], "dependencies": { - "@xmldom/xmldom": "*", - "async": "*", - "lodash": "*", - "yargs": "*" + "@xmldom/xmldom": "^0.7.5" }, "bin": { "pdf2json": "bin/pdf2json" }, "engines": { - "node": ">=12.20.0" + "node": ">=14.18.0", + "npm": ">=6.14.15" } }, "node_modules/pdf2json/node_modules/@xmldom/xmldom": { @@ -6493,174 +6498,6 @@ "node": ">=10.0.0" } }, - "node_modules/pdf2json/node_modules/ansi-regex": { - "version": "5.0.0", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/pdf2json/node_modules/ansi-styles": { - "version": "4.3.0", - "inBundle": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/pdf2json/node_modules/async": { - "version": "3.2.1", - "inBundle": true, - "license": "MIT" - }, - "node_modules/pdf2json/node_modules/cliui": { - "version": "7.0.4", - "inBundle": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/pdf2json/node_modules/color-convert": { - "version": "2.0.1", - "inBundle": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/pdf2json/node_modules/color-name": { - "version": "1.1.4", - "inBundle": true, - "license": "MIT" - }, - "node_modules/pdf2json/node_modules/emoji-regex": { - "version": "8.0.0", - "inBundle": true, - "license": "MIT" - }, - "node_modules/pdf2json/node_modules/escalade": { - "version": "3.1.1", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/pdf2json/node_modules/get-caller-file": { - "version": "2.0.5", - "inBundle": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/pdf2json/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/pdf2json/node_modules/lodash": { - "version": "4.17.21", - "inBundle": true, - "license": "MIT" - }, - "node_modules/pdf2json/node_modules/require-directory": { - "version": "2.1.1", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pdf2json/node_modules/string-width": { - "version": "4.2.2", - "inBundle": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pdf2json/node_modules/strip-ansi": { - "version": "6.0.0", - "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pdf2json/node_modules/wrap-ansi": { - "version": "7.0.0", - "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/pdf2json/node_modules/y18n": { - "version": "5.0.8", - "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/pdf2json/node_modules/yargs": { - "version": "17.1.1", - "inBundle": true, - "license": "MIT", - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/pdf2json/node_modules/yargs-parser": { - "version": "20.2.7", - "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -7034,6 +6871,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -7524,6 +7362,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -7537,6 +7376,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -7981,6 +7821,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -7997,6 +7838,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -8011,6 +7853,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -8021,7 +7864,8 @@ "node_modules/wrap-ansi/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/wrappy": { "version": "1.0.2", @@ -8055,6 +7899,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, "engines": { "node": ">=10" } @@ -8078,6 +7923,7 @@ "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -8095,6 +7941,7 @@ "version": "20.2.7", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "dev": true, "engines": { "node": ">=10" } @@ -8664,7 +8511,8 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true }, "ansi-styles": { "version": "3.2.1", @@ -9221,6 +9069,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -9539,7 +9388,8 @@ "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "end-of-stream": { "version": "1.4.4", @@ -9597,7 +9447,8 @@ "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true }, "escape-string-regexp": { "version": "1.0.5", @@ -10050,7 +9901,8 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true }, "get-stream": { "version": "5.2.0", @@ -10346,7 +10198,8 @@ "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true }, "is-glob": { "version": "4.0.3", @@ -10587,7 +10440,8 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "lodash.capitalize": { "version": "4.2.1", @@ -12797,124 +12651,16 @@ "dev": true }, "pdf2json": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/pdf2json/-/pdf2json-1.2.5.tgz", - "integrity": "sha512-pkzyyPpil+jd+qQZVFzO9ZeeNFGZNLv6eNsz/P3l8QDztLkG4e/PhPYwr0IjGEv+PvgfzEniHZMgMCxadF+W3w==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pdf2json/-/pdf2json-2.0.1.tgz", + "integrity": "sha512-gj1kZOV2cA+bHyyZiwNU8AVduT4L+7dQODtJZRev7/23TZ0Mz5ILVLsaCLX2p7A8cdBYyDq6zXEBUBvtXgpIZg==", "requires": { - "@xmldom/xmldom": "*", - "async": "*", - "lodash": "*", - "yargs": "*" + "@xmldom/xmldom": "^0.7.5" }, "dependencies": { "@xmldom/xmldom": { "version": "0.7.5", "bundled": true - }, - "ansi-regex": { - "version": "5.0.0", - "bundled": true - }, - "ansi-styles": { - "version": "4.3.0", - "bundled": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "async": { - "version": "3.2.1", - "bundled": true - }, - "cliui": { - "version": "7.0.4", - "bundled": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "bundled": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "bundled": true - }, - "emoji-regex": { - "version": "8.0.0", - "bundled": true - }, - "escalade": { - "version": "3.1.1", - "bundled": true - }, - "get-caller-file": { - "version": "2.0.5", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "bundled": true - }, - "lodash": { - "version": "4.17.21", - "bundled": true - }, - "require-directory": { - "version": "2.1.1", - "bundled": true - }, - "string-width": { - "version": "4.2.2", - "bundled": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "bundled": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "y18n": { - "version": "5.0.8", - "bundled": true - }, - "yargs": { - "version": "17.1.1", - "bundled": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.7", - "bundled": true } } }, @@ -13182,7 +12928,8 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true }, "resolve": { "version": "1.22.0", @@ -13555,6 +13302,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -13565,6 +13313,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "requires": { "ansi-regex": "^5.0.1" } @@ -13900,6 +13649,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -13910,6 +13660,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -13918,6 +13669,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { "color-name": "~1.1.4" } @@ -13925,7 +13677,8 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true } } }, @@ -13954,7 +13707,8 @@ "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true }, "yallist": { "version": "4.0.0", @@ -13972,6 +13726,7 @@ "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, "requires": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -13985,7 +13740,8 @@ "yargs-parser": { "version": "20.2.7", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==" + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "dev": true }, "yocto-queue": { "version": "1.0.0", diff --git a/package.json b/package.json index 11e8c34..ec23c22 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "homepage": "https://github.com/adrienjoly/npm-pdfreader", "dependencies": { - "pdf2json": "1.2.5" + "pdf2json": "2.0.1" }, "devDependencies": { "@semantic-release/changelog": "^6.0.1", @@ -51,5 +51,8 @@ "execa": "^6.1.0", "prettier": "2.6.1", "semantic-release": "^19.0.2" + }, + "engines": { + "node": ">=14" } } diff --git a/test/snapshots/test.js.md b/test/snapshots/test.js.md index a0ecfc5..b03a742 100644 --- a/test/snapshots/test.js.md +++ b/test/snapshots/test.js.md @@ -33,7 +33,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: 0.32553125, text: 'Hello "world"', w: 6.138, @@ -54,7 +54,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: 'Value:', w: 2.666, @@ -75,7 +75,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: '4', w: 0.5, @@ -96,7 +96,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: 0.32553125, text: 'c1', w: 0.944, @@ -117,7 +117,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: 0.32553125, text: 'c2', w: 0.944, @@ -138,7 +138,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: 0.32553125, text: 'c3', w: 0.944, @@ -159,7 +159,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: '1', w: 0.5, @@ -180,7 +180,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: '2.3', w: 1.25, @@ -201,7 +201,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: 'hello', w: 2, @@ -222,7 +222,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: 'world', w: 2.333, @@ -243,7 +243,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: 'Values:', w: 3.055, @@ -264,7 +264,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: '1', w: 0.5, @@ -285,7 +285,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: '2', w: 0.5, @@ -306,7 +306,7 @@ Generated by [AVA](https://avajs.dev). ], }, ], - clr: 0, + oc: undefined, sw: NaN, text: '3', w: 0.5, @@ -503,6 +503,7 @@ Generated by [AVA](https://avajs.dev). 4.555 16.423 left 0 2␊ 4.555 18.01 left 0 3␊ file = undefined␊ + Warning: Setting up fake worker.␊ page = 1␊ 4.555 5.154 left 6 Hello "world"␊ 4.555 7.174 left 2 Value:␊ diff --git a/test/snapshots/test.js.snap b/test/snapshots/test.js.snap index f284e97c51de703c4b262cfb003868187d8777ea..da2ec1ed6e8c7ccea1f62e1a19bd012ecec06caa 100644 GIT binary patch literal 3331 zcmV+e4gB&!RzVY%@JQGkXLz3yY$zivh%# zfI7_d?hee(j59s57!m^^R>i1Tl(!ZhQ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