@bilig/xlsx-formula-recalc 0.161.0 → 0.164.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.
package/AGENTS.md CHANGED
@@ -68,17 +68,23 @@ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc quote.
68
68
  --json
69
69
  ```
70
70
 
71
- Use the API when code already has workbook bytes:
71
+ Use the production API when code has input and output file paths. The root
72
+ package path is file-backed and uses the native streaming engine first:
72
73
 
73
74
  ```ts
74
- import { recalculateXlsx } from '@bilig/xlsx-formula-recalc'
75
+ import { recalculateXlsxFileToFile } from '@bilig/xlsx-formula-recalc'
75
76
 
76
- const result = recalculateXlsx(xlsxBytes, {
77
+ const result = await recalculateXlsxFileToFile('quote.xlsx', {
78
+ outputPath: 'quote.recalculated.xlsx',
77
79
  edits: [{ target: 'Inputs!B2', value: 48 }],
78
80
  reads: ['Summary!B7'],
81
+ engine: 'streaming-native',
79
82
  })
80
83
  ```
81
84
 
85
+ The older bytes-in/bytes-out WorkPaper API is explicit legacy compatibility:
86
+ import it from `@bilig/workpaper/xlsx` and install `@bilig/workpaper` when that fallback is intentional.
87
+
82
88
  Do not claim this is a full Excel clone. Review `result.warnings` and reduce
83
89
  unsupported functions, external links, macros, and volatile formula cases into
84
90
  fixtures before promising production behavior.
package/README.md CHANGED
@@ -146,9 +146,10 @@ That is the failure behind issues and searches like:
146
146
  Use this package at the file boundary:
147
147
 
148
148
  1. let your existing library produce XLSX bytes;
149
- 2. call `recalculateXlsx(...)`;
150
- 3. read the proof cells from `result.reads`;
151
- 4. write `result.xlsx` if the recalculated workbook artifact is needed.
149
+ 2. write them to the XLSX file path your service owns;
150
+ 3. call `recalculateXlsxFileToFile(...)`;
151
+ 4. read the proof cells from `result.reads`;
152
+ 5. return the recalculated output file.
152
153
 
153
154
  That keeps your current file-writer choice intact and adds only the missing
154
155
  calculation/readback step.
@@ -271,15 +272,15 @@ run
271
272
 
272
273
  ## API
273
274
 
274
- Use `inspectXlsxCache` when a service or test runner needs the cache-doctor
275
- report without shelling out to the CLI:
275
+ Use `inspectXlsxCacheFile` when a service or test runner needs the
276
+ cache-doctor report without shelling out to the CLI. It stays on the same
277
+ file-backed streaming-native path as `xlsx-cache-doctor`:
276
278
 
277
279
  ```ts
278
- import { readFile } from 'node:fs/promises'
279
- import { inspectXlsxCache } from '@bilig/xlsx-formula-recalc'
280
+ import { inspectXlsxCacheFile } from '@bilig/xlsx-formula-recalc'
280
281
 
281
- const report = inspectXlsxCache(await readFile('pricing.xlsx'), {
282
- fileName: 'pricing.xlsx',
282
+ const report = await inspectXlsxCacheFile('pricing.xlsx', {
283
+ maxRssBytes: 350 * 1024 * 1024,
283
284
  })
284
285
 
285
286
  if (report.staleCachedFormulaCount > 0) {
@@ -296,41 +297,50 @@ The API returns the same `schemaVersion`, `cacheStatusSummary`, per-formula
296
297
  `cacheStatus`, and `suggestedReads` fields as the JSON CLI report.
297
298
 
298
299
  ```ts
299
- import { recalculateXlsx } from '@bilig/xlsx-formula-recalc'
300
+ import { recalculateXlsxFileToFile } from '@bilig/xlsx-formula-recalc'
300
301
 
301
- const result = recalculateXlsx(await fs.promises.readFile('pricing.xlsx'), {
302
+ const result = await recalculateXlsxFileToFile('pricing.xlsx', {
303
+ outputPath: 'pricing.recalculated.xlsx',
302
304
  edits: [
303
305
  { target: 'Inputs!B2', value: 48 },
304
306
  { target: 'Inputs!B3', value: 1500 },
305
307
  ],
306
308
  reads: ['Summary!B7'],
309
+ engine: 'streaming-native',
307
310
  })
308
311
 
309
- await fs.promises.writeFile('pricing.recalculated.xlsx', result.xlsx)
310
312
  console.log(result.reads['Summary!B7'])
311
313
  ```
312
314
 
313
- External companion workbooks use the same matching rules as the CLI:
315
+ External companion workbooks stay on the native file-to-file path:
314
316
 
315
317
  ```ts
316
- const result = recalculateXlsx(await fs.promises.readFile('model.xlsx'), {
318
+ import { readFile } from 'node:fs/promises'
319
+
320
+ import { recalculateXlsxFileToFile } from '@bilig/xlsx-formula-recalc'
321
+
322
+ const result = await recalculateXlsxFileToFile('model.xlsx', {
323
+ outputPath: 'model.recalculated.xlsx',
317
324
  externalWorkbooks: [
318
325
  {
319
- bytes: await fs.promises.readFile('rates.xlsx'),
326
+ bytes: await readFile('rates.xlsx'),
320
327
  fileName: 'rates.xlsx',
321
328
  target: 'file:///tmp/rates.xlsx',
322
329
  },
323
330
  ],
324
331
  reads: ['Model!C1'],
332
+ engine: 'streaming-native',
325
333
  })
326
334
 
327
335
  console.log(result.diagnostics?.externalWorkbookHydration)
328
336
  ```
329
337
 
330
- If another library already produced the workbook bytes, pass those bytes
331
- directly:
338
+ If another library already produced workbook bytes instead of a file path, use
339
+ the explicit legacy compatibility import:
332
340
 
333
341
  ```ts
342
+ import { recalculateXlsx } from '@bilig/workpaper/xlsx'
343
+
334
344
  const output = await workbook.outputAsync('nodebuffer') // for example, from xlsx-populate
335
345
 
336
346
  const result = recalculateXlsx(output, {
@@ -338,8 +348,10 @@ const result = recalculateXlsx(output, {
338
348
  })
339
349
  ```
340
350
 
341
- For the full workbook API, import `WorkPaper`, `importXlsx`, and `exportXlsx`
342
- from `@bilig/workpaper`.
351
+ For the full workbook API, use `@bilig/workpaper`. For the old bytes-in,
352
+ bytes-out compatibility API, import from
353
+ `@bilig/workpaper/xlsx` and install `@bilig/workpaper`
354
+ explicitly.
343
355
 
344
356
  ## Common Boundaries
345
357
 
package/SKILL.md CHANGED
@@ -97,13 +97,19 @@ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc workbo
97
97
  ## TypeScript
98
98
 
99
99
  ```ts
100
- import { recalculateXlsx } from '@bilig/xlsx-formula-recalc'
100
+ import { recalculateXlsxFileToFile } from '@bilig/xlsx-formula-recalc'
101
101
 
102
- const result = recalculateXlsx(inputXlsxBytes, {
102
+ const result = await recalculateXlsxFileToFile('workbook.xlsx', {
103
+ outputPath: 'workbook.recalculated.xlsx',
103
104
  edits: [{ target: 'Inputs!B2', value: 48 }],
104
105
  reads: ['Summary!B7'],
106
+ engine: 'streaming-native',
105
107
  })
106
108
  ```
107
109
 
110
+ For the older bytes-in/bytes-out WorkPaper path, import from
111
+ `@bilig/workpaper/xlsx` and install `@bilig/workpaper`
112
+ explicitly.
113
+
108
114
  Prefer `exceljs-formula-recalc` when the caller already owns an ExcelJS
109
115
  `Workbook` object and wants read results patched back into that object.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runXlsxFormulaRecalcCli } from './cli-api.js';
3
- process.exitCode = runXlsxFormulaRecalcCli(process.argv.slice(2), {
2
+ import { runXlsxFormulaRecalcCliAsync } from './cli-api.js';
3
+ process.exitCode = await runXlsxFormulaRecalcCliAsync(process.argv.slice(2), {
4
4
  commandName: 'xlsx-cache-doctor',
5
5
  });
6
6
  //# sourceMappingURL=cache-doctor-cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-doctor-cli.js","sourceRoot":"","sources":["../src/cache-doctor-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,CAAC,QAAQ,GAAG,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAChE,WAAW,EAAE,mBAAmB;CACjC,CAAC,CAAA"}
1
+ {"version":3,"file":"cache-doctor-cli.js","sourceRoot":"","sources":["../src/cache-doctor-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,CAAC,QAAQ,GAAG,MAAM,4BAA4B,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC3E,WAAW,EAAE,mBAAmB;CACjC,CAAC,CAAA"}
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runXlsxFormulaRecalcCli } from './cli-api.js';
3
- process.exitCode = runXlsxFormulaRecalcCli(process.argv.slice(2), {
2
+ import { runXlsxFormulaRecalcCliAsync } from './cli-api.js';
3
+ process.exitCode = await runXlsxFormulaRecalcCliAsync(process.argv.slice(2), {
4
4
  commandName: 'xlsx-recalc',
5
5
  });
6
6
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,CAAC,QAAQ,GAAG,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAChE,WAAW,EAAE,aAAa;CAC3B,CAAC,CAAA"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,CAAC,QAAQ,GAAG,MAAM,4BAA4B,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC3E,WAAW,EAAE,aAAa;CAC3B,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { runBiligEvaluatorCli } from 'xlsx-formula-recalc/evaluator';
2
- process.exitCode = runBiligEvaluatorCli(process.argv.slice(2));
2
+ process.exitCode = await runBiligEvaluatorCli(process.argv.slice(2));
3
3
  //# sourceMappingURL=evaluator-bin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator-bin.js","sourceRoot":"","sources":["../src/evaluator-bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAEpE,OAAO,CAAC,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"evaluator-bin.js","sourceRoot":"","sources":["../src/evaluator-bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAEpE,OAAO,CAAC,QAAQ,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runXlsxFormulaRecalcCli } from './cli-api.js';
3
- process.exitCode = runXlsxFormulaRecalcCli(process.argv.slice(2), {
2
+ import { runXlsxFormulaRecalcCliAsync } from './cli-api.js';
3
+ process.exitCode = await runXlsxFormulaRecalcCliAsync(process.argv.slice(2), {
4
4
  commandName: 'sheetjs-recalc',
5
5
  });
6
6
  //# sourceMappingURL=sheetjs-cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheetjs-cli.js","sourceRoot":"","sources":["../src/sheetjs-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,CAAC,QAAQ,GAAG,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAChE,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAA"}
1
+ {"version":3,"file":"sheetjs-cli.js","sourceRoot":"","sources":["../src/sheetjs-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,CAAC,QAAQ,GAAG,MAAM,4BAA4B,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC3E,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/xlsx-formula-recalc",
3
- "version": "0.161.0",
3
+ "version": "0.164.1",
4
4
  "description": "Diagnose stale cached XLSX formula values and recalculate XLSX formulas in Node.js without Excel, LibreOffice, or browser automation.",
5
5
  "keywords": [
6
6
  "bilig",
@@ -88,7 +88,7 @@
88
88
  "smoke": "node ./dist/cli.js --help"
89
89
  },
90
90
  "dependencies": {
91
- "xlsx-formula-recalc": "0.161.0"
91
+ "xlsx-formula-recalc": "0.164.1"
92
92
  },
93
93
  "engines": {
94
94
  "node": ">=22.0.0"