From 924903ae39c4ffae8c2587db28a6a2f159637b9c Mon Sep 17 00:00:00 2001 From: Pieter Wigboldus Date: Wed, 6 Jan 2021 08:58:55 +0100 Subject: [PATCH 1/2] Cleanup the codebase --- js/convert.js | 400 ------------------------ js/pdf2image.js | 773 ---------------------------------------------- package-lock.json | 594 ++--------------------------------- package.json | 8 +- src/converter.js | 15 +- src/pdf2png.js | 12 + src/ppt2pdf.js | 14 + test/test.js | 229 -------------- 8 files changed, 60 insertions(+), 1985 deletions(-) delete mode 100644 js/convert.js delete mode 100644 js/pdf2image.js create mode 100644 src/pdf2png.js create mode 100644 src/ppt2pdf.js delete mode 100644 test/test.js diff --git a/js/convert.js b/js/convert.js deleted file mode 100644 index 98a1fab..0000000 --- a/js/convert.js +++ /dev/null @@ -1,400 +0,0 @@ -const fs = require('fs'); -const Jimp = require('jimp'); -const pdf2image = require('./pdf2image.js'); -const exec = require('child_process').exec; -const path = require('path'); -const process = require('process'); - -const { - Arr -} = require('array-helpers'); - -const sOfficeMac = '/Applications/LibreOffice.app/Contents/MacOS/soffice'; - -/** - * PPT to Image converter. - */ -class Converter { - /** - * Constructor. - * - * @param {object} options - */ - constructor(options) { - this.files = options.files || new Arr(); - this.filesDone = new Arr(); - this.output = options.output; - this.invert = options.invert || false; - this.greyscale = options.greyscale || false; - this.deletePdfFile = options.deletePdfFile || true; - this.outputType = options.outputType || 'png'; - this.density = options.density; - this.width = options.width; - this.height = options.height; - this.logLevel = options.logLevel || 1; - this.callback = options.callback || null; - this.fileNameFormat = options.fileNameFormat || '_page_%d'; - this.file = 0; - this.start = Date.now(); - this.fileConvertTime = this.start; - this.success = new Arr(); - this.failed = new Arr(); - this.ready = false; - this.promise = false; - this.resolve = null; - this.reject = null; - if (options.documentConvert !== undefined) { - this.documentConvert = options.documentConvert; - } else if (process.platform === 'darwin') { - this.documentConvert = sOfficeMac + ' --headless --convert-to pdf --outdir'; - } else if (process.platform === 'win32') { - this.documentConvert = 'soffice.exe --headless --convert-to pdf:writer_pdf_Export --outdir'; - } else { - this.documentConvert = 'libreoffice --headless --convert-to pdf --outdir'; - } - this.version = '0.8.0'; - } - - /** - * With this function, you can use the promise function. - * - * @return {object} - */ - wait() { - let promise; - - this.promise = true; - - promise = new Promise(this.run.bind(this)); - - return promise; - } - - /** - * Start the script. - * - * @param {object} resolve - * @param {object} reject - * - * @return {object} - */ - run(resolve, reject) { - if (resolve && this.promise == true) { - this.resolve = resolve; - } - - if (reject && this.promise == true) { - this.reject = reject; - } - - this.next(); - - return this; - } - - /** - * Called when the pdf to image failed (convertPDF). - * - * @param {object} error - */ - fail(error) { - if (this.logLevel >= 1) { - console.error('Cannot convert: ' + this.currentFile); - } - - this.failed.push({ - file: this.currentFile, - failure: 'convertPDF', - error: error - }); - - this.next(); - } - - /** - * Add more files. - * - * @param {array} files - * - * @return {object} - */ - addFiles(files) { - this.files.push(...files); - - return this; - } - - /** - * Run again failed files. - * - * @return {object} - */ - resetFailed() { - if (this.logLevel >= 1) { - console.error('Reset files: ' + this.failed.length); - } - - this.files = this.failed.multikey('file'); - this.failed = new Arr(); - - return this; - } - - /** - * Get the next file. - */ - next() { - const totalTime = Date.now() - this.start; - const fileTime = Date.now() - this.fileConvertTime; - let response; - - this.fileConvertTime = Date.now(); - - if (this.files.length < 1) { - if (this.file > 0 && this.logLevel >= 1) { - console.log('Total time: ' + totalTime + 'ms for ' + this.file + ' files'); - if (this.logLevel >= 3) { - console.log('Average: ' + (totalTime / this.file) + 'ms/file'); - } - } - - if (this.logLevel >= 3) { - console.log(this.success); - } - - this.ready = true; - response = { - success: this.success, - failed: this.failed, - files: this.filesDone, - time: totalTime - }; - - if (this.promise == true) { - this.resolve(response); - } - - if (this.callback) { - this.callback(response); - } - - return; - } - - this.file++; - if (this.logLevel >= 1) { - console.log('File: ' + this.file + ', time: ' + fileTime + ' ms, total time: ' + totalTime + 'ms'); - console.log('Average: ' + (totalTime / this.file) + 'ms/file'); - } - - this.currentFile = this.files.pop(); - this.filesDone.push(this.currentFile); - - this.convert(this.currentFile, this.file); - } - - /** - * Convert function. - * - * @param {string} file - * @param {int} index - */ - convert(file, index) { - let fileName = null; - let filePath = null; - let numbers; - - if (!file) { - return; - } else if (typeof file == 'object') { - fileName = file.originalname; - filePath = file.path; - } else { - if (process.platform === 'win32') { - fileName = file.split('\\').pop(); - } else { - fileName = file.split('/').pop(); - } - - filePath = file; - } - - if (!fileName) { - return; - } - - if (this.logLevel >= 2) { - console.log('Convert: ' + file); - } - - numbers = fileName.match(/\d+/g); - - let execPath = this.documentConvert + ' \'' + this.output + '\' \'' + filePath + '\''; - - if (process.platform === 'win32') { - execPath = this.documentConvert + ' ' + this.output + ' ' + filePath; - } - - exec(execPath, this.convertedToPdf.bind(this, index, numbers, fileName)); - } - - /** - * Convert PDF to Image. - * - * @param {int} index - * @param {array} numbers - * @param {string} fileName - * @param {object} error - * @param {object} result - * - * @return {string} - */ - convertedToPdf(index, numbers, fileName, error, result) { - const pdfFile = this.output + path.parse(fileName).name + '.pdf'; - const imageFile = this.output + (numbers ? numbers.join('_') : index); - const converter = pdf2image.compileConverter({ - outputFormat: imageFile + this.fileNameFormat, - outputType: this.outputType, - stripProfile: true, - density: this.density, - width: this.width, - height: this.height - }); - - if (this.logLevel >= 2) { - console.log('Converted to pdf'); - } - - if (error) { - if (this.logLevel >= 1) { - console.error('Error on converting to pdf'); - this.failed.push({ - file: this.currentFile, - failure: 'Document convert', - error: error - }); - } - - this.next(); - - return; - } - - if (this.logLevel >= 2) { - console.log('Pdf saved: ' + pdfFile); - } - - // converts all the pages of the given pdf using the default options - converter.convertPDF(pdfFile) - .then( - this.convertedToImage.bind(this) - ) - .catch( - this.fail.bind(this) - ); - - return pdfFile; - } - - /** - * Convert to image. - * - * @param {array} pageList - */ - convertedToImage(pageList) { - if (this.logLevel >= 2) { - console.log('Converted to: ' + this.outputType); - } - - if (this.invert || this.greyscale) { - pageList.forEach(this.page.bind(this)); - } - - console.log('convert to png'); - - this.success.push(pageList); - - if (this.deletePdfFile) { - this.deletePdf(); - } - - this.next(); - } - - /** - * A page image. - * - * @param {object} element - */ - page(element) { - const file = element.path; - - Jimp.read(file, this.processPage.bind(this, file)); - } - - /** - * Process page image. - * - * @param {string} file - * @param {object} error - * @param {object} image - */ - processPage(file, error, image) { - if (error) { - if (this.logLevel >= 1) { - console.error('Inverting page error', error); - } - - this.failed.push({ - file: this.currentFile, - failure: 'jimp', - error: error - }); - - return; - } - - if (this.greyscale) { - image.greyscale(); - } - - if (this.invert) { - image.invert(); - } - - image.write(file); - } - - /** - * Delete a file. - * - * @param {string} file - */ - deletePdf() { - const file = this.output + this.file + '.pdf'; - - if (this.logLevel >= 2) { - console.log('Delete pdf: ' + file); - } - - fs.exists(file, (exists) => { - if (exists) { - fs.unlink(file, (error) => { - if (error) { - if (this.logLevel >= 1) { - console.error('Cannot delete pdf', error); - } - - this.failed.push({ - file: this.currentFile, - failure: 'unlink', - error: error - }); - } - }); - } - }); - } -} - -module.exports = Converter; diff --git a/js/pdf2image.js b/js/pdf2image.js deleted file mode 100644 index ab6ad53..0000000 --- a/js/pdf2image.js +++ /dev/null @@ -1,773 +0,0 @@ -/* eslint-disable no-case-declarations*/ -const util = require('util'); -const exec = require('child_process').exec; -const vm = require('vm'); - -/** - * The pdf converter. - */ -class Converter { - /** - * Converter contructor. - * - * @param {object} options - */ - constructor(options = {}) { - this.options = processOptions(options); - } - /** - * Convert single pdf file. - * - * @param {string} pdfFilePath - * - * @return {Promise} - */ - convertPDF(pdfFilePath) { - return generateConvertPromise(pdfFilePath, this.options); - } -} - -module.exports.compileConverter = (options) => { - return new Converter(options); -}; - -/** - * Generate convert promise. - * - * @param {string} pdfFilePath - * @param {object} options - * - * @return {Promise} - */ -function generateConvertPromise(pdfFilePath = '', options) { - const cleanFilePath = pdfFilePath.toString().trim(); - - if (cleanFilePath == '') { - return new Promise((resolve, reject) => { - reject('Empty filePath.'); - }); - } - - return new Promise((resolve, reject) => { - readPDFInfo(cleanFilePath).then((pdfInfo) => { - const filePath = getFileDirectoryPath(cleanFilePath); - const fileName = getFileNameFromPath(cleanFilePath); - const pages = options.pages(pdfInfo.Pages); - - if (options.singleProcess) { - if (pages.length > 0) { - processPagesSequentially( - pages, - pdfInfo.Pages, - fileName, - filePath, - options, - cleanFilePath, - resolve, - reject, - 0 - ); - } else { - resolve([]); - } - } else { - let promises = []; - - for (let i = 0; i < pages.length; i++) { - promises.push( - createPagePromise( - pages[i], - i + 1, - pages.length, - pdfInfo.Pages, - fileName, - filePath, - options, - cleanFilePath - ) - ); - } - Promise.all(promises).then((list) => { - resolve(list); - }, (errorList) => { - reject(errorList); - }); - } - }, (error) => { - reject(error); - }); - }); -} - -/** - * Process pages sequentially. - * - * @param {Array} pageList - * @param {number} totalPDFPages - * @param {string} fileName - * @param {string} filePath - * @param {Array} options - * @param {string} pdfFilePath - * @param {Function} resolve - * @param {Function} reject - * @param {number} i - * @param {Array} resultList - */ -function processPagesSequentially( - pageList, - totalPDFPages, - fileName, - filePath, - options, - pdfFilePath, - resolve, - reject, - i, - resultList = [] -) { - createPagePromise( - pageList[i], - i + 1, - pageList.length, - totalPDFPages, - fileName, - filePath, - options, - pdfFilePath - ).then((result) => { - resultList.push(result); - if (pageList.length > (i + 1)) { - processPagesSequentially( - pageList, - totalPDFPages, - fileName, - filePath, - options, - pdfFilePath, - resolve, - reject, - i + 1, - resultList - ); - } else { - resolve(resultList); - } - }, (error) => { - reject(error); - }); -} - -/** - * Get file directory path. - * - * @param {string} filePath - * - * @return {string} - */ -function getFileDirectoryPath(filePath) { - if (process.platform === 'win32') { - return filePath.substring(0, filePath.lastIndexOf('\\')); - } else { - return filePath.substring(0, filePath.lastIndexOf('/')); - } -} - -/** - * Get file name from path. - * - * @param {string} filePath - * - * @return {string} - */ -function getFileNameFromPath(filePath) { - let aux = filePath.split('/').pop().split('.'); - - if (process.platform === 'win32') { - aux = filePath.split('\\').pop().split('.'); - } - - return aux[0] != '' ? aux[0] : aux[1]; -} - -/** - * Generate output format function. - * - * @param {string} format - * - * @return {Function} - - A token starts with the character '%' - - d - the page number, if the first page of the PDF is page 1 - D - the page number, if the first page of the PDF is page 0 - i - the processed page number, if the first processed page is page 1 - I - the processed page number, if the first processed page is page 0 - t - the total number of pages in the pdf - T - the total of processed pages - s - the name of the pdf file - p - the path of the pdf file - % - the character '%' - {...} - a custom piece of code where all of the above values can be used - */ -function generateOutputFormatFunction(format) { - let outputFormatString = format; - - if (process.platform === 'win32') { - outputFormatString = outputFormatString.replace(/\\/g, '\\\\'); - } - - let tokenList = []; - let unreadPos = 0; - let context = ''; - - for (let i = 0; i < outputFormatString.length; i++) { - if (outputFormatString.charAt(i) == '%') { - tokenList.push('\'' + outputFormatString.substring(unreadPos, i) + '\''); - // bypasses the identifier - i += 1; - - switch (outputFormatString.charAt(i)) { - case 'd': - tokenList.push('pageNum'); - break; - case 'D': - tokenList.push('(pageNum-1)'); - break; - case 'i': - tokenList.push('pageIndex'); - break; - case 'I': - tokenList.push('(pageIndex-1)'); - break; - case 's': - tokenList.push('name'); - break; - case 'p': - tokenList.push('path'); - break; - case '%': - tokenList.push('\'%\''); - break; - case 't': - tokenList.push('totalPDFPages'); - break; - case 'T': - tokenList.push('totalPagesProcessed'); - break; - case '{': - let start = i + 1; - let remainingBrackets = 0; - - while (outputFormatString.charAt(i)) { - if (outputFormatString.charAt(i) != '}') { - i++; - } else { - if (remainingBrackets) { - remainingBrackets--; - i++; - } else { - break; - } - } - - if (outputFormatString.charAt(i) == '{') { - remainingBrackets++; - } - } - if (outputFormatString.charAt(i)) { - tokenList.push('vm.runInContext(\'' + outputFormatString.substring(start, i) + '\',context)'); - if (!context) { - context = 'var context=vm.createContext({d:pageNum,' + - 'D:pageNum-1,' + - 'i:pageIndex,' + - 'I:pageIndex-1,' + - 's:name,' + - 'p:path,' + - 't:totalPDFPages,' + - 'T:totalPagesProcessed});'; - } - } - break; - default: - break; - } - unreadPos = i + 1; - } - } - tokenList.push('\'' + outputFormatString.substring(unreadPos, outputFormatString.length) + '\''); - - return new Function( - 'pageNum', - 'pageIndex', - 'totalPagesProcessed', - 'totalPDFPages', - 'name', - 'path', - 'vm', - context + 'return ""+' + tokenList.join('+') - ); -} - -/** - * Process options. - * - * @param {Array} receivedOptions [description - * - * @return {Array} - */ -function processOptions(receivedOptions) { - let options = {}; - - options.outputType = processOutputType(receivedOptions.outputType); - - if (receivedOptions.density) { - options.density = positiveIntOrDefault(receivedOptions.density, 96); - } else { - options.density = 96; - } - if (receivedOptions.width || receivedOptions.height) { - options.width = positiveIntOrDefault(receivedOptions.width, ''); - options.height = positiveIntOrDefault(receivedOptions.height, ''); - } - - // Its a jpg file - if (options.outputType == '.jpg') { - // quality is only relevant to jpg files - options.quality = positiveIntOrDefault(receivedOptions.quality, 100); - if (options.quality > 100) { - options.quality = 100; - } - } - switch (typeof receivedOptions.outputFormat) { - case 'function': - options.outputFormat = receivedOptions.outputFormat; - break; - case 'string': - options.outputFormat = generateOutputFormatFunction(receivedOptions.outputFormat); - break; - // is the same as '%d' - default: - options.outputFormat = (pageNum) => { - return pageNum.toString(); - }; - } - options.pages = receivedOptions.pages ? processPages(receivedOptions.pages.toString()) : processPages('*'); - options.singleProcess = !!receivedOptions.singleProcess; - options.backgroundColor = processBackgroundColor(receivedOptions.backgroundColor); - - if (options.backgroundColor == '' && options.outputType == '.jpg') { - options.backgroundColor = '"#FFFFFF"'; - } - - options.stripProfile = !!receivedOptions.stripProfile; - - return options; -} - -/** - * Process output type. - * - * @param {string} type - * - * @return {string} - */ -function processOutputType(type = '') { - let cleanType = type.toString(); - - if (cleanType.charAt(0) == '.') { - cleanType = cleanType.substring(1); - } - - cleanType = cleanType.toLowerCase(); - - if (cleanType == 'png') { - return '.png'; - } else { - return '.jpg'; - } -} - -/** - * Check if char is hex. - * - * @param {string} char - * - * @return {boolean} - */ -function isHex(char) { - return char == '0' || - char == '1' || - char == '2' || - char == '3' || - char == '4' || - char == '5' || - char == '6' || - char == '7' || - char == '8' || - char == '9' || - char == 'a' || - char == 'b' || - char == 'c' || - char == 'd' || - char == 'e' || - char == 'f' || - char == 'A' || - char == 'B' || - char == 'C' || - char == 'D' || - char == 'E' || - char == 'F'; -} - -/** - * Process background color. - * - * @param {string} color - * - * @return {string} - */ -function processBackgroundColor(color) { - let newColor = color; - - if (typeof newColor != 'string') { - return ''; - } - if (newColor.charAt(0) != '#') { - newColor += '#'; - } - - if (newColor.length == 7) { - let validHex = true; - - for (let i = 1; i < 7; i++) { - if (!isHex(newColor.charAt(i))) { - validHex = false; - break; - } - } - if (validHex) { - return '"' + newColor + '"'; - } - } -} - -/** - * Create page promise. - * - * @param {[type]} pageNum - * @param {[type]} pageIndex - * @param {[type]} totalPagesProcessed - * @param {[type]} totalPDFPages - * @param {[type]} name - * @param {[type]} path - * @param {[type]} options - * @param {[type]} pdfFilePath - * - * @return {[type]} - */ -function createPagePromise(pageNum, pageIndex, totalPagesProcessed, totalPDFPages, name, path, options, pdfFilePath) { - return new Promise((resolve, reject) => { - const outputString = options.outputFormat( - pageNum, - pageIndex, - totalPagesProcessed, - totalPDFPages, - name, - path + (path ? '/' : ''), - vm - ) + options.outputType; - let convertOptions = []; - let stripOptions = []; - - if (options.density) { - convertOptions.push('-density ' + options.density); - } - if (options.width) { - convertOptions.push('-resize ' + options.width + (options.height ? 'X' + options.height : '')); - } - if (options.quality) { - convertOptions.push('-quality ' + options.quality); - } - if (options.backgroundColor != '') { - convertOptions.push('-background ' + options.backgroundColor + ' -flatten'); - } - if (options.stripProfile != '') { - if (process.platform === 'win32') { - stripOptions.push('-strip'); - } else { - convertOptions.push('-strip'); - } - } - - let aux = util.format( - 'convert %s "%s[%d]" "%s"', - convertOptions.join(' '), - pdfFilePath, - pageNum - 1, - outputString - ); - - if (process.platform === 'win32') { - aux = util.format( - 'magick.exe %s "%s[%d]" %s "%s"', - convertOptions.join(' '), - pdfFilePath, - pageNum - 1, - stripOptions.join(' '), - outputString - ); - } - - exec(aux, (err, stdout, stderr) => { - if (err) { - reject(Error(err)); - } else { - resolve({ - page: pageNum, - index: pageIndex, - name: outputString.split('/').pop(), - path: outputString - }); - } - }); - }); -} - -/** - * Process pages. - * - * @param {string} pagesStr - * - * @return {Array} - - * -> everything - - 1 -> page 1 - - 3-5 -> pages 3 to 5 - - -7 -> pages 1 to 7 - - 6- -> pages 6 to the last - - /5 -> all values divisable by 5 - - even -> all even numbers - - odd -> all odd numbers - -*/ -function processPages(pagesStr) { - if (pagesStr === '*') { - return (length) => { - let pages = []; - - for (let i = 1; i <= length; i++) { - pages.push(i); - } - - return pages; - }; - } else { - const aux = pagesStr.toString().split(','); - let ruleList = []; - - for (let option of aux) { - if (option != '') { - // TODO improve detection of options - // fazer que opcoes repetidas nao sejam inseridas - if (option === 'even') { - ruleList.push({ - type: 'even' - }); - } else if (option === 'odd') { - ruleList.push({ - type: 'odd' - }); - } else if (option.charAt(0) == '/') { - const x = positiveIntOrDefault(option.substring(1), undefined); - - if (x) { - ruleList.push({ - type: 'multiple', - value: x - }); - } - } else { - let x = option.split('-'); - - if (x.length == 1) { - x = positiveIntOrDefault(x[0], undefined); - if (x) { - ruleList.push({ - type: 'page', - value: x - }); - } - } else if (x.length == 2) { - if (x[0] == '') { - x[0] = '1'; - } - x[0] = positiveIntOrDefault(x[0], undefined); - if (x[0]) { - if (x[1] == '') { - ruleList.push({ - type: 'range-max', - start: x[0] - }); - } else { - x[1] = positiveIntOrDefault(x[1], undefined); - if (x[1]) { - // fazer que se forem trocados ficarem direitos - if (x[0] < x[1]) { - ruleList.push({ - type: 'range', - start: x[0], - end: x[1] - }); - } else if (x[0] > x[1]) { - ruleList.push({ - type: 'range', - start: x[1], - end: x[0] - }); - } else { - ruleList.push({ - type: 'page', - value: x[0] - }); - } - } - } - } - } - } - } - } - - return (length) => { - return calculatePages(ruleList, length).sort((a, b) => { - return a - b; - }); - }; - } -} - -/** - * Calculate pages. - * - * @param {Array} ruleList - * @param {number} max - * - * @return {Array} - */ -function calculatePages(ruleList, max) { - let pages = []; - let pushVal = (x) => { - if (pages.indexOf(x) == -1) { - pages.push(x); - } - }; - - for (let opc of ruleList) { - switch (opc.type) { - case 'page': - if (opc.value <= max) { - pushVal(opc.value); - } - break; - case 'even': - for (let i = 2; i <= max; i++) { - if (i % 2 == 0) { - pushVal(i); - } - } - break; - case 'odd': - for (let i = 1; i <= max; i++) { - if ((i + 1) % 2 == 0) { - pushVal(i); - } - } - break; - case 'multiple': - for (let i = 1; i <= max; i++) { - if (i % opc.value == 0) { - pushVal(i); - } - } - break; - case 'range': - const isntMax = (opc.end < max); - const x = isntMax ? opc.end : max; - - for (let i = opc.start; i <= x; i++) { - pushVal(i); - } - break; - case 'range-max': - for (let i = opc.start; i <= max; i++) { - pushVal(i); - } - break; - } - } - - return pages; -} - -/** - * Positive integer or default. - * - * @param {Mixed} value - * @param {Mixed} defaultValue - * - * @return {Mixed} - */ -function positiveIntOrDefault(value, defaultValue) { - let currentValue = value; - - if (currentValue) { - currentValue = Number.parseInt(currentValue); - - if (Number.isSafeInteger(currentValue) && currentValue > 0) { - return currentValue; - } - } - - return defaultValue; -} - -/** - * Read PDF information. - * - * @param {string} pdfFilePath - * - * @return {Promise} - */ -function readPDFInfo(pdfFilePath) { - return new Promise((resolve, reject) => { - let execPath = 'pdfinfo "' + pdfFilePath + '"'; - - if (process.platform === 'win32') { - execPath = 'pdfinfo.exe ' + pdfFilePath; - } - - exec(execPath, (error, stdout, stderr) => { - if (error !== null) { - console.error(error); - reject(Error('Error reading pdf file "' + pdfFilePath + '".')); - } else { - let pdfInfo = {}; - const infoSplit = stdout.split('\n'); - - for (let line of infoSplit) { - const aux = line.split(':'); - - pdfInfo[aux[0].trim()] = aux[1] ? aux[1].trim() : ''; - } - resolve(pdfInfo); - } - }); - }); -} diff --git a/package-lock.json b/package-lock.json index bf4ece7..9cb0954 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ppt-png", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1145,6 +1145,7 @@ "version": "7.11.2", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "dev": true, "requires": { "regenerator-runtime": "^0.13.4" } @@ -1590,327 +1591,6 @@ "chalk": "^4.0.0" } }, - "@jimp/bmp": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.1.tgz", - "integrity": "sha512-iwyNYQeBawrdg/f24x3pQ5rEx+/GwjZcCXd3Kgc+ZUd+Ivia7sIqBsOnDaMZdKCBPlfW364ekexnlOqyVa0NWg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "bmp-js": "^0.1.0" - } - }, - "@jimp/core": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.1.tgz", - "integrity": "sha512-la7kQia31V6kQ4q1kI/uLimu8FXx7imWVajDGtwUG8fzePLWDFJyZl0fdIXVCL1JW2nBcRHidUot6jvlRDi2+g==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "any-base": "^1.1.0", - "buffer": "^5.2.0", - "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", - "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" - } - }, - "@jimp/custom": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.1.tgz", - "integrity": "sha512-DNUAHNSiUI/j9hmbatD6WN/EBIyeq4AO0frl5ETtt51VN1SvE4t4v83ZA/V6ikxEf3hxLju4tQ5Pc3zmZkN/3A==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.1" - } - }, - "@jimp/gif": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.1.tgz", - "integrity": "sha512-r/1+GzIW1D5zrP4tNrfW+3y4vqD935WBXSc8X/wm23QTY9aJO9Lw6PEdzpYCEY+SOklIFKaJYUAq/Nvgm/9ryw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "gifwrap": "^0.9.2", - "omggif": "^1.0.9" - } - }, - "@jimp/jpeg": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.1.tgz", - "integrity": "sha512-8352zrdlCCLFdZ/J+JjBslDvml+fS3Z8gttdml0We759PnnZGqrnPRhkOEOJbNUlE+dD4ckLeIe6NPxlS/7U+w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "jpeg-js": "0.4.2" - } - }, - "@jimp/plugin-blit": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.1.tgz", - "integrity": "sha512-fKFNARm32RoLSokJ8WZXHHH2CGzz6ire2n1Jh6u+XQLhk9TweT1DcLHIXwQMh8oR12KgjbgsMGvrMVlVknmOAg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-blur": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.1.tgz", - "integrity": "sha512-1WhuLGGj9MypFKRcPvmW45ht7nXkOKu+lg3n2VBzIB7r4kKNVchuI59bXaCYQumOLEqVK7JdB4glaDAbCQCLyw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-circle": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.1.tgz", - "integrity": "sha512-JK7yi1CIU7/XL8hdahjcbGA3V7c+F+Iw+mhMQhLEi7Q0tCnZ69YJBTamMiNg3fWPVfMuvWJJKOBRVpwNTuaZRg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-color": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.1.tgz", - "integrity": "sha512-9yQttBAO5SEFj7S6nJK54f+1BnuBG4c28q+iyzm1JjtnehjqMg6Ljw4gCSDCvoCQ3jBSYHN66pmwTV74SU1B7A==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "tinycolor2": "^1.4.1" - } - }, - "@jimp/plugin-contain": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.1.tgz", - "integrity": "sha512-44F3dUIjBDHN+Ym/vEfg+jtjMjAqd2uw9nssN67/n4FdpuZUVs7E7wadKY1RRNuJO+WgcD5aDQcsvurXMETQTg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-cover": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.1.tgz", - "integrity": "sha512-YztWCIldBAVo0zxcQXR+a/uk3/TtYnpKU2CanOPJ7baIuDlWPsG+YE4xTsswZZc12H9Kl7CiziEbDtvF9kwA/Q==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-crop": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.1.tgz", - "integrity": "sha512-UQdva9oQzCVadkyo3T5Tv2CUZbf0klm2cD4cWMlASuTOYgaGaFHhT9st+kmfvXjKL8q3STkBu/zUPV6PbuV3ew==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-displace": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.1.tgz", - "integrity": "sha512-iVAWuz2+G6Heu8gVZksUz+4hQYpR4R0R/RtBzpWEl8ItBe7O6QjORAkhxzg+WdYLL2A/Yd4ekTpvK0/qW8hTVw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-dither": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.1.tgz", - "integrity": "sha512-tADKVd+HDC9EhJRUDwMvzBXPz4GLoU6s5P7xkVq46tskExYSptgj5713J5Thj3NMgH9Rsqu22jNg1H/7tr3V9Q==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-fisheye": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.1.tgz", - "integrity": "sha512-BWHnc5hVobviTyIRHhIy9VxI1ACf4CeSuCfURB6JZm87YuyvgQh5aX5UDKtOz/3haMHXBLP61ZBxlNpMD8CG4A==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-flip": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.1.tgz", - "integrity": "sha512-KdxTf0zErfZ8DyHkImDTnQBuHby+a5YFdoKI/G3GpBl3qxLBvC+PWkS2F/iN3H7wszP7/TKxTEvWL927pypT0w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-gaussian": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.1.tgz", - "integrity": "sha512-u9n4wjskh3N1mSqketbL6tVcLU2S5TEaFPR40K6TDv4phPLZALi1Of7reUmYpVm8mBDHt1I6kGhuCJiWvzfGyg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-invert": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.1.tgz", - "integrity": "sha512-2DKuyVXANH8WDpW9NG+PYFbehzJfweZszFYyxcaewaPLN0GxvxVLOGOPP1NuUTcHkOdMFbE0nHDuB7f+sYF/2w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-mask": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.1.tgz", - "integrity": "sha512-snfiqHlVuj4bSFS0v96vo2PpqCDMe4JB+O++sMo5jF5mvGcGL6AIeLo8cYqPNpdO6BZpBJ8MY5El0Veckhr39Q==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-normalize": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.1.tgz", - "integrity": "sha512-dOQfIOvGLKDKXPU8xXWzaUeB0nvkosHw6Xg1WhS1Z5Q0PazByhaxOQkSKgUryNN/H+X7UdbDvlyh/yHf3ITRaw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-print": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.1.tgz", - "integrity": "sha512-ceWgYN40jbN4cWRxixym+csyVymvrryuKBQ+zoIvN5iE6OyS+2d7Mn4zlNgumSczb9GGyZZESIgVcBDA1ezq0Q==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "load-bmfont": "^1.4.0" - } - }, - "@jimp/plugin-resize": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.1.tgz", - "integrity": "sha512-u4JBLdRI7dargC04p2Ha24kofQBk3vhaf0q8FwSYgnCRwxfvh2RxvhJZk9H7Q91JZp6wgjz/SjvEAYjGCEgAwQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-rotate": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.1.tgz", - "integrity": "sha512-ZUU415gDQ0VjYutmVgAYYxC9Og9ixu2jAGMCU54mSMfuIlmohYfwARQmI7h4QB84M76c9hVLdONWjuo+rip/zg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-scale": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.1.tgz", - "integrity": "sha512-jM2QlgThIDIc4rcyughD5O7sOYezxdafg/2Xtd1csfK3z6fba3asxDwthqPZAgitrLgiKBDp6XfzC07Y/CefUw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-shadow": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.1.tgz", - "integrity": "sha512-MeD2Is17oKzXLnsphAa1sDstTu6nxscugxAEk3ji0GV1FohCvpHBcec0nAq6/czg4WzqfDts+fcPfC79qWmqrA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugin-threshold": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.1.tgz", - "integrity": "sha512-iGW8U/wiCSR0+6syrPioVGoSzQFt4Z91SsCRbgNKTAk7D+XQv6OI78jvvYg4o0c2FOlwGhqz147HZV5utoSLxA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1" - } - }, - "@jimp/plugins": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.1.tgz", - "integrity": "sha512-c+lCqa25b+4q6mJZSetlxhMoYuiltyS+ValLzdwK/47+aYsq+kcJNl+TuxIEKf59yr9+5rkbpsPkZHLF/V7FFA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.1", - "@jimp/plugin-blur": "^0.16.1", - "@jimp/plugin-circle": "^0.16.1", - "@jimp/plugin-color": "^0.16.1", - "@jimp/plugin-contain": "^0.16.1", - "@jimp/plugin-cover": "^0.16.1", - "@jimp/plugin-crop": "^0.16.1", - "@jimp/plugin-displace": "^0.16.1", - "@jimp/plugin-dither": "^0.16.1", - "@jimp/plugin-fisheye": "^0.16.1", - "@jimp/plugin-flip": "^0.16.1", - "@jimp/plugin-gaussian": "^0.16.1", - "@jimp/plugin-invert": "^0.16.1", - "@jimp/plugin-mask": "^0.16.1", - "@jimp/plugin-normalize": "^0.16.1", - "@jimp/plugin-print": "^0.16.1", - "@jimp/plugin-resize": "^0.16.1", - "@jimp/plugin-rotate": "^0.16.1", - "@jimp/plugin-scale": "^0.16.1", - "@jimp/plugin-shadow": "^0.16.1", - "@jimp/plugin-threshold": "^0.16.1", - "timm": "^1.6.1" - } - }, - "@jimp/png": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.1.tgz", - "integrity": "sha512-iyWoCxEBTW0OUWWn6SveD4LePW89kO7ZOy5sCfYeDM/oTPLpR8iMIGvZpZUz1b8kvzFr27vPst4E5rJhGjwsdw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.1", - "pngjs": "^3.3.3" - } - }, - "@jimp/tiff": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.1.tgz", - "integrity": "sha512-3K3+xpJS79RmSkAvFMgqY5dhSB+/sxhwTFA9f4AVHUK0oKW+u6r52Z1L0tMXHnpbAdR9EJ+xaAl2D4x19XShkQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" - } - }, - "@jimp/types": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.1.tgz", - "integrity": "sha512-g1w/+NfWqiVW4CaXSJyD28JQqZtm2eyKMWPhBBDCJN9nLCN12/Az0WFF3JUAktzdsEC2KRN2AqB1a2oMZBNgSQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.1", - "@jimp/gif": "^0.16.1", - "@jimp/jpeg": "^0.16.1", - "@jimp/png": "^0.16.1", - "@jimp/tiff": "^0.16.1", - "timm": "^1.6.1" - } - }, - "@jimp/utils": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.1.tgz", - "integrity": "sha512-8fULQjB0x4LzUSiSYG6ZtQl355sZjxbv8r9PPAuYHzS9sGiSHJQavNqK/nKnpDsVkU88/vRGcE7t3nMU0dEnVw==", - "requires": { - "@babel/runtime": "^7.7.2", - "regenerator-runtime": "^0.13.3" - } - }, "@rollup/plugin-alias": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-3.1.1.tgz", @@ -2235,11 +1915,6 @@ "color-convert": "^1.9.0" } }, - "any-base": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", - "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" - }, "anymatch": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", @@ -2277,11 +1952,6 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, - "array-helpers": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/array-helpers/-/array-helpers-4.0.1.tgz", - "integrity": "sha512-wSKj6fnXhWtIXxM7CAyfCclf1o+5H8Bwyl2u1yG9EiWZshHxXAJgQNHQiO0EOCyQFI3uZlMHH6w3VqMuVhnoxw==" - }, "array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", @@ -2511,7 +2181,8 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base": { "version": "0.11.2", @@ -2568,11 +2239,6 @@ } } }, - "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" - }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -2588,11 +2254,6 @@ "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", "dev": true }, - "bmp-js": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", - "integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=" - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -2603,6 +2264,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2654,20 +2316,6 @@ "node-int64": "^0.4.0" } }, - "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-equal": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", - "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=" - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -3023,7 +2671,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "concat-with-sourcemaps": { "version": "1.1.0", @@ -3688,11 +3337,6 @@ } } }, - "dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" - }, "domelementtype": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", @@ -4135,11 +3779,6 @@ } } }, - "exif-parser": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", - "integrity": "sha1-WKnS1ywCwfbwKg70qRZicrd2CSI=" - }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -4380,11 +4019,6 @@ "flat-cache": "^3.0.4" } }, - "file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==" - }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -4489,7 +4123,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "2.1.3", @@ -4572,19 +4207,11 @@ "assert-plus": "^1.0.0" } }, - "gifwrap": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.2.tgz", - "integrity": "sha512-fcIswrPaiCDAyO8xnWvHSZdWChjKXUanKKpAiWWJ/UTkEi/aYKn5+90e7DE820zbEaVR9CE2y4z9bzhQijZ0BA==", - "requires": { - "image-q": "^1.1.1", - "omggif": "^1.0.10" - } - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4603,15 +4230,6 @@ "is-glob": "^4.0.1" } }, - "global": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", - "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, "globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -4852,22 +4470,12 @@ "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", "dev": true }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, - "image-q": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/image-q/-/image-q-1.1.1.tgz", - "integrity": "sha1-/IQJlmRGC5DKhi2TALa/u7+/gFY=" - }, "import-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", @@ -4930,6 +4538,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -4938,7 +4547,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ip-regex": { "version": "2.1.0", @@ -5098,11 +4708,6 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" - }, "is-generator-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", @@ -5877,23 +5482,6 @@ } } }, - "jimp": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.1.tgz", - "integrity": "sha512-+EKVxbR36Td7Hfd23wKGIeEyHbxShZDX6L8uJkgVW3ESA9GiTEPK08tG1XI2r/0w5Ch0HyJF5kPqF9K7EmGjaw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.1", - "@jimp/plugins": "^0.16.1", - "@jimp/types": "^0.16.1", - "regenerator-runtime": "^0.13.3" - } - }, - "jpeg-js": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.2.tgz", - "integrity": "sha512-+az2gi/hvex7eLTMTlbRLOhH6P6WFdk2ITI8HJsaH2VqYO0I594zXSYEP+tf4FW+8Cy68ScDXoAsQdyQanv3sw==" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -6083,21 +5671,6 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, - "load-bmfont": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", - "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", - "requires": { - "buffer-equal": "0.0.1", - "mime": "^1.3.4", - "parse-bmfont-ascii": "^1.0.3", - "parse-bmfont-binary": "^1.0.5", - "parse-bmfont-xml": "^1.1.4", - "phin": "^2.9.1", - "xhr": "^2.0.1", - "xtend": "^4.0.0" - } - }, "loader-utils": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", @@ -6391,11 +5964,6 @@ "picomatch": "^2.0.5" } }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, "mime-db": { "version": "1.44.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", @@ -6417,18 +5985,11 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", - "requires": { - "dom-walk": "^0.1.0" - } - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6464,6 +6025,7 @@ "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, "requires": { "minimist": "^1.2.5" }, @@ -6471,7 +6033,8 @@ "minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true } } }, @@ -6760,15 +6323,11 @@ "has": "^1.0.3" } }, - "omggif": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", - "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -6851,11 +6410,6 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" - }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -6865,30 +6419,6 @@ "callsites": "^3.0.0" } }, - "parse-bmfont-ascii": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", - "integrity": "sha1-Eaw8P/WPfCAgqyJ2kHkQjU36AoU=" - }, - "parse-bmfont-binary": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", - "integrity": "sha1-0Di0dtPp3Z2x4RoLDlOiJ5K2kAY=" - }, - "parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", - "requires": { - "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" - } - }, - "parse-headers": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.3.tgz", - "integrity": "sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA==" - }, "parse-json": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", @@ -6938,7 +6468,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-key": { "version": "3.1.1", @@ -6964,11 +6495,6 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, - "phin": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", - "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -6990,14 +6516,6 @@ "node-modules-regexp": "^1.0.0" } }, - "pixelmatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", - "integrity": "sha1-j0fc7FARtHe2fbA8JDvB8wheiFQ=", - "requires": { - "pngjs": "^3.0.0" - } - }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -7046,11 +6564,6 @@ } } }, - "pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -8810,11 +8323,6 @@ } } }, - "process": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", - "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" - }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -8935,7 +8443,8 @@ "regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==" + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", + "dev": true }, "regenerator-transform": { "version": "0.14.5", @@ -9482,7 +8991,8 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true }, "saxes": { "version": "5.0.1", @@ -10237,11 +9747,6 @@ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "dev": true }, - "timm": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.0.tgz", - "integrity": "sha512-oVYHPG5KiUJ3KrbBTmW2kTauIO9E1lDEUM6K92HVuwnPfTt7W8UXZG3vqOo4tVaHRI9AHToVHqhzIUUFkDN6rA==" - }, "timsort": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", @@ -10258,11 +9763,6 @@ "globrex": "^0.1.2" } }, - "tinycolor2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", - "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" - }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", @@ -10517,14 +10017,6 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, - "utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", - "requires": { - "pako": "^1.0.5" - } - }, "util": { "version": "0.10.4", "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", @@ -10780,7 +10272,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write-file-atomic": { "version": "3.0.3", @@ -10800,53 +10293,18 @@ "integrity": "sha512-pTsP8UAfhy3sk1lSk/O/s4tjD0CRwvMnzvwr4OKGX7ZvqZtUyx4KIJB5JWbkykPoc55tixMGgTNoh3k4FkNGFQ==", "dev": true }, - "xhr": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", - "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", - "requires": { - "global": "~4.3.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, - "xml-parse-from-string": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", - "integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig=" - }, - "xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - } - }, - "xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" - }, "xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - }, "y18n": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", diff --git a/package.json b/package.json index b9a7b91..6724465 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ppt-png", - "version": "1.1.0", + "version": "1.2.0", "description": "Convert ppt to image (png,jpg)", "files": [ "src/converter.js", @@ -71,11 +71,7 @@ "dependencies": { "@hckrnews/converter": "^0.4.0", "@hckrnews/pdf2png": "^0.2.0", - "@hckrnews/ppt2pdf": "^0.2.2", - "array-helpers": "^4.0.1", - "glob": "^7.1.5", - "jimp": "^0.16.1", - "path": "^0.12.7" + "@hckrnews/ppt2pdf": "^0.2.2" }, "type": "module", "engines": { diff --git a/src/converter.js b/src/converter.js index 4709028..e3c438a 100644 --- a/src/converter.js +++ b/src/converter.js @@ -1,5 +1,5 @@ -import PptToPdfConverter from '@hckrnews/ppt2pdf'; -import Pdf2PngConverter from '@hckrnews/pdf2png'; +import pdf2png from './pdf2png.js'; +import ppt2pdf from './ppt2pdf.js'; import { File, Converter @@ -38,18 +38,15 @@ class Ppt2PngConverter extends Converter { */ convert() { return this.files.map((file) => { - const pptConverter = PptToPdfConverter.create({ - file: file.path, + const pdf = ppt2pdf({ + file, output: this.output }); - pptConverter.convert(); - const pdfConverter = Pdf2PngConverter.create({ - file: pptConverter.pdf, + return pdf2png({ + file: pdf, output: this.output }); - - return pdfConverter.convert(); }); } diff --git a/src/pdf2png.js b/src/pdf2png.js new file mode 100644 index 0000000..76de46c --- /dev/null +++ b/src/pdf2png.js @@ -0,0 +1,12 @@ +import Pdf2PngConverter from '@hckrnews/pdf2png'; + +export default ({ + file, output +}) => { + const pdfConverter = Pdf2PngConverter.create({ + file, + output + }); + + return pdfConverter.convert(); +}; diff --git a/src/ppt2pdf.js b/src/ppt2pdf.js new file mode 100644 index 0000000..4c23484 --- /dev/null +++ b/src/ppt2pdf.js @@ -0,0 +1,14 @@ +import PptToPdfConverter from '@hckrnews/ppt2pdf'; + +export default ({ + file, output +}) => { + const pptConverter = PptToPdfConverter.create({ + file: file.path, + output + }); + + pptConverter.convert(); + + return pptConverter.pdf; +}; diff --git a/test/test.js b/test/test.js deleted file mode 100644 index b333de4..0000000 --- a/test/test.js +++ /dev/null @@ -1,229 +0,0 @@ -var assert = require('assert'); -var Converter = require('../js/convert.js'); -const fs = require('fs'); -const { - Arr -} = require('array-helpers'); - -describe('ppt-png', function() { - describe('normal', function() { - this.timeout(10000); - it('Test if the ppt file can convert to a png.', function(done) { - new Converter({ - files: ['test/OPW 733 Tienduizend redenen.ppt'], - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: true, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d', - callback: function(data) { - if (data.failed.length > 0 || data.success.length < 1) { - console.log('failure:' + data.failed[0].failure); - done(data.failed[0].error); - } else { - done(); - } - } - }).run(); - }); - }); - - describe('promise', function() { - this.timeout(10000); - it('Test with the promise.', function(done) { - new Converter({ - files: ['test/OPW 733 Tienduizend redenen.ppt'], - output: 'output/test/' - }) - .wait() - .then(function(data) { - if (data.failed.length > 0 || data.success.length < 1) { - console.log('failure:' + data.failed[0].failure); - done(data.failed[0].error); - } else { - done(); - } - }) - .catch(function(error) { - done(error); - }); - }); - }); - - describe('failed', function() { - it('Test if the fail function works on not existing files.', function(done) { - new Converter({ - files: ['x.ppt'], - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: false, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }) - .wait() - .then(function(data) { - if (data.failed.length > 0 || data.success.length < 1) { - done(); - } else { - done('error'); - } - }) - .catch(function(error) { - done(error); - }); - }); - }); - - describe('add files', function() { - it('Test the addFiles function.', function(done) { - var convertTest = new Converter({ - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: false, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }); - - convertTest.addFiles(['test/OPW 733 Tienduizend redenen.ppt']); - - if (convertTest.files.length > 0) { - done(); - } else { - done('error'); - } - }); - }); - - describe('reset failed', function() { - it('Test the resetFailed function.', function(done) { - var convertTest = new Converter({ - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: false, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }); - - convertTest.failed = new Arr([{ - file: 'test/OPW 733 Tienduizend redenen.ppt' - }]); - convertTest.resetFailed(); - - if (convertTest.failed.length < 1 && convertTest.files.length == 1) { - done(); - } else { - done('error'); - } - }); - }); - - describe('fail', function() { - it('Test if the fail function works.', function(done) { - var convertTest = new Converter({ - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: false, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }); - - convertTest - .wait() - .then(function(data) { - convertTest.fail('test'); - if (data.failed.length > 0) { - done(); - } else { - done('error'); - } - }) - .catch(function(error) { - done(error); - }); - }); - }); - - describe('convert to png', function() { - it('Check if the convert to png works.', function(done) { - var convertTest = new Converter({ - files: ['test/OPW 733 Tienduizend redenen.ppt'], - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: false, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }).run(); - - var file = convertTest.convertedToPdf(1, [733], 'OPW 733 Tienduizend redenen', false); - - fs.readFile(file, function(error, data) { - if (error) { - done(error); - } else { - done(); - } - }); - }); - }); - - describe('process page', function() { - it('Check if the process page to png works.', function(done) { - var convertTest = new Converter({ - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: false, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }); - - convertTest.processPage('test/OPW 733 Tienduizend redenen.ppt', true, null); - - convertTest.wait() - .then(function(data) { - if (data.failed.length > 0 || data.success.length < 1) { - done(); - } else { - done('error'); - } - }) - .catch(function(error) { - done(error); - }); - }); - }); - - describe('convert', function() { - it('Check if the convert fail works.', function(done) { - var convertTest = new Converter({ - output: 'output/test/', - invert: true, - greyscale: true, - deletePdfFile: true, - outputType: 'png', - logLevel: 0, - fileNameFormat: '_vers_%d' - }); - - console.log(convertTest.convert()); - if (convertTest.convert()) { - done('error'); - } else { - done(); - } - }); - }); -}); From ff046c6b315a98712f086f64202f01afeaab935a Mon Sep 17 00:00:00 2001 From: Pieter Wigboldus Date: Wed, 6 Jan 2021 08:59:28 +0100 Subject: [PATCH 2/2] Change version to 1.1.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9cb0954..a19ee85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ppt-png", - "version": "1.2.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6724465..e75ccaa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ppt-png", - "version": "1.2.0", + "version": "1.1.1", "description": "Convert ppt to image (png,jpg)", "files": [ "src/converter.js",