@juspay/neurolink 9.55.3 → 9.55.5

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.
@@ -35,11 +35,26 @@
35
35
  * }
36
36
  * ```
37
37
  */
38
- import ExcelJS from "exceljs";
39
- const { Workbook } = ExcelJS;
40
38
  import { BaseFileProcessor } from "../base/BaseFileProcessor.js";
41
39
  import { SIZE_LIMITS } from "../config/index.js";
42
40
  import { FileErrorCode } from "../errors/index.js";
41
+ let _exceljs = null;
42
+ async function loadExcelJS() {
43
+ if (_exceljs) {
44
+ return _exceljs;
45
+ }
46
+ try {
47
+ _exceljs = await import(/* @vite-ignore */ "exceljs");
48
+ return _exceljs;
49
+ }
50
+ catch (err) {
51
+ const e = err instanceof Error ? err : null;
52
+ if (e?.code === "ERR_MODULE_NOT_FOUND" && e.message.includes("exceljs")) {
53
+ throw new Error('Excel file processing requires the "exceljs" package. Install it with:\n pnpm add exceljs', { cause: err });
54
+ }
55
+ throw err;
56
+ }
57
+ }
43
58
  // Re-export for consumers who import from this module
44
59
  // Import for local use
45
60
  // =============================================================================
@@ -247,7 +262,8 @@ export class ExcelProcessor extends BaseFileProcessor {
247
262
  * @returns Parsed ExcelJS Workbook
248
263
  */
249
264
  async parseWorkbook(buffer) {
250
- const workbook = new Workbook();
265
+ const ExcelJS = await loadExcelJS();
266
+ const workbook = new ExcelJS.Workbook();
251
267
  // ExcelJS load() types expect Buffer but Node 22+ Buffer<ArrayBufferLike>
252
268
  // is not directly assignable. Extract a clean ArrayBuffer for the exact
253
269
  // byte range via slice, then cast for type compatibility.
@@ -419,7 +435,9 @@ export class ExcelProcessor extends BaseFileProcessor {
419
435
  worksheet = workbook.worksheets[0];
420
436
  }
421
437
  if (!worksheet) {
422
- const sheetNames = workbook.worksheets.map((ws) => ws.name).join(", ");
438
+ const sheetNames = workbook.worksheets
439
+ .map((ws) => ws.name)
440
+ .join(", ");
423
441
  return `Sheet not found. Available sheets: ${sheetNames}`;
424
442
  }
425
443
  // Convert column letters to 1-based column indices if specified