officeparser 6.0.1 → 6.0.2

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.
@@ -333,13 +333,16 @@ const parsePdf = async (buffer, config) => {
333
333
  // Check if we are in a Node.js environment
334
334
  // @ts-ignore
335
335
  if (typeof window === 'undefined') {
336
+ // Helper to bypass TS/Webpack/Other transpilers converting import() to require() when compiling to CJS
337
+ // Defined here to avoid CSP 'unsafe-eval' issues in browser environments
338
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
336
339
  try {
337
340
  // Use legacy build for Node.js (required for pdfjs-dist v5+)
338
- pdfjs = await Promise.resolve().then(() => __importStar(require('pdfjs-dist/legacy/build/pdf.mjs')));
341
+ pdfjs = await dynamicImport('pdfjs-dist/legacy/build/pdf.mjs');
339
342
  }
340
343
  catch (e) {
341
344
  // Fallback to standard if legacy not found (e.g. older versions)
342
- pdfjs = await Promise.resolve().then(() => __importStar(require('pdfjs-dist')));
345
+ pdfjs = await dynamicImport('pdfjs-dist');
343
346
  }
344
347
  }
345
348
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "officeparser",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
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.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",