mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-21 23:33:31 +01:00
Upgrade pdfjs-dist 2.0.489 to 2.8.335 + build infrastructure upgrades (#20)
This commit is contained in:
parent
96e084a5c3
commit
98eb971533
4953
package-lock.json
generated
4953
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -6,11 +6,11 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "webpack -d --watch",
|
"watch": "webpack -d --watch",
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"start": "webpack-dev-server",
|
"start": "webpack serve",
|
||||||
"lint": "eslint src --ext .js --ext .jsx --cache",
|
"lint": "eslint src --ext .js --ext .jsx --cache",
|
||||||
"test": "NODE_ENV=testing mocha --compilers js:babel-core/register test --recursive",
|
"test": "NODE_ENV=testing mocha --compilers js:babel-core/register test --recursive",
|
||||||
"check": "npm run lint && npm run test",
|
"check": "npm run lint && npm run test",
|
||||||
"release": "npm run lint && rm -rf build/* && NODE_ENV=production webpack -p",
|
"release": "npm run lint && rm -rf build/* && NODE_ENV=production webpack --mode production",
|
||||||
"deploy": "npm run release && cp -r build/* docs/"
|
"deploy": "npm run release && cp -r build/* docs/"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap": "^3.3.7",
|
||||||
"enumify": "^1.0.4",
|
"enumify": "^1.0.4",
|
||||||
"pdfjs-dist": "^2.0.489",
|
"pdfjs-dist": "^2.8.335",
|
||||||
"rc-progress": "^2.0.6",
|
"rc-progress": "^2.0.6",
|
||||||
"react": "^15.4.2",
|
"react": "^15.4.2",
|
||||||
"react-bootstrap": "^0.30.7",
|
"react-bootstrap": "^0.30.7",
|
||||||
@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.22.1",
|
"babel-core": "^6.22.1",
|
||||||
"babel-eslint": "^7.1.1",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-loader": "^7.1.1",
|
"babel-loader": "^7.1.1",
|
||||||
"babel-plugin-transform-runtime": "^6.22.0",
|
"babel-plugin-transform-runtime": "^6.22.0",
|
||||||
"babel-preset-es2015": "^6.22.0",
|
"babel-preset-es2015": "^6.22.0",
|
||||||
@ -47,20 +47,20 @@
|
|||||||
"babel-preset-stage-0": "^6.22.0",
|
"babel-preset-stage-0": "^6.22.0",
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
"babel-preset-stage-2": "^6.24.1",
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"copy-webpack-plugin": "^4.0.1",
|
"copy-webpack-plugin": "^9.0.1",
|
||||||
"css-loader": "^0.26.1",
|
"css-loader": "^0.26.1",
|
||||||
"esformatter-jsx": "^7.4.1",
|
"esformatter-jsx": "^7.4.1",
|
||||||
"eslint": "^4.18.2",
|
"eslint": "^7.30.0",
|
||||||
"eslint-plugin-jasmine": "^2.2.0",
|
"eslint-plugin-jasmine": "^2.2.0",
|
||||||
"eslint-plugin-react": "^6.9.0",
|
"eslint-plugin-react": "^6.9.0",
|
||||||
"extract-text-webpack-plugin": "^3.0.2",
|
"extract-text-webpack-plugin": "^3.0.2",
|
||||||
"file-loader": "^0.10.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-webpack-plugin": "^2.22.0",
|
"html-webpack-plugin": "^5.3.2",
|
||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"style-loader": "^0.13.1",
|
"style-loader": "^0.13.1",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^3.11.0",
|
"webpack": "^5.42.0",
|
||||||
"webpack-cli": "^2.0.15",
|
"webpack-cli": "^4.7.2",
|
||||||
"webpack-dev-server": "^2.11.1"
|
"webpack-dev-server": "^3.11.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import FaCheck from 'react-icons/lib/fa/check'
|
import FaCheck from 'react-icons/lib/fa/check'
|
||||||
|
|
||||||
import pdfjs from 'pdfjs-dist'; // eslint-disable-line no-unused-vars
|
const pdfjs = require('pdfjs-dist'); // eslint-disable-line no-unused-vars
|
||||||
import { Line } from 'rc-progress';
|
import { Line } from 'rc-progress';
|
||||||
|
|
||||||
import Metadata from '../models/Metadata.jsx';
|
import Metadata from '../models/Metadata.jsx';
|
||||||
@ -107,7 +107,7 @@ export default class LoadingView extends React.Component {
|
|||||||
data: this.props.fileBuffer,
|
data: this.props.fileBuffer,
|
||||||
cMapUrl: 'cmaps/',
|
cMapUrl: 'cmaps/',
|
||||||
cMapPacked: true
|
cMapPacked: true
|
||||||
}).then(function(pdfDocument) { // eslint-disable-line no-undef
|
}).promise.then(function(pdfDocument) { // eslint-disable-line no-undef
|
||||||
// console.debug(pdfDocument);
|
// console.debug(pdfDocument);
|
||||||
pdfDocument.getMetadata().then(function(metadata) {
|
pdfDocument.getMetadata().then(function(metadata) {
|
||||||
// console.debug(metadata);
|
// console.debug(metadata);
|
||||||
@ -118,7 +118,7 @@ export default class LoadingView extends React.Component {
|
|||||||
pdfDocument.getPage(j).then(function(page) {
|
pdfDocument.getPage(j).then(function(page) {
|
||||||
// console.debug(page);
|
// console.debug(page);
|
||||||
var scale = 1.0;
|
var scale = 1.0;
|
||||||
var viewport = page.getViewport(scale);
|
var viewport = page.getViewport({scale: scale});
|
||||||
|
|
||||||
page.getTextContent().then(function(textContent) {
|
page.getTextContent().then(function(textContent) {
|
||||||
// console.debug(textContent);
|
// console.debug(textContent);
|
||||||
@ -126,7 +126,7 @@ export default class LoadingView extends React.Component {
|
|||||||
//trigger resolving of fonts
|
//trigger resolving of fonts
|
||||||
const fontId = item.fontName;
|
const fontId = item.fontName;
|
||||||
if (!self.state.fontIds.has(fontId) && fontId.startsWith('g_d0')) {
|
if (!self.state.fontIds.has(fontId) && fontId.startsWith('g_d0')) {
|
||||||
self.state.document.transport.commonObjs.get(fontId, function(font) {
|
self.state.document._transport.commonObjs.get(fontId, function(font) {
|
||||||
self.fontParsed(fontId, font);
|
self.fontParsed(fontId, font);
|
||||||
});
|
});
|
||||||
self.state.fontIds.add(fontId);
|
self.state.fontIds.add(fontId);
|
||||||
@ -149,7 +149,7 @@ export default class LoadingView extends React.Component {
|
|||||||
font: item.fontName
|
font: item.fontName
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
self.pageParsed(page.pageIndex, textItems);
|
self.pageParsed(page._pageIndex, textItems);
|
||||||
});
|
});
|
||||||
page.getOperatorList().then(function() {
|
page.getOperatorList().then(function() {
|
||||||
// do nothing... this is only for triggering the font retrieval
|
// do nothing... this is only for triggering the font retrieval
|
||||||
|
@ -33,11 +33,11 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
loader: "style-loader!css-loader"
|
use: ['style-loader', 'css-loader']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.png$/,
|
test: /\.png$/,
|
||||||
loader: "url-loader?limit=100000"
|
use: ["url-loader?limit=100000"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.jpg$/,
|
test: /\.jpg$/,
|
||||||
@ -45,19 +45,19 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
|
use: ['url-loader?limit=10000&mimetype=application/font-woff']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
|
use: ['url-loader?limit=10000&mimetype=application/octet-stream']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'file-loader'
|
use: ['file-loader']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
|
use: ['url-loader?limit=10000&mimetype=image/svg+xml']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -71,23 +71,35 @@ module.exports = {
|
|||||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin(
|
||||||
{
|
{
|
||||||
from: NODEMODULES_DIR + '/pdfjs-dist/build/pdf.worker.js',
|
patterns: [
|
||||||
to: 'bundle.worker.js'
|
{
|
||||||
},
|
from: NODEMODULES_DIR + '/pdfjs-dist/build/pdf.worker.js',
|
||||||
]),
|
to: 'bundle.worker.js'
|
||||||
new CopyWebpackPlugin([
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
),
|
||||||
|
new CopyWebpackPlugin(
|
||||||
{
|
{
|
||||||
from: NODEMODULES_DIR + '/pdfjs-dist/cmaps',
|
patterns: [
|
||||||
to: 'cmaps'
|
{
|
||||||
},
|
from: NODEMODULES_DIR + '/pdfjs-dist/cmaps',
|
||||||
]),
|
to: 'cmaps'
|
||||||
new CopyWebpackPlugin([
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
),
|
||||||
|
new CopyWebpackPlugin(
|
||||||
{
|
{
|
||||||
from: 'favicons',
|
patterns: [
|
||||||
to: 'favicons'
|
{
|
||||||
},
|
from: 'favicons',
|
||||||
])
|
to: 'favicons'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user