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 f284e97..da2ec1e 100644 Binary files a/test/snapshots/test.js.snap and b/test/snapshots/test.js.snap differ