officeparser 6.1.1 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +301 -26
  2. package/dist/OfficeConverter.d.ts +46 -0
  3. package/dist/OfficeConverter.js +72 -0
  4. package/dist/OfficeGenerator.d.ts +19 -0
  5. package/dist/OfficeGenerator.js +48 -0
  6. package/dist/OfficeParser.d.ts +6 -0
  7. package/dist/OfficeParser.js +74 -31
  8. package/dist/cli.d.ts +3 -1
  9. package/dist/cli.js +106 -22
  10. package/dist/defaults.d.ts +41 -0
  11. package/dist/defaults.js +172 -0
  12. package/dist/generators/BaseGenerator.d.ts +58 -0
  13. package/dist/generators/BaseGenerator.js +107 -0
  14. package/dist/generators/ChunkingGenerator.d.ts +81 -0
  15. package/dist/generators/ChunkingGenerator.js +683 -0
  16. package/dist/generators/CsvGenerator.d.ts +30 -0
  17. package/dist/generators/CsvGenerator.js +233 -0
  18. package/dist/generators/HtmlGenerator.d.ts +37 -0
  19. package/dist/generators/HtmlGenerator.js +1013 -0
  20. package/dist/generators/MarkdownGenerator.d.ts +59 -0
  21. package/dist/generators/MarkdownGenerator.js +481 -0
  22. package/dist/generators/PdfGenerator.d.ts +22 -0
  23. package/dist/generators/PdfGenerator.js +118 -0
  24. package/dist/generators/RtfGenerator.d.ts +15 -0
  25. package/dist/generators/RtfGenerator.js +208 -0
  26. package/dist/generators/TextGenerator.d.ts +13 -0
  27. package/dist/generators/TextGenerator.js +108 -0
  28. package/dist/index.d.ts +11 -3
  29. package/dist/index.js +17 -2
  30. package/dist/index.mjs +2 -2
  31. package/dist/officeparser.browser.d.ts +828 -5
  32. package/dist/officeparser.browser.iife.js +703 -52
  33. package/dist/officeparser.browser.mjs +703 -52
  34. package/dist/parsers/CsvParser.d.ts +9 -0
  35. package/dist/parsers/CsvParser.js +110 -0
  36. package/dist/parsers/ExcelParser.d.ts +2 -2
  37. package/dist/parsers/ExcelParser.js +145 -114
  38. package/dist/parsers/HtmlParser.d.ts +2 -0
  39. package/dist/parsers/HtmlParser.js +539 -0
  40. package/dist/parsers/MarkdownParser.d.ts +2 -0
  41. package/dist/parsers/MarkdownParser.js +360 -0
  42. package/dist/parsers/OpenOfficeParser.d.ts +2 -2
  43. package/dist/parsers/OpenOfficeParser.js +140 -79
  44. package/dist/parsers/PdfParser.d.ts +2 -2
  45. package/dist/parsers/PdfParser.js +52 -49
  46. package/dist/parsers/PowerPointParser.d.ts +2 -2
  47. package/dist/parsers/PowerPointParser.js +20 -23
  48. package/dist/parsers/RtfParser.d.ts +2 -2
  49. package/dist/parsers/RtfParser.js +1291 -1240
  50. package/dist/parsers/WordParser.d.ts +2 -2
  51. package/dist/parsers/WordParser.js +232 -97
  52. package/dist/sbom.cdx.json +99 -99
  53. package/dist/types.d.ts +783 -5
  54. package/dist/types.js +73 -0
  55. package/dist/utils/astUtils.d.ts +16 -0
  56. package/dist/utils/astUtils.js +32 -0
  57. package/dist/utils/configUtils.d.ts +26 -0
  58. package/dist/utils/configUtils.js +140 -0
  59. package/dist/utils/envUtils.d.ts +8 -3
  60. package/dist/utils/envUtils.js +117 -34
  61. package/dist/utils/errorUtils.d.ts +17 -29
  62. package/dist/utils/errorUtils.js +110 -52
  63. package/dist/utils/moduleLoader.js +19 -11
  64. package/dist/utils/ocrUtils.js +2 -1
  65. package/dist/utils/sheetUtils.d.ts +7 -0
  66. package/dist/utils/sheetUtils.js +35 -0
  67. package/dist/utils/styleMapper.d.ts +36 -0
  68. package/dist/utils/styleMapper.js +224 -0
  69. package/dist/utils/xmlUtils.d.ts +0 -8
  70. package/dist/utils/xmlUtils.js +2 -1
  71. package/package.json +26 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "officeparser",
3
- "version": "6.1.1",
4
- "description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf) into structured AST with rich metadata, formatting, and attachment support.",
3
+ "version": "7.0.1",
4
+ "description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf, .csv, .md, .html) and generating high-fidelity outputs in Markdown, HTML, CSV, RTF, and RAG-focused chunks.",
5
5
  "funding": "https://github.com/sponsors/harshankur",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -30,12 +30,16 @@
30
30
  "build:browser": "node build_browser.js && npm run sync:docs",
31
31
  "sync:versions": "node scripts/sync-pdfjs-versions.js",
32
32
  "sync:docs": "mkdir -p docs/dist && cp dist/officeparser.browser.iife.js docs/dist/ && cp dist/officeparser.browser.mjs docs/dist/",
33
- "test": "npm run test:clean && npm run build && npm run test:license && npm run test:artifacts && npm run test:parser",
34
- "test:baseline": "npm run test baseline",
35
- "test:parser": "npx tsx test/testOfficeParser.ts",
33
+ "lint": "eslint src",
34
+ "test": "npm run lint && npm run test:clean && npm run build && npm run test:license && npm run test:artifacts && npm run test:parser && npm run test:generator",
35
+ "test:baseline": "npm run test:parser:baseline && npm run test:generator:baseline",
36
+ "test:parser": "npx tsx test/parser/testOfficeParser.ts",
37
+ "test:parser:baseline": "npx tsx test/parser/testOfficeParser.ts baseline",
38
+ "test:generator": "npx tsx test/generator/testOfficeGenerator.ts",
39
+ "test:generator:baseline": "npx tsx test/generator/testOfficeGenerator.ts baseline",
36
40
  "test:artifacts": "npx tsx test/testShippingArtifacts.ts",
37
41
  "test:license": "npm run sbom && node scripts/validate-licenses.js",
38
- "test:clean": "rm -rf test/results",
42
+ "test:clean": "rm -rf test/results test/generator/results test/generator/output test/parser/results test/parser/output",
39
43
  "clean": "rm -rf dist && npm run test:clean",
40
44
  "sbom": "npx --yes @cyclonedx/cyclonedx-npm --output-format json --output-file dist/sbom.cdx.json --omit dev",
41
45
  "prepublishOnly": "npm run build",
@@ -62,6 +66,7 @@
62
66
  "ods",
63
67
  "pdf",
64
68
  "rtf",
69
+ "csv",
65
70
  "parser",
66
71
  "text extraction",
67
72
  "document parser",
@@ -82,7 +87,12 @@
82
87
  "pdf.js",
83
88
  "structured-data",
84
89
  "openoffice",
85
- "libreoffice"
90
+ "libreoffice",
91
+ "generator",
92
+ "rag",
93
+ "chunking",
94
+ "markdown",
95
+ "html"
86
96
  ],
87
97
  "author": "Harsh Ankur",
88
98
  "license": "MIT",
@@ -97,14 +107,23 @@
97
107
  "pdfjs-dist": "5.6.205",
98
108
  "tesseract.js": "^7.0.0"
99
109
  },
110
+ "peerDependenciesMeta": {
111
+ "puppeteer": {
112
+ "optional": true
113
+ }
114
+ },
100
115
  "devDependencies": {
101
116
  "@types/node": "^25.5.0",
117
+ "@typescript-eslint/eslint-plugin": "^8.59.3",
118
+ "@typescript-eslint/parser": "^8.59.3",
102
119
  "buffer": "^6.0.3",
103
120
  "dts-bundle-generator": "^9.5.1",
104
121
  "esbuild": "^0.27.4",
105
122
  "esbuild-plugins-node-modules-polyfill": "^1.8.1",
123
+ "eslint": "^10.3.0",
106
124
  "husky": "^9.1.7",
107
125
  "process": "^0.11.10",
126
+ "puppeteer": "^22.15.0",
108
127
  "tsx": "^4.21.0",
109
128
  "typescript": "^6.0.2"
110
129
  }