@nazarkalytiuk/rusc-xlsx 1.0.6 → 1.0.8

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.
package/index.d.ts CHANGED
@@ -438,14 +438,14 @@ export declare class RuscWorksheet {
438
438
  write(row: number, col: number, value: string | number | boolean, format?: RuscFormat | undefined | null): void
439
439
  /**
440
440
  * Write an array of values as a row starting at the given column.
441
- * Batches all writes into a single NAPI call with one lock acquisition.
441
+ * Uses lazy iteration — reads one cell at a time from JS, null/undefined skipped.
442
442
  */
443
- writeRow(row: number, startCol: number, values: Array<string | number | boolean>, format?: RuscFormat | undefined | null): void
443
+ writeRow(row: number, startCol: number, values: Array<string | number | boolean | null | undefined>, format?: RuscFormat | undefined | null): void
444
444
  /**
445
445
  * Write a 2D array of values starting at the given position.
446
- * Batches all writes into a single NAPI call with one lock acquisition.
446
+ * Uses lazy iteration — never materializes the entire grid in Rust memory.
447
447
  */
448
- writeRows(startRow: number, startCol: number, rows: Array<Array<string | number | boolean>>, format?: RuscFormat | undefined | null): void
448
+ writeRows(startRow: number, startCol: number, rows: Array<Array<string | number | boolean | null | undefined>>, format?: RuscFormat | undefined | null): void
449
449
  /** Write a string to a cell */
450
450
  writeString(row: number, col: number, value: string): void
451
451
  /** Write a number to a cell */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nazarkalytiuk/rusc-xlsx",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Fast Excel XLSX library for Node.js powered by rust_xlsxwriter",
5
5
  "main": "wrapper.js",
6
6
  "types": "wrapper.d.ts",
@@ -69,12 +69,12 @@
69
69
  "node": ">=16"
70
70
  },
71
71
  "optionalDependencies": {
72
- "@nazarkalytiuk/rusc-xlsx-win32-x64-msvc": "1.0.6",
73
- "@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc": "1.0.6",
74
- "@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc": "1.0.6",
75
- "@nazarkalytiuk/rusc-xlsx-darwin-universal": "1.0.6",
76
- "@nazarkalytiuk/rusc-xlsx-linux-x64-gnu": "1.0.6",
77
- "@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu": "1.0.6",
78
- "@nazarkalytiuk/rusc-xlsx-linux-x64-musl": "1.0.6"
72
+ "@nazarkalytiuk/rusc-xlsx-win32-x64-msvc": "1.0.8",
73
+ "@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc": "1.0.8",
74
+ "@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc": "1.0.8",
75
+ "@nazarkalytiuk/rusc-xlsx-darwin-universal": "1.0.8",
76
+ "@nazarkalytiuk/rusc-xlsx-linux-x64-gnu": "1.0.8",
77
+ "@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu": "1.0.8",
78
+ "@nazarkalytiuk/rusc-xlsx-linux-x64-musl": "1.0.8"
79
79
  }
80
80
  }
package/wrapper.d.ts CHANGED
@@ -2332,5 +2332,26 @@ export declare class Workbook {
2332
2332
  setProperties(properties: DocProperties): void;
2333
2333
  }
2334
2334
 
2335
+ /**
2336
+ * Returns [currentBytes, peakBytes] of Rust allocator usage.
2337
+ * Useful for profiling memory consumption of the native layer.
2338
+ *
2339
+ * @example
2340
+ * const [current, peak] = rustMemoryStats();
2341
+ * console.log(`Rust heap: ${(current / 1024 / 1024).toFixed(2)} MB (peak: ${(peak / 1024 / 1024).toFixed(2)} MB)`);
2342
+ */
2343
+ export declare function rustMemoryStats(): [number, number];
2344
+
2345
+ /**
2346
+ * Resets peak memory tracking to the current allocation level.
2347
+ * Call before a section you want to measure.
2348
+ *
2349
+ * @example
2350
+ * rustMemoryResetPeak();
2351
+ * // ... do work ...
2352
+ * const [current, peak] = rustMemoryStats();
2353
+ */
2354
+ export declare function rustMemoryResetPeak(): void;
2355
+
2335
2356
  // Re-export native bindings for advanced use
2336
2357
  export { RuscFormat, RuscNote, RuscFormula, RuscDataValidation, RuscChart, RuscWorkbook, RuscWorksheet, RuscProtectionOptions, RuscRichText, RuscImage, RuscTable, RuscTableColumn, RuscSparkline, RuscDocProperties, RuscButton, RuscShape } from './index';
package/wrapper.js CHANGED
@@ -497,33 +497,11 @@ class Worksheet {
497
497
  }
498
498
 
499
499
  writeRow(row, startCol, values, format) {
500
- const fmt = format ? format._native : undefined
501
- const clean = values.filter(v => v !== null && v !== undefined)
502
- if (clean.length === values.length) {
503
- return this._native.writeRow(row, startCol, clean, fmt)
504
- }
505
- for (let i = 0; i < values.length; i++) {
506
- if (values[i] !== null && values[i] !== undefined) {
507
- this._native.write(row, startCol + i, values[i], fmt)
508
- }
509
- }
500
+ return this._native.writeRow(row, startCol, values, format ? format._native : undefined)
510
501
  }
511
502
 
512
503
  writeRows(startRow, startCol, rows, format) {
513
- const fmt = format ? format._native : undefined
514
- for (let r = 0; r < rows.length; r++) {
515
- const values = rows[r]
516
- const clean = values.filter(v => v !== null && v !== undefined)
517
- if (clean.length === values.length) {
518
- this._native.writeRow(startRow + r, startCol, clean, fmt)
519
- } else {
520
- for (let i = 0; i < values.length; i++) {
521
- if (values[i] !== null && values[i] !== undefined) {
522
- this._native.write(startRow + r, startCol + i, values[i], fmt)
523
- }
524
- }
525
- }
526
- }
504
+ return this._native.writeRows(startRow, startCol, rows, format ? format._native : undefined)
527
505
  }
528
506
 
529
507
  writeString(row, col, value) {
@@ -1364,4 +1342,7 @@ module.exports = {
1364
1342
  RuscDocProperties: nativeBinding.RuscDocProperties,
1365
1343
  RuscButton: nativeBinding.RuscButton,
1366
1344
  RuscShape: nativeBinding.RuscShape,
1345
+ // Memory tracking
1346
+ rustMemoryStats: nativeBinding.rustMemoryStats,
1347
+ rustMemoryResetPeak: nativeBinding.rustMemoryResetPeak,
1367
1348
  }