From ed19851f1998d986193f159829a0730b7e88ad99 Mon Sep 17 00:00:00 2001 From: Harsh Ankur Date: Mon, 21 Oct 2024 22:55:19 +0200 Subject: [PATCH] Fixed #16, #34: Replaced extracting zip files from decompress to yauzl. This means that we now extract files in memory and we no longer need to write them to disk. Removed config flags related to extracted files. Added flags for CLI execution. --- README.md | 16 +- officeParser.js | 1126 +++++++++++----------- package-lock.json | 1658 +++------------------------------ package.json | 9 +- test/testOfficeParser.js | 21 +- typings/officeParser.d.ts | 13 +- typings/officeParser.d.ts.map | 2 +- 7 files changed, 733 insertions(+), 2112 deletions(-) diff --git a/README.md b/README.md index a7f1136..8e94ced 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ A Node.js library to parse text out of any office file. #### Update +* 2024/10/21 - Replaced extracting zip files from decompress to yauzl. This means that we now extract files in memory and we no longer need to write them to disk. Removed config flags related to extracted files. Added flags for CLI execution. * 2024/10/15 - Fixed erroring out while deleting temp files when multiple worker threads make parallel executions resulting in same file name for multiple files. Fixed erroring out when multiple executions are made without waiting for the previous execution to finish which resulted in deleting the file from other execution. Upgraded dependencies. * 2024/10/13 - Fixed parsing text from xlsx files which contain no shared strings file and files which have inlineStr based strings. * 2024/05/06 - Replaced pdf parsing support from pdf-parse library to natively building it using pdf.js library from Mozilla by analyzing its output. Added pdfjs-dist build as a local library. @@ -37,7 +38,6 @@ A Node.js library to parse text out of any office file. ## Install via npm - ``` npm i officeparser ``` @@ -45,14 +45,20 @@ npm i officeparser ## Command Line usage If you want to call the installed officeParser.js file, use below command ``` -node +node [--configOption=value] [FILE_PATH] +node officeparser [--configOption=value] [FILE_PATH] ``` -Otherwise, you can simply use npx to instantly extract parsed data. +Otherwise, you can simply use npx without installing the node module to instantly extract parsed data. ``` -npx officeparser +npx officeparser [--configOption=value] [FILE_PATH] ``` +### Config Options: +- `--ignoreNotes=[true|false]` Flag to ignore notes from files like PowerPoint. Default is false. +- `--newlineDelimiter=[delimiter]` The delimiter to use for new lines. Default is `\n`. +- `--putNotesAtLast=[true|false]` Flag to collect notes at the end of files like PowerPoint. Default is false. +- `--outputErrorToConsole=[true|false]` Flag to output errors to the console. Default is false. ## Library Usage ```js @@ -101,8 +107,6 @@ officeParser.parseOfficeAsync(fileBuffers); *Optionally add a config object as 3rd variable to parseOffice for the following configurations* | Flag | DataType | Default | Explanation | |----------------------|----------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| tempFilesLocation | string | officeParserTemp | The directory where officeparser stores the temp files . The final decompressed data will be put inside officeParserTemp folder within your directory. **Please ensure that this directory actually exists.** Default is officeParserTemp. | -| preserveTempFiles | boolean | false | Flag to not delete the internal content files and the possible duplicate temp files that it uses after unzipping office files. Default is false. It always deletes all of those files. | | outputErrorToConsole | boolean | false | Flag to show all the logs to console in case of an error. Default is false. | | newlineDelimiter | string | \n | The delimiter used for every new line in places that allow multiline text like word. Default is \n. | | ignoreNotes | boolean | false | Flag to ignore notes from parsing in files like powerpoint. Default is false. It includes notes in the parsed text by default. | diff --git a/officeParser.js b/officeParser.js index 5047cd5..844c536 100755 --- a/officeParser.js +++ b/officeParser.js @@ -1,11 +1,13 @@ #!/usr/bin/env node -const decompress = require('decompress'); -const fs = require('fs'); -const { rimrafSync } = require('rimraf'); -const fileType = require('file-type'); -const pdfjs = require('./pdfjs-dist-build/pdf.js'); -const { DOMParser } = require('@xmldom/xmldom'); +// @ts-check + +const concat = require('concat-stream'); +const { DOMParser } = require('@xmldom/xmldom'); +const fileType = require('file-type'); +const fs = require('fs'); +const pdfjs = require('./pdfjs-dist-build/pdf.js'); +const yauzl = require('yauzl'); /** Header for error messages */ const ERRORHEADER = "[OfficeParser]: "; @@ -16,20 +18,8 @@ const ERRORMSG = { fileDoesNotExist: (filepath) => `File ${filepath} could not be found! Check if the file exists or verify if the relative path to the file is correct from your terminal's location.`, locationNotFound: (location) => `Entered location ${location} is not reachable! Please make sure that the entered directory location exists. Check relative paths and reenter.`, improperArguments: `Improper arguments`, - improperBuffers: `Error occured while reading the file buffers` -} -/** Default sublocation for decompressing files under the current directory. */ -const DEFAULTDECOMPRESSSUBLOCATION = "officeParserTemp"; - -/** Console error if allowed - * @param {string} errorMessage Error message to show on the console - * @param {string} outputErrorToConsole Flag to show log on console. Ignore if not true. - * @returns {void} - */ -function consoleError(errorMessage, outputErrorToConsole) { - if (!errorMessage || !outputErrorToConsole) - return; - console.error(ERRORHEADER + errorMessage); + improperBuffers: `Error occured while reading the file buffers`, + invalidInput: `Invalid input type: Expected a Buffer or a valid file path` } /** Returns parsed xml document for a given xml text. @@ -42,9 +32,7 @@ const parseString = (xml) => { }; /** @typedef {Object} OfficeParserConfig - * @property {string} [tempFilesLocation] The directory where officeparser stores the temp files . The final decompressed data will be put inside officeParserTemp folder within your directory. Please ensure that this directory actually exists. Default is officeParsertemp. - * @property {boolean} [preserveTempFiles] Flag to not delete the internal content files and the duplicate temp files that it uses after unzipping office files. Default is false. It deletes all of those files. - * @property {boolean} [outputErrorToConsole] Flag to show all the logs to console in case of an error irrespective of your own handling. + * @property {boolean} [outputErrorToConsole] Flag to show all the logs to console in case of an error irrespective of your own handling. Default is false. * @property {string} [newlineDelimiter] The delimiter used for every new line in places that allow multiline text like word. Default is \n. * @property {boolean} [ignoreNotes] Flag to ignore notes from parsing in files like powerpoint. Default is false. It includes notes in the parsed text by default. * @property {boolean} [putNotesAtLast] Flag, if set to true, will collectively put all the parsed text from notes at last in files like powerpoint. Default is false. It puts each notes right after its main slide content. If ignoreNotes is set to true, this flag is also ignored. @@ -52,469 +40,442 @@ const parseString = (xml) => { /** Main function for parsing text from word files - * @param {string} filepath File path + * @param {string | Buffer} file File path or Buffers * @param {function} callback Callback function that returns value or error * @param {OfficeParserConfig} config Config Object for officeParser * @returns {void} */ -function parseWord(filepath, callback, config) { +function parseWord(file, callback, config) { /** The target content xml file for the docx file. */ const mainContentFileRegex = /word\/document[\d+]?.xml/g; const footnotesFileRegex = /word\/footnotes[\d+]?.xml/g; const endnotesFileRegex = /word\/endnotes[\d+]?.xml/g; - /** The decompress location which contains the filename in it */ - const decompressLocation = `${config.tempFilesLocation}/${filepath.split("/").pop()}`; - decompress(filepath, - decompressLocation, - { filter: x => [mainContentFileRegex, footnotesFileRegex, endnotesFileRegex].some(fileRegex => x.path.match(fileRegex)) } - ) - .then(files => { - // Verify if atleast the document xml file exists in the extracted files list. - if (!files.some(file => file.path.match(mainContentFileRegex))) - throw ERRORMSG.fileCorrupted(filepath); + + extractFiles(file, x => [mainContentFileRegex, footnotesFileRegex, endnotesFileRegex].some(fileRegex => x.match(fileRegex))) + .then(files => { + // Verify if atleast the document xml file exists in the extracted files list. + if (!files.some(file => file.path.match(mainContentFileRegex))) + throw ERRORMSG.fileCorrupted(file); return files .filter(file => file.path.match(mainContentFileRegex) || file.path.match(footnotesFileRegex) || file.path.match(endnotesFileRegex)) - .map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8')); - }) - // ************************************* word xml files explanation ************************************* - // Structure of xmlContent of a word file is simple. - // All text nodes are within w:t tags and each of the text nodes that belong in one paragraph are clubbed together within a w:p tag. - // So, we will filter out all the empty w:p tags and then combine all the w:t tag text inside for creating our response text. - // ****************************************************************************************************** - .then(xmlContentArray => { - /** Store all the text content to respond */ - let responseText = []; - - xmlContentArray.forEach(xmlContent => { - /** Find text nodes with w:p tags */ - const xmlParagraphNodesList = parseString(xmlContent).getElementsByTagName("w:p"); - /** Store all the text content to respond */ - responseText.push( - Array.from(xmlParagraphNodesList) - // Filter paragraph nodes than do not have any text nodes which are identifiable by w:t tag - .filter(paragraphNode => paragraphNode.getElementsByTagName("w:t").length != 0) - .map(paragraphNode => { - // Find text nodes with w:t tags - const xmlTextNodeList = paragraphNode.getElementsByTagName("w:t"); - // Join the texts within this paragraph node without any spaces or delimiters. - return Array.from(xmlTextNodeList) - .filter(textNode => textNode.childNodes[0] && textNode.childNodes[0].nodeValue) - .map(textNode => textNode.childNodes[0].nodeValue) - .join(""); - }) - // Join each paragraph text with a new line delimiter. - .join(config.newlineDelimiter ?? "\n") - ); - }); - - // Join all responseText array - responseText = responseText.join(config.newlineDelimiter ?? "\n"); - // Respond by calling the Callback function. - callback(responseText, undefined); - }) - .catch(e => callback(undefined, e)); + .map(file => file.content); + }) + // ************************************* word xml files explanation ************************************* + // Structure of xmlContent of a word file is simple. + // All text nodes are within w:t tags and each of the text nodes that belong in one paragraph are clubbed together within a w:p tag. + // So, we will filter out all the empty w:p tags and then combine all the w:t tag text inside for creating our response text. + // ****************************************************************************************************** + .then(xmlContentArray => { + /** Store all the text content to respond. */ + let responseText = []; + + xmlContentArray.forEach(xmlContent => { + /** Find text nodes with w:p tags */ + const xmlParagraphNodesList = parseString(xmlContent).getElementsByTagName("w:p"); + /** Store all the text content to respond */ + responseText.push( + Array.from(xmlParagraphNodesList) + // Filter paragraph nodes than do not have any text nodes which are identifiable by w:t tag + .filter(paragraphNode => paragraphNode.getElementsByTagName("w:t").length != 0) + .map(paragraphNode => { + // Find text nodes with w:t tags + const xmlTextNodeList = paragraphNode.getElementsByTagName("w:t"); + // Join the texts within this paragraph node without any spaces or delimiters. + return Array.from(xmlTextNodeList) + .filter(textNode => textNode.childNodes[0] && textNode.childNodes[0].nodeValue) + .map(textNode => textNode.childNodes[0].nodeValue) + .join(""); + }) + // Join each paragraph text with a new line delimiter. + .join(config.newlineDelimiter ?? "\n") + ); + }); + + // Respond by calling the Callback function. + callback(responseText.join(config.newlineDelimiter ?? "\n"), undefined); + }) + .catch(e => callback(undefined, e)); } /** Main function for parsing text from PowerPoint files - * @param {string} filepath File path + * @param {string | Buffer} file File path or Buffers * @param {function} callback Callback function that returns value or error * @param {OfficeParserConfig} config Config Object for officeParser * @returns {void} */ -function parsePowerPoint(filepath, callback, config) { +function parsePowerPoint(file, callback, config) { // Files regex that hold our content of interest const allFilesRegex = /ppt\/(notesSlides|slides)\/(notesSlide|slide)\d+.xml/g; const slidesRegex = /ppt\/slides\/slide\d+.xml/g; const slideNumberRegex = /lide(\d+)\.xml/; - /** The decompress location which contains the filename in it */ - const decompressLocation = `${config.tempFilesLocation}/${filepath.split("/").pop()}`; - decompress(filepath, - decompressLocation, - { filter: x => x.path.match(config.ignoreNotes ? slidesRegex : allFilesRegex) } - ) - .then(files => { - // Sort files by slide number and their notes (if any). - files.sort((a, b) => { - const matchedANumber = parseInt(a.path.match(slideNumberRegex)?.at(1), 10); - const matchedBNumber = parseInt(b.path.match(slideNumberRegex)?.at(1), 10); - - const aNumber = isNaN(matchedANumber) ? Infinity : matchedANumber; - const bNumber = isNaN(matchedBNumber) ? Infinity : matchedBNumber; - - return aNumber - bNumber || Number(a.path.includes('notes')) - Number(b.path.includes('notes')); - }); - - // Verify if atleast the slides xml files exist in the extracted files list. - if (files.length == 0 || !files.map(file => file.path).some(filename => filename.match(slidesRegex))) - throw ERRORMSG.fileCorrupted(filepath); - - // Check if any sorting is required. - if (!config.ignoreNotes && config.putNotesAtLast) - // Sort files according to previous order of taking text out of ppt/slides followed by ppt/notesSlides - // For this we are looking at the index of notes which results in -1 in the main slide file and exists at a certain index in notes file names. - files.sort((a,b) => a.path.indexOf("notes") - b.path.indexOf("notes")); - - // Returning an array of all the xml contents read using fs.readFileSync - return files.map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8')); - }) - // ******************************** powerpoint xml files explanation ************************************ - // Structure of xmlContent of a powerpoint file is simple. - // There are multiple xml files for each slide and correspondingly their notesSlide files. - // All text nodes are within a:t tags and each of the text nodes that belong in one paragraph are clubbed together within a a:p tag. - // So, we will filter out all the empty a:p tags and then combine all the a:t tag text inside for creating our response text. - // ****************************************************************************************************** - .then(xmlContentArray => { - /** Store all the text content to respond */ - let responseText = []; - - xmlContentArray.forEach(xmlContent => { - /** Find text nodes with a:p tags */ - const xmlParagraphNodesList = parseString(xmlContent).getElementsByTagName("a:p"); + extractFiles(file, x => !!x.match(config.ignoreNotes ? slidesRegex : allFilesRegex)) + .then(files => { + // Sort files by slide number and their notes (if any). + files.sort((a, b) => { + const matchedANumber = parseInt(a.path.match(slideNumberRegex)?.at(1), 10); + const matchedBNumber = parseInt(b.path.match(slideNumberRegex)?.at(1), 10); + + const aNumber = isNaN(matchedANumber) ? Infinity : matchedANumber; + const bNumber = isNaN(matchedBNumber) ? Infinity : matchedBNumber; + + return aNumber - bNumber || Number(a.path.includes('notes')) - Number(b.path.includes('notes')); + }); + + // Verify if atleast the slides xml files exist in the extracted files list. + if (files.length == 0 || !files.map(file => file.path).some(filename => filename.match(slidesRegex))) + throw ERRORMSG.fileCorrupted(file); + + // Check if any sorting is required. + if (!config.ignoreNotes && config.putNotesAtLast) + // Sort files according to previous order of taking text out of ppt/slides followed by ppt/notesSlides + // For this we are looking at the index of notes which results in -1 in the main slide file and exists at a certain index in notes file names. + files.sort((a, b) => a.path.indexOf("notes") - b.path.indexOf("notes")); + + // Returning an array of all the xml contents read using fs.readFileSync + return files.map(file => file.content); + }) + // ******************************** powerpoint xml files explanation ************************************ + // Structure of xmlContent of a powerpoint file is simple. + // There are multiple xml files for each slide and correspondingly their notesSlide files. + // All text nodes are within a:t tags and each of the text nodes that belong in one paragraph are clubbed together within a a:p tag. + // So, we will filter out all the empty a:p tags and then combine all the a:t tag text inside for creating our response text. + // ****************************************************************************************************** + .then(xmlContentArray => { /** Store all the text content to respond */ - responseText.push( - Array.from(xmlParagraphNodesList) - // Filter paragraph nodes than do not have any text nodes which are identifiable by a:t tag - .filter(paragraphNode => paragraphNode.getElementsByTagName("a:t").length != 0) - .map(paragraphNode => { - /** Find text nodes with a:t tags */ - const xmlTextNodeList = paragraphNode.getElementsByTagName("a:t"); - return Array.from(xmlTextNodeList) - .filter(textNode => textNode.childNodes[0] && textNode.childNodes[0].nodeValue) - .map(textNode => textNode.childNodes[0].nodeValue) - .join(""); - }) - .join(config.newlineDelimiter ?? "\n") - ); - }); - - // Join all responseText array - responseText = responseText.join(config.newlineDelimiter ?? "\n"); - // Respond by calling the Callback function. - callback(responseText, undefined); - }) - .catch(e => callback(undefined, e)); + let responseText = []; + + xmlContentArray.forEach(xmlContent => { + /** Find text nodes with a:p tags */ + const xmlParagraphNodesList = parseString(xmlContent).getElementsByTagName("a:p"); + /** Store all the text content to respond */ + responseText.push( + Array.from(xmlParagraphNodesList) + // Filter paragraph nodes than do not have any text nodes which are identifiable by a:t tag + .filter(paragraphNode => paragraphNode.getElementsByTagName("a:t").length != 0) + .map(paragraphNode => { + /** Find text nodes with a:t tags */ + const xmlTextNodeList = paragraphNode.getElementsByTagName("a:t"); + return Array.from(xmlTextNodeList) + .filter(textNode => textNode.childNodes[0] && textNode.childNodes[0].nodeValue) + .map(textNode => textNode.childNodes[0].nodeValue) + .join(""); + }) + .join(config.newlineDelimiter ?? "\n") + ); + }); + + // Respond by calling the Callback function. + callback(responseText.join(config.newlineDelimiter ?? "\n"), undefined); + }) + .catch(e => callback(undefined, e)); } /** Main function for parsing text from Excel files - * @param {string} filepath File path + * @param {string | Buffer} file File path or Buffers * @param {function} callback Callback function that returns value or error * @param {OfficeParserConfig} config Config Object for officeParser * @returns {void} */ -function parseExcel(filepath, callback, config) { +function parseExcel(file, callback, config) { // Files regex that hold our content of interest const sheetsRegex = /xl\/worksheets\/sheet\d+.xml/g; const drawingsRegex = /xl\/drawings\/drawing\d+.xml/g; const chartsRegex = /xl\/charts\/chart\d+.xml/g; const stringsFilePath = 'xl/sharedStrings.xml'; - /** The decompress location which contains the filename in it */ - const decompressLocation = `${config.tempFilesLocation}/${filepath.split("/").pop()}`; - decompress(filepath, - decompressLocation, - { filter: x => [sheetsRegex, drawingsRegex, chartsRegex].some(fileRegex => x.path.match(fileRegex)) || x.path == stringsFilePath } - ) - .then(files => { - // Verify if atleast the slides xml files exist in the extracted files list. - if (files.length == 0 || !files.map(file => file.path).some(filename => filename.match(sheetsRegex))) - throw ERRORMSG.fileCorrupted(filepath); - - return { - sheetFiles: files.filter(file => file.path.match(sheetsRegex)).map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8')), - drawingFiles: files.filter(file => file.path.match(drawingsRegex)).map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8')), - chartFiles: files.filter(file => file.path.match(chartsRegex)).map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8')), - sharedStringsFile: files.filter(file => file.path == stringsFilePath).map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8'))[0], - }; - }) - // ********************************** excel xml files explanation *************************************** - // Structure of xmlContent of an excel file is a bit complex. - // We usually have a sharedStrings.xml file which has strings inside t tags - // However, this file is not necessary to be present. It is sometimes absent if the file has no shared strings indices represented in v nodes. - // Each sheet has an individual sheet xml file which has numbers in v tags (probably value) inside c tags (probably cell) - // Each value of v tag is to be used as it is if the "t" attribute (probably type) of c tag is not "s" (probably shared string) - // If the "t" attribute of c tag is "s", then we use the value to select value from sharedStrings array with the value as its index. - // However, if the "t" attribute of c tag is "inlineStr", strings can be inline inside "is"(probably inside String) > "t". - // We extract either the inline strings or use the value to get numbers of text from shared strings. - // Drawing files contain all text for each drawing and have text nodes in a:t and paragraph nodes in a:p. - // ****************************************************************************************************** - .then(xmlContentFilesObject => { - /** Store all the text content to respond */ - let responseText = []; - - /** Function to check if the given c node is a valid inline string node. */ - function isValidInlineStringCNode(cNode) { - // Initial check to see if the passed node is a cNode - if (cNode.tagName.toLowerCase() != 'c') - return false; - if (cNode.getAttribute("t") != 'inlineStr') - return false; - const childNodesNamedIs = cNode.getElementsByTagName('is'); - if (childNodesNamedIs.length != 1) - return false; - const childNodesNamedT = childNodesNamedIs[0].getElementsByTagName('t'); - if (childNodesNamedT.length != 1) - return false; - return childNodesNamedT[0].childNodes[0] && childNodesNamedT[0].childNodes[0].nodeValue != ''; - } + extractFiles(file, x => [sheetsRegex, drawingsRegex, chartsRegex].some(fileRegex => x.match(fileRegex)) || x == stringsFilePath) + .then(files => { + // Verify if atleast the slides xml files exist in the extracted files list. + if (files.length == 0 || !files.map(file => file.path).some(filename => filename.match(sheetsRegex))) + throw ERRORMSG.fileCorrupted(file); + + return { + sheetFiles: files.filter(file => file.path.match(sheetsRegex)).map(file => file.content), + drawingFiles: files.filter(file => file.path.match(drawingsRegex)).map(file => file.content), + chartFiles: files.filter(file => file.path.match(chartsRegex)).map(file => file.content), + sharedStringsFile: files.filter(file => file.path == stringsFilePath).map(file => file.content)[0], + }; + }) + // ********************************** excel xml files explanation *************************************** + // Structure of xmlContent of an excel file is a bit complex. + // We usually have a sharedStrings.xml file which has strings inside t tags + // However, this file is not necessary to be present. It is sometimes absent if the file has no shared strings indices represented in v nodes. + // Each sheet has an individual sheet xml file which has numbers in v tags (probably value) inside c tags (probably cell) + // Each value of v tag is to be used as it is if the "t" attribute (probably type) of c tag is not "s" (probably shared string) + // If the "t" attribute of c tag is "s", then we use the value to select value from sharedStrings array with the value as its index. + // However, if the "t" attribute of c tag is "inlineStr", strings can be inline inside "is"(probably inside String) > "t". + // We extract either the inline strings or use the value to get numbers of text from shared strings. + // Drawing files contain all text for each drawing and have text nodes in a:t and paragraph nodes in a:p. + // ****************************************************************************************************** + .then(xmlContentFilesObject => { + /** Store all the text content to respond */ + let responseText = []; + + /** Function to check if the given c node is a valid inline string node. */ + function isValidInlineStringCNode(cNode) { + // Initial check to see if the passed node is a cNode + if (cNode.tagName.toLowerCase() != 'c') + return false; + if (cNode.getAttribute("t") != 'inlineStr') + return false; + const childNodesNamedIs = cNode.getElementsByTagName('is'); + if (childNodesNamedIs.length != 1) + return false; + const childNodesNamedT = childNodesNamedIs[0].getElementsByTagName('t'); + if (childNodesNamedT.length != 1) + return false; + return childNodesNamedT[0].childNodes[0] && childNodesNamedT[0].childNodes[0].nodeValue != ''; + } - /** Function to check if the given c node has a valid v node */ - function hasValidVNodeInCNode(cNode) { - return cNode.getElementsByTagName("v")[0] - && cNode.getElementsByTagName("v")[0].childNodes[0] - && cNode.getElementsByTagName("v")[0].childNodes[0].nodeValue != '' - } + /** Function to check if the given c node has a valid v node */ + function hasValidVNodeInCNode(cNode) { + return cNode.getElementsByTagName("v")[0] + && cNode.getElementsByTagName("v")[0].childNodes[0] + && cNode.getElementsByTagName("v")[0].childNodes[0].nodeValue != '' + } - /** Find text nodes with t tags in sharedStrings xml file. If the sharedStringsFile is not present, we return an empty array. */ - const sharedStringsXmlTNodesList = xmlContentFilesObject.sharedStringsFile != undefined ? parseString(xmlContentFilesObject.sharedStringsFile).getElementsByTagName("t") - : []; - /** Create shared string array. This will be used as a map to get strings from within sheet files. */ - const sharedStrings = Array.from(sharedStringsXmlTNodesList) - .map(tNode => tNode.childNodes[0]?.nodeValue ?? ''); - - // Parse Sheet files - xmlContentFilesObject.sheetFiles.forEach(sheetXmlContent => { - /** Find text nodes with c tags in sharedStrings xml file */ - const sheetsXmlCNodesList = parseString(sheetXmlContent).getElementsByTagName("c"); - // Traverse through the nodes list and fill responseText with either the number value in its v node or find a mapped string from sharedStrings or an inline string. - responseText.push( - Array.from(sheetsXmlCNodesList) - // Filter out invalid c nodes - .filter(cNode => isValidInlineStringCNode(cNode) || hasValidVNodeInCNode(cNode)) - .map(cNode => { - // Processing if this is a valid inline string c node. - if (isValidInlineStringCNode(cNode)) - return cNode.getElementsByTagName('is')[0].getElementsByTagName('t')[0].childNodes[0].nodeValue; - - // Processing if this c node has a valid v node. - if (hasValidVNodeInCNode(cNode)) { - /** Flag whether this node's value represents an index in the shared string array */ - const isIndexInSharedStrings = cNode.getAttribute("t") == "s"; - /** Find value nodes represented by v tags */ - const value = cNode.getElementsByTagName("v")[0].childNodes[0].nodeValue; - // Validate text - if (isIndexInSharedStrings && value >= sharedStrings.length) - throw ERRORMSG.fileCorrupted(filepath); - - return isIndexInSharedStrings - ? sharedStrings[value] - : value; - } - // TODO: Add debug asserts for if we reach here which would mean we are filtering more items than we are processing. - // Not the case now but it could happen and it is better to be safe. - return ''; - }) - // Join each cell text within a sheet with a space. - .join(config.newlineDelimiter ?? "\n") - ); - }); - - // Parse Drawing files - xmlContentFilesObject.drawingFiles.forEach(drawingXmlContent => { - /** Find text nodes with a:p tags */ - const drawingsXmlParagraphNodesList = parseString(drawingXmlContent).getElementsByTagName("a:p"); - /** Store all the text content to respond */ - responseText.push( - Array.from(drawingsXmlParagraphNodesList) - // Filter paragraph nodes than do not have any text nodes which are identifiable by a:t tag - .filter(paragraphNode => paragraphNode.getElementsByTagName("a:t").length != 0) - .map(paragraphNode => { - /** Find text nodes with a:t tags */ - const xmlTextNodeList = paragraphNode.getElementsByTagName("a:t"); - return Array.from(xmlTextNodeList) - .filter(textNode => textNode.childNodes[0] && textNode.childNodes[0].nodeValue) - .map(textNode => textNode.childNodes[0].nodeValue) - .join(""); - }) - .join(config.newlineDelimiter ?? "\n") - ); - }); - - // Parse Chart files - xmlContentFilesObject.chartFiles.forEach(chartXmlContent => { - /** Find text nodes with c:v tags */ - const chartsXmlCVNodesList = parseString(chartXmlContent).getElementsByTagName("c:v"); - /** Store all the text content to respond */ - responseText.push( - Array.from(chartsXmlCVNodesList) - .filter(cVNode => cVNode.childNodes[0] && cVNode.childNodes[0].nodeValue) - .map(cVNode => cVNode.childNodes[0].nodeValue) - .join(config.newlineDelimiter ?? "\n") - ); - }); - - // Join all responseText array - responseText = responseText.join(config.newlineDelimiter ?? "\n"); - // Respond by calling the Callback function. - callback(responseText, undefined); - }) - .catch(e => callback(undefined, e)); + /** Find text nodes with t tags in sharedStrings xml file. If the sharedStringsFile is not present, we return an empty array. */ + const sharedStringsXmlTNodesList = xmlContentFilesObject.sharedStringsFile != undefined ? parseString(xmlContentFilesObject.sharedStringsFile).getElementsByTagName("t") + : []; + /** Create shared string array. This will be used as a map to get strings from within sheet files. */ + const sharedStrings = Array.from(sharedStringsXmlTNodesList) + .map(tNode => tNode.childNodes[0]?.nodeValue ?? ''); + + // Parse Sheet files + xmlContentFilesObject.sheetFiles.forEach(sheetXmlContent => { + /** Find text nodes with c tags in sharedStrings xml file */ + const sheetsXmlCNodesList = parseString(sheetXmlContent).getElementsByTagName("c"); + // Traverse through the nodes list and fill responseText with either the number value in its v node or find a mapped string from sharedStrings or an inline string. + responseText.push( + Array.from(sheetsXmlCNodesList) + // Filter out invalid c nodes + .filter(cNode => isValidInlineStringCNode(cNode) || hasValidVNodeInCNode(cNode)) + .map(cNode => { + // Processing if this is a valid inline string c node. + if (isValidInlineStringCNode(cNode)) + return cNode.getElementsByTagName('is')[0].getElementsByTagName('t')[0].childNodes[0].nodeValue; + + // Processing if this c node has a valid v node. + if (hasValidVNodeInCNode(cNode)) { + /** Flag whether this node's value represents an index in the shared string array */ + const isIndexInSharedStrings = cNode.getAttribute("t") == "s"; + /** Find value nodes represented by v tags */ + const value = parseInt(cNode.getElementsByTagName("v")[0].childNodes[0].nodeValue, 10); + // Validate text + if (isIndexInSharedStrings && value >= sharedStrings.length) + throw ERRORMSG.fileCorrupted(file); + + return isIndexInSharedStrings + ? sharedStrings[value] + : value; + } + // TODO: Add debug asserts for if we reach here which would mean we are filtering more items than we are processing. + // Not the case now but it could happen and it is better to be safe. + return ''; + }) + // Join each cell text within a sheet with a space. + .join(config.newlineDelimiter ?? "\n") + ); + }); + + // Parse Drawing files + xmlContentFilesObject.drawingFiles.forEach(drawingXmlContent => { + /** Find text nodes with a:p tags */ + const drawingsXmlParagraphNodesList = parseString(drawingXmlContent).getElementsByTagName("a:p"); + /** Store all the text content to respond */ + responseText.push( + Array.from(drawingsXmlParagraphNodesList) + // Filter paragraph nodes than do not have any text nodes which are identifiable by a:t tag + .filter(paragraphNode => paragraphNode.getElementsByTagName("a:t").length != 0) + .map(paragraphNode => { + /** Find text nodes with a:t tags */ + const xmlTextNodeList = paragraphNode.getElementsByTagName("a:t"); + return Array.from(xmlTextNodeList) + .filter(textNode => textNode.childNodes[0] && textNode.childNodes[0].nodeValue) + .map(textNode => textNode.childNodes[0].nodeValue) + .join(""); + }) + .join(config.newlineDelimiter ?? "\n") + ); + }); + + // Parse Chart files + xmlContentFilesObject.chartFiles.forEach(chartXmlContent => { + /** Find text nodes with c:v tags */ + const chartsXmlCVNodesList = parseString(chartXmlContent).getElementsByTagName("c:v"); + /** Store all the text content to respond */ + responseText.push( + Array.from(chartsXmlCVNodesList) + .filter(cVNode => cVNode.childNodes[0] && cVNode.childNodes[0].nodeValue) + .map(cVNode => cVNode.childNodes[0].nodeValue) + .join(config.newlineDelimiter ?? "\n") + ); + }); + + // Respond by calling the Callback function. + callback(responseText.join(config.newlineDelimiter ?? "\n"), undefined); + }) + .catch(e => callback(undefined, e)); } /** Main function for parsing text from open office files - * @param {string} filepath File path + * @param {string | Buffer} file File path or Buffers * @param {function} callback Callback function that returns value or error * @param {OfficeParserConfig} config Config Object for officeParser * @returns {void} */ -function parseOpenOffice(filepath, callback, config) { +function parseOpenOffice(file, callback, config) { /** The target content xml file for the openoffice file. */ const mainContentFilePath = 'content.xml'; const objectContentFilesRegex = /Object \d+\/content.xml/g; - /** The decompress location which contains the filename in it */ - const decompressLocation = `${config.tempFilesLocation}/${filepath.split("/").pop()}`; - decompress(filepath, - decompressLocation, - { filter: x => x.path == mainContentFilePath || x.path.match(objectContentFilesRegex) } - ) - .then(files => { - // Verify if atleast the content xml file exists in the extracted files list. - if (!files.map(file => file.path).includes(mainContentFilePath)) - throw ERRORMSG.fileCorrupted(filepath); - - return { - mainContentFile: files.filter(file => file.path == mainContentFilePath).map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8'))[0], - objectContentFiles: files.filter(file => file.path.match(objectContentFilesRegex)).map(file => fs.readFileSync(`${decompressLocation}/${file.path}`, 'utf8')), - } - }) - // ********************************** openoffice xml files explanation ********************************** - // Structure of xmlContent of openoffice files is simple. - // All text nodes are within text:h and text:p tags with all kinds of formatting within nested tags. - // All text in these tags are separated by new line delimiters. - // Objects like charts in ods files are in Object d+/content.xml with the same way as above. - // ****************************************************************************************************** - .then(xmlContentFilesObject => { - /** Store all the notes text content to respond */ - let notesText = []; - /** Store all the text content to respond */ - let responseText = []; - - /** List of allowed text tags */ - const allowedTextTags = ["text:p", "text:h"]; - /** List of notes tags */ - const notesTag = "presentation:notes"; - - /** Main dfs traversal function that goes from one node to its children and returns the value out. */ - function extractAllTextsFromNode(root) { - let xmlTextArray = [] - for (let i = 0; i < root.childNodes.length; i++) - traversal(root.childNodes[i], xmlTextArray, true); - return xmlTextArray.join(""); - } - /** Traversal function that gets recursive calling. */ - function traversal(node, xmlTextArray, isFirstRecursion) { - if(!node.childNodes || node.childNodes.length == 0) - { - if (node.parentNode.tagName.indexOf('text') == 0 && node.nodeValue) { - if (isNotesNode(node.parentNode) && (config.putNotesAtLast || config.ignoreNotes)) { - notesText.push(node.nodeValue); - if (allowedTextTags.includes(node.parentNode.tagName) && !isFirstRecursion) - notesText.push(config.newlineDelimiter ?? "\n"); - } - else { - xmlTextArray.push(node.nodeValue); - if (allowedTextTags.includes(node.parentNode.tagName) && !isFirstRecursion) - xmlTextArray.push(config.newlineDelimiter ?? "\n"); + extractFiles(file, x => x == mainContentFilePath || !!x.match(objectContentFilesRegex)) + .then(files => { + // Verify if atleast the content xml file exists in the extracted files list. + if (!files.map(file => file.path).includes(mainContentFilePath)) + throw ERRORMSG.fileCorrupted(file); + + return { + mainContentFile: files.filter(file => file.path == mainContentFilePath).map(file => file.content)[0], + objectContentFiles: files.filter(file => file.path.match(objectContentFilesRegex)).map(file => file.content), + } + }) + // ********************************** openoffice xml files explanation ********************************** + // Structure of xmlContent of openoffice files is simple. + // All text nodes are within text:h and text:p tags with all kinds of formatting within nested tags. + // All text in these tags are separated by new line delimiters. + // Objects like charts in ods files are in Object d+/content.xml with the same way as above. + // ****************************************************************************************************** + .then(xmlContentFilesObject => { + /** Store all the notes text content to respond */ + let notesText = []; + /** Store all the text content to respond */ + let responseText = []; + + /** List of allowed text tags */ + const allowedTextTags = ["text:p", "text:h"]; + /** List of notes tags */ + const notesTag = "presentation:notes"; + + /** Main dfs traversal function that goes from one node to its children and returns the value out. */ + function extractAllTextsFromNode(root) { + let xmlTextArray = [] + for (let i = 0; i < root.childNodes.length; i++) + traversal(root.childNodes[i], xmlTextArray, true); + return xmlTextArray.join(""); + } + /** Traversal function that gets recursive calling. */ + function traversal(node, xmlTextArray, isFirstRecursion) { + if (!node.childNodes || node.childNodes.length == 0) { + if (node.parentNode.tagName.indexOf('text') == 0 && node.nodeValue) { + if (isNotesNode(node.parentNode) && (config.putNotesAtLast || config.ignoreNotes)) { + notesText.push(node.nodeValue); + if (allowedTextTags.includes(node.parentNode.tagName) && !isFirstRecursion) + notesText.push(config.newlineDelimiter ?? "\n"); + } + else { + xmlTextArray.push(node.nodeValue); + if (allowedTextTags.includes(node.parentNode.tagName) && !isFirstRecursion) + xmlTextArray.push(config.newlineDelimiter ?? "\n"); + } } + return; } - return; - } - for (let i = 0; i < node.childNodes.length; i++) - traversal(node.childNodes[i], xmlTextArray, false); - } + for (let i = 0; i < node.childNodes.length; i++) + traversal(node.childNodes[i], xmlTextArray, false); + } - /** Checks if the given node has an ancestor which is a notes tag. We use this information to put the notes in the response text and its position. */ - function isNotesNode(node) { - if (node.tagName == notesTag) - return true; - if (node.parentNode) - return isNotesNode(node.parentNode); - return false; - } + /** Checks if the given node has an ancestor which is a notes tag. We use this information to put the notes in the response text and its position. */ + function isNotesNode(node) { + if (node.tagName == notesTag) + return true; + if (node.parentNode) + return isNotesNode(node.parentNode); + return false; + } - /** Checks if the given node has an ancestor which is also an allowed text tag. In that case, we ignore the child text tag. */ - function isInvalidTextNode(node) { - if (allowedTextTags.includes(node.tagName)) - return true; - if (node.parentNode) - return isInvalidTextNode(node.parentNode); - return false; - } + /** Checks if the given node has an ancestor which is also an allowed text tag. In that case, we ignore the child text tag. */ + function isInvalidTextNode(node) { + if (allowedTextTags.includes(node.tagName)) + return true; + if (node.parentNode) + return isInvalidTextNode(node.parentNode); + return false; + } - /** The xml string parsed as xml array */ - const xmlContentArray = [xmlContentFilesObject.mainContentFile, ...xmlContentFilesObject.objectContentFiles].map(xmlContent => parseString(xmlContent)); - // Iterate over each xmlContent and extract text from them. - xmlContentArray.forEach(xmlContent => { - /** Find text nodes with text:h and text:p tags in xmlContent */ - const xmlTextNodesList = [...Array.from(xmlContent - .getElementsByTagName("*")) - .filter(node => allowedTextTags.includes(node.tagName) - && !isInvalidTextNode(node.parentNode)) - ]; - /** Store all the text content to respond */ - responseText.push( - xmlTextNodesList - // Add every text information from within this textNode and combine them together. - .map(textNode => extractAllTextsFromNode(textNode)) - .filter(text => text != "") - .join(config.newlineDelimiter ?? "\n") - ); - }); - - // Add notes text at the end if the user config says so. - // Note that we already have pushed the text content to notesText array while extracting all texts from the nodes. - if (!config.ignoreNotes && config.putNotesAtLast) - responseText = [...responseText, ...notesText]; - - // Join all responseText array - responseText = responseText.join(config.newlineDelimiter ?? "\n"); - // Respond by calling the Callback function. - callback(responseText, undefined); - }) - .catch(e => callback(undefined, e)); + /** The xml string parsed as xml array */ + const xmlContentArray = [xmlContentFilesObject.mainContentFile, ...xmlContentFilesObject.objectContentFiles].map(xmlContent => parseString(xmlContent)); + // Iterate over each xmlContent and extract text from them. + xmlContentArray.forEach(xmlContent => { + /** Find text nodes with text:h and text:p tags in xmlContent */ + const xmlTextNodesList = [...Array.from(xmlContent + .getElementsByTagName("*")) + .filter(node => allowedTextTags.includes(node.tagName) + && !isInvalidTextNode(node.parentNode)) + ]; + /** Store all the text content to respond */ + responseText.push( + xmlTextNodesList + // Add every text information from within this textNode and combine them together. + .map(textNode => extractAllTextsFromNode(textNode)) + .filter(text => text != "") + .join(config.newlineDelimiter ?? "\n") + ); + }); + + // Add notes text at the end if the user config says so. + // Note that we already have pushed the text content to notesText array while extracting all texts from the nodes. + if (!config.ignoreNotes && config.putNotesAtLast) + responseText = [...responseText, ...notesText]; + + // Respond by calling the Callback function. + callback(responseText.join(config.newlineDelimiter ?? "\n"), undefined); + }) + .catch(e => callback(undefined, e)); } /** Main function for parsing text from pdf files - * @param {string} filepath File path + * @param {string | Buffer} file File path or Buffers * @param {function} callback Callback function that returns value or error * @param {OfficeParserConfig} config Config Object for officeParser * @returns {void} */ -function parsePdf(filepath, callback, config) { - // Get the pdfjs document for the filepath. - pdfjs.getDocument(filepath).promise - // We go through each page and build our text content promise array. - .then(document => Promise.all(Array.from({ length: document.numPages }, (_, index) => index + 1).map(pageNr => document.getPage(pageNr).then(page => page.getTextContent())))) - // Each textContent item has property 'items' which is an array of objects. - // Each object element in the array has text stored in their 'str' key. - // The concatenation of str is what makes our pdf content. - // str already contains any space that was in the text. - // So, we only care about when to add the new line. - // That we determine using transform[5] value which is the y-coordinate of the item object. - // So, if there is a mismatch in the transform[5] value between the current item and the previous item, we put a line break. - .then(textContentArray => { - /** Store all the text content to respond */ - const responseText = textContentArray - .map(textContent => textContent.items) // Get all the items - .flat() // Flatten all the items object - .filter(item => item.str != '') // Ignore the empty string items. - .reduce((a, v) => ( - { - text: a.text + (v.transform[5] != a.transform5 ? (config.newlineDelimiter ?? "\n") : '') + v.str, - transform5: v.transform[5] - }), - { - text: '', - transform5: undefined - }).text; - - callback(responseText, undefined); - }) - .catch(e => callback(undefined, e)); +function parsePdf(file, callback, config) { + // Get the pdfjs document for the filepath or buffers. + // @ts-ignore + pdfjs.getDocument(file).promise + // We go through each page and build our text content promise array. + .then(document => Promise.all(Array.from({ length: document.numPages }, (_, index) => index + 1).map(pageNr => document.getPage(pageNr).then(page => page.getTextContent())))) + // Each textContent item has property 'items' which is an array of objects. + // Each object element in the array has text stored in their 'str' key. + // The concatenation of str is what makes our pdf content. + // str already contains any space that was in the text. + // So, we only care about when to add the new line. + // That we determine using transform[5] value which is the y-coordinate of the item object. + // So, if there is a mismatch in the transform[5] value between the current item and the previous item, we put a line break. + .then(textContentArray => { + /** Store all the text content to respond */ + const responseText = textContentArray + .map(textContent => textContent.items) // Get all the items + .flat() // Flatten all the items object + .filter(item => item.str != '') // Ignore the empty string items. + .reduce((a, v) => ( + { + text: a.text + (v.transform[5] != a.transform5 ? (config.newlineDelimiter ?? "\n") : '') + v.str, + transform5: v.transform[5] + }), + { + text: '', + transform5: undefined + }).text; + + callback(responseText, undefined); + }) + .catch(e => callback(undefined, e)); } /** Main async function with callback to execute parseOffice for supported files @@ -524,121 +485,68 @@ function parsePdf(filepath, callback, config) { * @returns {void} */ function parseOffice(file, callback, config = {}) { - // Make a clone of the config. - const internalConfig = { ...config }; - // Prepare file for processing + // Make a clone of the config with default values such that none of the config flags are undefined. + /** @type {OfficeParserConfig} */ + const internalConfig = { + ignoreNotes: false, + newlineDelimiter: '\n', + putNotesAtLast: false, + outputErrorToConsole: false, + ...config + }; + /** + * Prepare file for processing + * @type {Promise<{ file:string | Buffer, ext: string}>} + */ const filePreparedPromise = new Promise((res, rej) => { - // Check if decompress location in the config is present. - // If it is valid, we set the final decompression location in the config. - // If it is not valid, we reject the promise with appropriate error message. - if (!internalConfig.tempFilesLocation) - internalConfig.tempFilesLocation = DEFAULTDECOMPRESSSUBLOCATION; - else { - if (!fs.existsSync(internalConfig.tempFilesLocation)) - { - rej(ERRORMSG.locationNotFound(internalConfig.tempFilesLocation)); - return; - } - internalConfig.tempFilesLocation = `${internalConfig.tempFilesLocation}${internalConfig.tempFilesLocation.endsWith('/') ? '' : '/'}${DEFAULTDECOMPRESSSUBLOCATION}`; - } - - // create temp file subdirectory if it does not exist - fs.mkdirSync(getTempFilesDirectory(internalConfig.tempFilesLocation), { recursive: true }); - // Check if buffer - if (Buffer.isBuffer(file)) { + if (Buffer.isBuffer(file)) // Guess file type from buffer - fileType.fromBuffer(file) - .then(data => - { - // temp file name - const newFileName = getNewFileName(data.ext.toLowerCase()); - // write new file - fs.writeFileSync(getFilePath(getTempFilesDirectory(internalConfig.tempFilesLocation), newFileName), file); - // resolve promise - res(newFileName); - }) + return fileType.fromBuffer(file) + .then(data => res({ file: file, ext: data.ext.toLowerCase() })) .catch(() => rej(ERRORMSG.improperBuffers)); - return; + else if (typeof file === 'string') { + // Not buffers but real file path. + // Check if file exists + if (!fs.existsSync(file)) + throw ERRORMSG.fileDoesNotExist(file); + + // resolve promise + res({ file: file, ext: file.split(".").pop() }); } - - // Not buffers but real file path. - - // Check if file exists - if (!fs.existsSync(file)) - throw ERRORMSG.fileDoesNotExist(file); - - // temp file name - const newFileName = getNewFileName(file.split(".").pop().toLowerCase()); - // Copy the file into a temp location with the temp name - fs.copyFileSync(file, getFilePath(getTempFilesDirectory(internalConfig.tempFilesLocation), newFileName)) - // resolve promise - res(newFileName); + else + rej(ERRORMSG.invalidInput); }); // Process filePreparedPromise resolution. filePreparedPromise - .then(filename => { - // The file path - const filepath = getFilePath(getTempFilesDirectory(internalConfig.tempFilesLocation), filename); - // File extension. Already in lowercase when we prepared the temp file above. - const extension = filepath.split(".").pop(); - + .then(({ file, ext }) => { // Switch between parsing functions depending on extension. - switch(extension) { + switch (ext) { case "docx": - parseWord(filepath, internalCallback, internalConfig); + parseWord(file, internalCallback, internalConfig); break; case "pptx": - parsePowerPoint(filepath, internalCallback, internalConfig); + parsePowerPoint(file, internalCallback, internalConfig); break; case "xlsx": - parseExcel(filepath, internalCallback, internalConfig); + parseExcel(file, internalCallback, internalConfig); break; case "odt": case "odp": case "ods": - parseOpenOffice(filepath, internalCallback, internalConfig); + parseOpenOffice(file, internalCallback, internalConfig); break; case "pdf": - parsePdf(filepath, internalCallback, internalConfig); + parsePdf(file, internalCallback, internalConfig); break; default: - internalCallback(undefined, ERRORMSG.extensionUnsupported(extension)); // Call the internalCallback function which removes the temp files if required. + internalCallback(undefined, ERRORMSG.extensionUnsupported(ext)); // Call the internalCallback function which removes the temp files if required. } /** Internal callback function that calls the user's callback function passed in argument and removes the temp files if required */ function internalCallback(data, err) { - // Check if we need to preserve unzipped content files or delete them. - if (!internalConfig.preserveTempFiles) { - /** Safely delete location */ - function safelyDeleteLocation(location, deleteDirIfEmpty) { - if (!fs.existsSync(location)) - return; - - if (!fs.lstatSync(location).isDirectory() // If not directory - || !deleteDirIfEmpty // or if the deleteDirIfEmpty is false or undefined - || fs.readdirSync(location).length == 0) { // or if it is true, we check if the contents are empty. - try { - rimrafSync(location); - } - catch(rimrafErr) { - consoleError(rimrafErr, internalConfig.outputErrorToConsole); - } - } - } - - // We delete our file as well as the extracted files inside the office files. - // There is no extraction for pdf files because we don't support any unpacking of it. - // After removing files, we check if the folders containing them are empty. - // If yes, we remove those folders too. - safelyDeleteLocation(filepath); - safelyDeleteLocation(getFilePath(internalConfig.tempFilesLocation, filename)); - safelyDeleteLocation(getTempFilesDirectory(internalConfig.tempFilesLocation), true); - safelyDeleteLocation(internalConfig.tempFilesLocation, true); - } - // Check if there is an error. Throw if there is an error. if (err) return handleError(err, callback, internalConfig.outputErrorToConsole); @@ -650,8 +558,7 @@ function parseOffice(file, callback, config = {}) { .catch(error => handleError(error, callback, internalConfig.outputErrorToConsole)); } -/** - * Main async function that can be used with await to execute parseOffice. Or it can be used with promises. +/** Main async function that can be used with await to execute parseOffice. Or it can be used with promises. * @param {string | Buffer} file File path or file buffers * @param {OfficeParserConfig} [config={}] [OPTIONAL]: Config Object for officeParser * @returns {Promise} @@ -666,38 +573,69 @@ function parseOfficeAsync(file, config = {}) { }); } -/** Global file name iterator. */ -let globalFileNameIterator = 0; -/** - * File Name generator that takes the extension as an input and returns a file name that comprises a timestamp and an incrementing number - * to allow the files to be sorted in chronological order. We also prefix them with ppid and pid of the process to support - * common destination from worker threads as well as multiple processes running them together. - * @param {string} ext File extension for this new generated file name - * @returns {string} +/** Extract specific files from either a ZIP file buffer or file path based on a filter function. + * @param {Buffer|string} zipInput ZIP file input, either a Buffer or a file path (string). + * @param {(x: string) => boolean} filterFn A function that receives the entry object and returns true if the file should be extracted. + * @returns {Promise<{ path: string, content: string }[]>} Resolves to an array of object */ -function getNewFileName(ext) { - // Get the iterator part of the file name - let iteratorPart = (globalFileNameIterator++).toString().padStart(5, '0'); - // We want the iterator part of the file name to be of 5 digits. - // Therefore, when the iterator crosses into 6 digits, we reset it to 0. - if (globalFileNameIterator > 99999) - globalFileNameIterator = 0; - // Return the file name with ppid and pid to allow unique names even with worker threads. - return `${process.ppid}_${process.pid}_${new Date().getTime().toString() + iteratorPart}.${ext}`; -} +function extractFiles(zipInput, filterFn) { + return new Promise((res, rej) => { + /** Processes zip file and resolves with the path of file and their content. + * @param {yauzl.ZipFile} zipfile + */ + const processZipfile = (zipfile) => { + /** @type {{ path: string, content: string }[]} */ + const extractedFiles = []; + zipfile.readEntry(); + + /** @param {yauzl.Entry} entry */ + function processEntry(entry) { + // Use the filter function to determine if the file should be extracted + if (filterFn(entry.fileName)) { + zipfile.openReadStream(entry, (err, readStream) => { + if (err) + return rej(err); + + // Use concat-stream to collect the data into a single Buffer + readStream.pipe(concat(data => { + extractedFiles.push({ + path: entry.fileName, + content: data.toString() + }); + zipfile.readEntry(); // Continue reading entries + })); + }); + } + else + zipfile.readEntry(); // Skip entries that don't match the filter + } -/** Gets directory for storing files. */ -function getTempFilesDirectory(root) { - return `${root}/tempfiles`; -} + zipfile.on('entry', processEntry); + zipfile.on('end', () => res(extractedFiles)); + zipfile.on('error', rej); + }; -/** Gets file path for the supplied directory and the file name. */ -function getFilePath(directory, fileName) { - return `${directory}/${fileName}`; + // Determine whether the input is a buffer or file path + if (Buffer.isBuffer(zipInput)) { + // Process ZIP from Buffer + yauzl.fromBuffer(zipInput, { lazyEntries: true }, (err, zipfile) => { + if (err) return rej(err); + processZipfile(zipfile); + }); + } + else if (typeof zipInput === 'string') { + // Process ZIP from File Path + yauzl.open(zipInput, { lazyEntries: true }, (err, zipfile) => { + if (err) return rej(err); + processZipfile(zipfile); + }); + } + else + rej(ERRORMSG.invalidInput); + }); } -/** - * Handle error by logging it to console if permitted by the config. +/** Handle error by logging it to console if permitted by the config. * And after that, trigger the callback function with the error value. * @param {string} error Error text * @param {function} callback Callback function provided by the caller @@ -705,8 +643,10 @@ function getFilePath(directory, fileName) { * @returns {void} */ function handleError(error, callback, outputErrorToConsole) { - consoleError(error, outputErrorToConsole); - callback(undefined, ERRORHEADER + error); + if (error && outputErrorToConsole) + console.error(ERRORHEADER + error); + + callback(undefined, new Error(ERRORHEADER + error)); } @@ -716,14 +656,104 @@ module.exports.parseOfficeAsync = parseOfficeAsync; // Run this library on CLI -if ((process.argv[0].split('/').pop() == "node" || process.argv[0].split('/').pop() == "npx") && (process.argv[1].split('/').pop() == "officeParser.js" || process.argv[1].split('/').pop().toLowerCase() == "officeparser")) { - if (process.argv.length == 2) { - // continue +if ((typeof process.argv[0] == 'string' && (process.argv[0].split('/').pop() == "node" || process.argv[0].split('/').pop() == "npx")) && + (typeof process.argv[1] == 'string' && (process.argv[1].split('/').pop() == "officeParser.js" || process.argv[1].split('/').pop().toLowerCase() == "officeparser"))) { + + // Extract arguments after the script is called + /** Stores the list of arguments for this CLI call + * @type {string[]} + */ + const args = process.argv.slice(2); + /** Stores the file argument for this CLI call + * @type {string | Buffer | undefined} + */ + let fileArg = undefined; + /** Stores the config arguments for this CLI call + * @type {string[]} + */ + const configArgs = []; + + /** Function to identify if an argument is a config option (i.e., --key=value) + * @param {string} arg Argument passed in the CLI call. + */ + function isConfigOption(arg) { + return arg.startsWith('--') && arg.includes('='); } - else if (process.argv.length == 3) - parseOfficeAsync(process.argv[2]) + + // Loop through arguments to separate file path and config options + args.forEach(arg => { + if (isConfigOption(arg)) + // It's a config option + configArgs.push(arg); + else if (!fileArg) + // First non-config argument is assumed to be the file path + fileArg = arg; + }); + + // Check if we have a valid file argument + // If not, we return error and we write the instructions on how to use the library on the terminal. + if (fileArg != undefined) { + /** Helper function to parse config arguments from CLI + * @param {string[]} args List of string arguments that we need to parse to understand the config flag they represent. + */ + function parseCLIConfigArgs(args) { + /** @type {OfficeParserConfig} */ + const config = {}; + args.forEach(arg => { + // Split the argument by '=' to differentiate between the key and value + const [key, value] = arg.split('='); + + // We only care about the keys that are important to us. We ignore any other key. + switch (key) { + case '--ignoreNotes': + config.ignoreNotes = value.toLowerCase() === 'true'; + break; + case '--newlineDelimiter': + config.newlineDelimiter = value; + break; + case '--putNotesAtLast': + config.putNotesAtLast = value.toLowerCase() === 'true'; + break; + case '--outputErrorToConsole': + config.outputErrorToConsole = value.toLowerCase() === 'true'; + break; + } + }); + + return config; + } + + // Parse CLI config arguments + const config = parseCLIConfigArgs(configArgs); + + // Execute parseOfficeAsync with file and config + parseOfficeAsync(fileArg, config) .then(text => console.log(text)) - .catch(error => console.error(ERRORHEADER + error)) - else - console.error(ERRORMSG.improperArguments) + .catch(error => console.error(ERRORHEADER + error)); + } + else { + console.error(ERRORMSG.improperArguments); + + const CLI_INSTRUCTIONS = +` +=== How to Use officeParser CLI === + +Usage: + node officeparser [--configOption=value] [FILE_PATH] + +Example: + node officeparser --ignoreNotes=true --putNotesAtLast=true ./example.docx + +Config Options: + --ignoreNotes=[true|false] Flag to ignore notes from files like PowerPoint. Default is false. + --newlineDelimiter=[delimiter] The delimiter to use for new lines. Default is '\\n'. + --putNotesAtLast=[true|false] Flag to collect notes at the end of files like PowerPoint. Default is false. + --outputErrorToConsole=[true|false] Flag to output errors to the console. Default is false. + +Note: + The order of file path and config options doesn't matter. +`; + // Usage instructions for the user + console.log(CLI_INSTRUCTIONS); + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7104460..fa208b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,67 +1,42 @@ { "name": "officeparser", - "version": "4.2.0", + "version": "5.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "officeparser", - "version": "4.2.0", + "version": "5.0.0", "license": "MIT", "dependencies": { "@xmldom/xmldom": "^0.8.10", - "decompress": "^4.2.1", + "concat-stream": "^2.0.0", "file-type": "^16.5.4", "node-ensure": "^0.0.0", - "rimraf": "^5.0.10" + "yauzl": "^3.1.3" }, "bin": { "officeparser": "officeParser.js" }, "devDependencies": { - "@types/decompress": "^4.2.6", + "@types/concat-stream": "^2.0.3", "@types/node": "^18.16.1", "@types/xmldom": "^0.1.33", + "@types/yauzl": "^2.10.3", "typescript": "^5.0.3" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@tokenizer/token": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" }, - "node_modules/@types/decompress": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/@types/decompress/-/decompress-4.2.6.tgz", - "integrity": "sha512-ULmsMkKxU7aIGbnxP4Rz28hLdRZ4q0cdy6kcb8dx+UgDGOn+id5fibvoeTnjuolhrRM7f7TOtGADeKEk60SSsQ==", + "node_modules/@types/concat-stream": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-2.0.3.tgz", + "integrity": "sha512-3qe4oQAPNwVNwK4C9c8u+VJqv9kez+2MR4qJpoPFfXtgxxif1QbFusvXzK0/Wra2VX07smostI2VMmJNSpZjuQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -78,6 +53,16 @@ "integrity": "sha512-4PH3jqYT1EK0t+bDCZl7wW2A2yM25RapZqJ8/IaFcgr0y+aOiL4QKSrEIBItBzAKlF7nG8b6FPBMi/vTzIURjw==", "dev": true }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@xmldom/xmldom": { "version": "0.8.10", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", @@ -86,82 +71,6 @@ "node": ">=10.0.0" } }, - "node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "license": "MIT" - }, - "node_modules/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==" - }, - "node_modules/bl": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", - "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/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==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "node_modules/buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "dependencies": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "node_modules/buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -170,184 +79,39 @@ "node": "*" } }, - "node_modules/buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "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==", + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "license": "MIT" }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], "license": "MIT", "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/decompress": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", - "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", - "dependencies": { - "decompress-tar": "^4.0.0", - "decompress-tarbz2": "^4.0.0", - "decompress-targz": "^4.0.0", - "decompress-unzip": "^4.0.1", - "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-tar": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", - "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", - "dependencies": { - "file-type": "^5.2.0", - "is-stream": "^1.1.0", - "tar-stream": "^1.5.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-tar/node_modules/file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-tarbz2": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", - "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", - "dependencies": { - "decompress-tar": "^4.1.0", - "file-type": "^6.1.0", - "is-stream": "^1.1.0", - "seek-bzip": "^1.0.5", - "unbzip2-stream": "^1.0.9" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-tarbz2/node_modules/file-type": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", - "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", - "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-targz": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", - "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", - "dependencies": { - "decompress-tar": "^4.1.1", - "file-type": "^5.2.0", - "is-stream": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-targz/node_modules/file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", - "engines": { - "node": ">=4" + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" } }, - "node_modules/decompress-unzip": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", - "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "node_modules/concat-stream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", "dependencies": { - "file-type": "^3.8.0", - "get-stream": "^2.2.0", - "pify": "^2.3.0", - "yauzl": "^2.4.2" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, "engines": { - "node": ">=4" - } - }, - "node_modules/decompress-unzip/node_modules/file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "license": "MIT" - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dependencies": { - "pend": "~1.2.0" + "node": ">= 6" } }, "node_modules/file-type": { @@ -366,64 +130,6 @@ "url": "https://github.com/sindresorhus/file-type?sponsor=1" } }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, - "node_modules/get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "dependencies": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -448,155 +154,11 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, - "node_modules/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==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-natural-number": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", - "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" - }, - "node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "license": "ISC" - }, - "node_modules/make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/make-dir/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "engines": { - "node": ">=4" - } - }, - "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/node-ensure": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz", "integrity": "sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==" }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "license": "BlueOak-1.0.0" - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/peek-readable": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", @@ -612,58 +174,8 @@ "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "license": "MIT" }, "node_modules/readable-web-to-node-stream": { "version": "3.0.2", @@ -693,85 +205,6 @@ "node": ">= 6" } }, - "node_modules/rimraf": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", - "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", - "license": "ISC", - "dependencies": { - "glob": "^10.3.7" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/seek-bzip": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", - "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", - "dependencies": { - "commander": "^2.8.1" - }, - "bin": { - "seek-bunzip": "bin/seek-bunzip", - "seek-table": "bin/seek-bzip-table" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -785,110 +218,6 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/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==", - "license": "MIT" - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-dirs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", - "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", - "dependencies": { - "is-natural-number": "^4.0.1" - } - }, "node_modules/strtok3": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", @@ -901,238 +230,74 @@ "node": ">=10" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "dependencies": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, - "node_modules/to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" - }, - "node_modules/token-types": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", - "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/typescript": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=12.20" - } - }, - "node_modules/unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", - "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", - "dependencies": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "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/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" + "type": "github", + "url": "https://github.com/sponsors/Borewit" } }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", + "node_modules/token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", "dependencies": { - "color-convert": "^2.0.1" + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "type": "github", + "url": "https://github.com/sponsors/Borewit" } }, - "node_modules/wrap-ansi-cjs/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==", + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", "license": "MIT" }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" + "node_modules/typescript": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", + "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">=8" + "node": ">=12.20" } }, - "node_modules/wrappy": { + "node_modules/util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.1.3.tgz", + "integrity": "sha512-JCCdmlJJWv7L0q/KylOekyRaUrdEoUxWkWVcgorosTROCFWiS9p2NNPE9Yb91ak7b1N5SxAZEliWpspbZccivw==", + "license": "MIT", "dependencies": { "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "pend": "~1.2.0" + }, + "engines": { + "node": ">=12" } } }, "dependencies": { - "@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "requires": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - } - }, - "@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "optional": true - }, "@tokenizer/token": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" }, - "@types/decompress": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/@types/decompress/-/decompress-4.2.6.tgz", - "integrity": "sha512-ULmsMkKxU7aIGbnxP4Rz28hLdRZ4q0cdy6kcb8dx+UgDGOn+id5fibvoeTnjuolhrRM7f7TOtGADeKEk60SSsQ==", + "@types/concat-stream": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-2.0.3.tgz", + "integrity": "sha512-3qe4oQAPNwVNwK4C9c8u+VJqv9kez+2MR4qJpoPFfXtgxxif1QbFusvXzK0/Wra2VX07smostI2VMmJNSpZjuQ==", "dev": true, "requires": { "@types/node": "*" @@ -1150,226 +315,53 @@ "integrity": "sha512-4PH3jqYT1EK0t+bDCZl7wW2A2yM25RapZqJ8/IaFcgr0y+aOiL4QKSrEIBItBzAKlF7nG8b6FPBMi/vTzIURjw==", "dev": true }, + "@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@xmldom/xmldom": { "version": "0.8.10", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==" }, - "ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==" - }, - "ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "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==" - }, - "bl": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", - "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "requires": { - "balanced-match": "^1.0.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-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "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==" - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "decompress": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", - "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", - "requires": { - "decompress-tar": "^4.0.0", - "decompress-tarbz2": "^4.0.0", - "decompress-targz": "^4.0.0", - "decompress-unzip": "^4.0.1", - "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" - } - }, - "decompress-tar": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", - "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", - "requires": { - "file-type": "^5.2.0", - "is-stream": "^1.1.0", - "tar-stream": "^1.5.2" - }, - "dependencies": { - "file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==" - } - } - }, - "decompress-tarbz2": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", - "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", - "requires": { - "decompress-tar": "^4.1.0", - "file-type": "^6.1.0", - "is-stream": "^1.1.0", - "seek-bzip": "^1.0.5", - "unbzip2-stream": "^1.0.9" - }, - "dependencies": { - "file-type": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", - "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==" - } - } - }, - "decompress-targz": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", - "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", - "requires": { - "decompress-tar": "^4.1.1", - "file-type": "^5.2.0", - "is-stream": "^1.1.0" - }, - "dependencies": { - "file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==" - } - } + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, - "decompress-unzip": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", - "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", "requires": { - "file-type": "^3.8.0", - "get-stream": "^2.2.0", - "pify": "^2.3.0", - "yauzl": "^2.4.2" + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" }, "dependencies": { - "file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } } } }, - "eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" - }, - "emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" - } - }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "requires": { - "pend": "~1.2.0" - } - }, "file-type": { "version": "16.5.4", "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", @@ -1380,47 +372,6 @@ "token-types": "^4.1.1" } }, - "foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "requires": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - } - }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, - "get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "requires": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - } - }, - "glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "requires": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - } - }, - "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" - }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -1431,110 +382,11 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, - "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==" - }, - "is-natural-number": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", - "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" - }, - "jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "requires": { - "@isaacs/cliui": "^8.0.2", - "@pkgjs/parseargs": "^0.11.0" - } - }, - "lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" - }, - "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - } - } - }, - "minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==" - }, "node-ensure": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz", "integrity": "sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==" }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==" - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" - }, - "path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "requires": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - } - }, "peek-readable": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", @@ -1543,51 +395,7 @@ "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "requires": { - "pinkie": "^2.0.0" - } - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" }, "readable-web-to-node-stream": { "version": "3.0.2", @@ -1609,45 +417,6 @@ } } }, - "rimraf": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", - "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", - "requires": { - "glob": "^10.3.7" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "seek-bzip": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", - "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", - "requires": { - "commander": "^2.8.1" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" - }, - "signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==" - }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -1663,77 +432,6 @@ } } }, - "string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - }, - "string-width-cjs": { - "version": "npm:string-width@4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, - "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==" - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "requires": { - "ansi-regex": "^6.0.1" - } - }, - "strip-ansi-cjs": { - "version": "npm:strip-ansi@6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - } - } - }, - "strip-dirs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", - "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", - "requires": { - "is-natural-number": "^4.0.1" - } - }, "strtok3": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", @@ -1743,30 +441,6 @@ "peek-readable": "^4.1.0" } }, - "tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - } - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, - "to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" - }, "token-types": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", @@ -1776,109 +450,29 @@ "ieee754": "^1.2.1" } }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" + }, "typescript": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", "dev": true }, - "unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", - "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "requires": { - "isexe": "^2.0.0" - } - }, - "wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "requires": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - } - }, - "wrap-ansi-cjs": { - "version": "npm:wrap-ansi@7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "requires": { - "color-convert": "^2.0.1" - } - }, - "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==" - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - }, "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.1.3.tgz", + "integrity": "sha512-JCCdmlJJWv7L0q/KylOekyRaUrdEoUxWkWVcgorosTROCFWiS9p2NNPE9Yb91ak7b1N5SxAZEliWpspbZccivw==", "requires": { "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "pend": "~1.2.0" } } } diff --git a/package.json b/package.json index 285db0e..f8dda5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "officeparser", - "version": "4.2.0", + "version": "5.0.0", "description": "A Node.js library to parse text out of any office file. Currently supports docx, pptx, xlsx, odt, odp, ods, pdf files.", "main": "officeParser.js", "files": [ @@ -44,15 +44,16 @@ "homepage": "https://github.com/harshankur/officeParser#readme", "dependencies": { "@xmldom/xmldom": "^0.8.10", - "decompress": "^4.2.1", + "concat-stream": "^2.0.0", "file-type": "^16.5.4", "node-ensure": "^0.0.0", - "rimraf": "^5.0.10" + "yauzl": "^3.1.3" }, "devDependencies": { - "@types/decompress": "^4.2.6", + "@types/concat-stream": "^2.0.3", "@types/node": "^18.16.1", "@types/xmldom": "^0.1.33", + "@types/yauzl": "^2.10.3", "typescript": "^5.0.3" } } diff --git a/test/testOfficeParser.js b/test/testOfficeParser.js index 4fc9442..3667d13 100644 --- a/test/testOfficeParser.js +++ b/test/testOfficeParser.js @@ -1,3 +1,5 @@ +// @ts-check + const officeParser = require("../officeParser"); const fs = require("fs"); const supportedExtensions = require("../supportedExtensions"); @@ -53,30 +55,29 @@ function getFilename(ext, isContentFile = false) { } /** Run test for a passed extension */ -function runTest(ext) { - return officeParser.parseOfficeAsync(getFilename(ext), config) +function runTest(ext, buffer) { + return officeParser.parseOfficeAsync(buffer ? fs.readFileSync(getFilename(ext)) : getFilename(ext), config) .then(text => fs.readFileSync(getFilename(ext, true), 'utf8') == text - ? console.log(`[${ext}]=> Passed`) - : console.log(`[${ext}]=> Failed`) + ? console.log(`[${ext.padEnd(4)}: ${buffer ? 'buffer' : 'file '}] => Passed`) + : console.log(`[${ext.padEnd(4)}: ${buffer ? 'buffer' : 'file '}] => Failed`) ) - .catch(error => console.log("ERROR: " + error)) + .catch(error => console.log("ERROR: " + error)); } async function runAllTests() { for (let i = 0; i < supportedExtensionTests.length; i++) { const test = supportedExtensionTests[i]; - if (test.testAvailable) - await runTest(test.ext) + if (test.testAvailable) { + await runTest(test.ext, false); + await runTest(test.ext, true); + } else console.log(`[${test.ext}]=> Skipped`); } } -// Enable console output in case something fails -// officeParser.enableConsoleOutput(); - // Run all test files with test content if no argument passed. if (process.argv.length == 2) { diff --git a/typings/officeParser.d.ts b/typings/officeParser.d.ts index 7286187..2be60d7 100644 --- a/typings/officeParser.d.ts +++ b/typings/officeParser.d.ts @@ -1,15 +1,7 @@ #!/usr/bin/env node export type OfficeParserConfig = { /** - * The directory where officeparser stores the temp files . The final decompressed data will be put inside officeParserTemp folder within your directory. Please ensure that this directory actually exists. Default is officeParsertemp. - */ - tempFilesLocation?: string; - /** - * Flag to not delete the internal content files and the duplicate temp files that it uses after unzipping office files. Default is false. It deletes all of those files. - */ - preserveTempFiles?: boolean; - /** - * Flag to show all the logs to console in case of an error irrespective of your own handling. + * Flag to show all the logs to console in case of an error irrespective of your own handling. Default is false. */ outputErrorToConsole?: boolean; /** @@ -32,8 +24,7 @@ export type OfficeParserConfig = { * @returns {void} */ export function parseOffice(file: string | Buffer, callback: Function, config?: OfficeParserConfig): void; -/** - * Main async function that can be used with await to execute parseOffice. Or it can be used with promises. +/** Main async function that can be used with await to execute parseOffice. Or it can be used with promises. * @param {string | Buffer} file File path or file buffers * @param {OfficeParserConfig} [config={}] [OPTIONAL]: Config Object for officeParser * @returns {Promise} diff --git a/typings/officeParser.d.ts.map b/typings/officeParser.d.ts.map index d9555ee..f375902 100644 --- a/typings/officeParser.d.ts.map +++ b/typings/officeParser.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"officeParser.d.ts","sourceRoot":"","sources":["../officeParser.js"],"names":[],"mappings":";;;;;wBA4Cc,MAAM;;;;wBACN,OAAO;;;;2BACP,OAAO;;;;uBACP,MAAM;;;;kBACN,OAAO;;;;qBACP,OAAO;;AAsarB;;;;;GAKG;AACH,kCALW,MAAM,GAAG,MAAM,+BAEf,kBAAkB,GAChB,IAAI,CAqGhB;AAED;;;;;GAKG;AACH,uCAJW,MAAM,GAAG,MAAM,WACf,kBAAkB,GAChB,QAAQ,MAAM,CAAC,CAU3B"} \ No newline at end of file +{"version":3,"file":"officeParser.d.ts","sourceRoot":"","sources":["../officeParser.js"],"names":[],"mappings":";;;;;2BAkCc,OAAO;;;;uBACP,MAAM;;;;kBACN,OAAO;;;;qBACP,OAAO;;AA2brB;;;;;GAKG;AACH,kCALW,MAAM,GAAG,MAAM,+BAEf,kBAAkB,GAChB,IAAI,CA0EhB;AAED;;;;GAIG;AACH,uCAJW,MAAM,GAAG,MAAM,WACf,kBAAkB,GAChB,QAAQ,MAAM,CAAC,CAU3B"} \ No newline at end of file