md-spreadsheet-parser 1.1.3 → 1.1.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.
package/dist/index.js CHANGED
@@ -1,5 +1,16 @@
1
1
  import { cleanCell as _cleanCell, splitRowGfm as _splitRowGfm, parseRow as _parseRow, parseSeparatorRow as _parseSeparatorRow, isSeparatorRow as _isSeparatorRow, parseTable as _parseTable, parseSheet as _parseSheet, parseWorkbook as _parseWorkbook, scanTables as _scanTables, generateTableMarkdown as _generateTableMarkdown, generateSheetMarkdown as _generateSheetMarkdown, generateWorkbookMarkdown as _generateWorkbookMarkdown, parseTableFromFile as _parseTableFromFile, parseWorkbookFromFile as _parseWorkbookFromFile, scanTablesFromFile as _scanTablesFromFile, scanTablesIter as _scanTablesIter, tableToModels as _tableToModels, tableToMarkdown as _tableToMarkdown, tableUpdateCell as _tableUpdateCell, tableDeleteRow as _tableDeleteRow, tableDeleteColumn as _tableDeleteColumn, tableClearColumnData as _tableClearColumnData, tableInsertRow as _tableInsertRow, tableInsertColumn as _tableInsertColumn, sheetGetTable as _sheetGetTable, sheetToMarkdown as _sheetToMarkdown, workbookGetSheet as _workbookGetSheet, workbookToMarkdown as _workbookToMarkdown, workbookAddSheet as _workbookAddSheet, workbookDeleteSheet as _workbookDeleteSheet } from '../dist/parser.js';
2
+ // @ts-ignore
3
+ import path from 'node:path';
4
+ // @ts-ignore
5
+ import process from 'node:process';
6
+ // @ts-ignore
7
+ import { _addPreopen } from '@bytecodealliance/preview2-shim/filesystem';
2
8
  import { clientSideToModels } from './client-adapters.js';
9
+ // @ts-ignore
10
+ _addPreopen('/', path.parse(process.cwd()).root);
11
+ function resolveToVirtualPath(p) {
12
+ return path.resolve(p);
13
+ }
3
14
  export function cleanCell(cell, schema) {
4
15
  const res = _cleanCell(cell, schema);
5
16
  return res;
@@ -49,15 +60,18 @@ export function generateWorkbookMarkdown(workbook, schema) {
49
60
  return res;
50
61
  }
51
62
  export function parseTableFromFile(source, schema) {
52
- const res = _parseTableFromFile(source, schema);
63
+ const source_resolved = resolveToVirtualPath(source);
64
+ const res = _parseTableFromFile(source_resolved, schema);
53
65
  return new Table(res);
54
66
  }
55
67
  export function parseWorkbookFromFile(source, schema) {
56
- const res = _parseWorkbookFromFile(source, schema);
68
+ const source_resolved = resolveToVirtualPath(source);
69
+ const res = _parseWorkbookFromFile(source_resolved, schema);
57
70
  return new Workbook(res);
58
71
  }
59
72
  export function scanTablesFromFile(source, schema) {
60
- const res = _scanTablesFromFile(source, schema);
73
+ const source_resolved = resolveToVirtualPath(source);
74
+ const res = _scanTablesFromFile(source_resolved, schema);
61
75
  return res.map((x) => new Table(x));
62
76
  }
63
77
  export function scanTablesIter(source, schema) {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md-spreadsheet-parser",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "A robust Markdown table parser and manipulator, powered by Python and WebAssembly.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
Binary file
package/src/index.ts CHANGED
@@ -1,6 +1,19 @@
1
1
  import { cleanCell as _cleanCell, splitRowGfm as _splitRowGfm, parseRow as _parseRow, parseSeparatorRow as _parseSeparatorRow, isSeparatorRow as _isSeparatorRow, parseTable as _parseTable, parseSheet as _parseSheet, parseWorkbook as _parseWorkbook, scanTables as _scanTables, generateTableMarkdown as _generateTableMarkdown, generateSheetMarkdown as _generateSheetMarkdown, generateWorkbookMarkdown as _generateWorkbookMarkdown, parseTableFromFile as _parseTableFromFile, parseWorkbookFromFile as _parseWorkbookFromFile, scanTablesFromFile as _scanTablesFromFile, scanTablesIter as _scanTablesIter, tableToModels as _tableToModels, tableToMarkdown as _tableToMarkdown, tableUpdateCell as _tableUpdateCell, tableDeleteRow as _tableDeleteRow, tableDeleteColumn as _tableDeleteColumn, tableClearColumnData as _tableClearColumnData, tableInsertRow as _tableInsertRow, tableInsertColumn as _tableInsertColumn, sheetGetTable as _sheetGetTable, sheetToMarkdown as _sheetToMarkdown, workbookGetSheet as _workbookGetSheet, workbookToMarkdown as _workbookToMarkdown, workbookAddSheet as _workbookAddSheet, workbookDeleteSheet as _workbookDeleteSheet } from '../dist/parser.js';
2
+ // @ts-ignore
3
+ import path from 'node:path';
4
+ // @ts-ignore
5
+ import process from 'node:process';
6
+ // @ts-ignore
7
+ import { _addPreopen } from '@bytecodealliance/preview2-shim/filesystem';
2
8
  import { clientSideToModels } from './client-adapters.js';
3
9
 
10
+ // @ts-ignore
11
+ _addPreopen('/', path.parse(process.cwd()).root);
12
+
13
+ function resolveToVirtualPath(p: string) {
14
+ return path.resolve(p);
15
+ }
16
+
4
17
  export function cleanCell(cell: any, schema: any): any {
5
18
  const res = _cleanCell(cell, schema);
6
19
  return res;
@@ -62,17 +75,20 @@ export function generateWorkbookMarkdown(workbook: any, schema: any): any {
62
75
  }
63
76
 
64
77
  export function parseTableFromFile(source: any, schema?: any): any {
65
- const res = _parseTableFromFile(source, schema);
78
+ const source_resolved = resolveToVirtualPath(source);
79
+ const res = _parseTableFromFile(source_resolved, schema);
66
80
  return new Table(res);
67
81
  }
68
82
 
69
83
  export function parseWorkbookFromFile(source: any, schema?: any): any {
70
- const res = _parseWorkbookFromFile(source, schema);
84
+ const source_resolved = resolveToVirtualPath(source);
85
+ const res = _parseWorkbookFromFile(source_resolved, schema);
71
86
  return new Workbook(res);
72
87
  }
73
88
 
74
89
  export function scanTablesFromFile(source: any, schema?: any): any {
75
- const res = _scanTablesFromFile(source, schema);
90
+ const source_resolved = resolveToVirtualPath(source);
91
+ const res = _scanTablesFromFile(source_resolved, schema);
76
92
  return res.map((x: any) => new Table(x));
77
93
  }
78
94
 
package/dist/parser.wasm DELETED
Binary file