@cj-tech-master/excelts 7.6.0 → 8.0.0
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/README.md +99 -577
- package/README_zh.md +101 -577
- package/dist/browser/index.browser.d.ts +3 -0
- package/dist/browser/index.browser.js +2 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/modules/archive/compression/compress.browser.js +4 -4
- package/dist/browser/modules/archive/compression/deflate-fallback.d.ts +24 -22
- package/dist/browser/modules/archive/compression/deflate-fallback.js +664 -360
- package/dist/browser/modules/archive/compression/streaming-compress.browser.d.ts +7 -0
- package/dist/browser/modules/archive/compression/streaming-compress.browser.js +15 -3
- package/dist/browser/modules/archive/compression/streaming-compress.d.ts +5 -0
- package/dist/browser/modules/archive/compression/streaming-compress.js +7 -0
- package/dist/browser/modules/archive/zip/stream.js +27 -3
- package/dist/browser/modules/excel/workbook.browser.d.ts +72 -0
- package/dist/browser/modules/excel/workbook.browser.js +226 -0
- package/dist/browser/modules/excel/workbook.d.ts +32 -1
- package/dist/browser/modules/excel/workbook.js +47 -2
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +42 -4
- package/dist/browser/modules/markdown/constants.d.ts +30 -0
- package/dist/browser/modules/markdown/constants.js +30 -0
- package/dist/browser/modules/markdown/errors.d.ts +21 -0
- package/dist/browser/modules/markdown/errors.js +23 -0
- package/dist/browser/modules/markdown/format/index.d.ts +54 -0
- package/dist/browser/modules/markdown/format/index.js +307 -0
- package/dist/browser/modules/markdown/index.d.ts +15 -0
- package/dist/browser/modules/markdown/index.js +22 -0
- package/dist/browser/modules/markdown/parse/index.d.ts +70 -0
- package/dist/browser/modules/markdown/parse/index.js +428 -0
- package/dist/browser/modules/markdown/types.d.ts +130 -0
- package/dist/browser/modules/markdown/types.js +6 -0
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/modules/archive/compression/compress.browser.js +4 -4
- package/dist/cjs/modules/archive/compression/deflate-fallback.js +664 -360
- package/dist/cjs/modules/archive/compression/streaming-compress.browser.js +15 -2
- package/dist/cjs/modules/archive/compression/streaming-compress.js +8 -0
- package/dist/cjs/modules/archive/zip/stream.js +26 -2
- package/dist/cjs/modules/excel/workbook.browser.js +226 -0
- package/dist/cjs/modules/excel/workbook.js +46 -1
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +42 -4
- package/dist/cjs/modules/markdown/constants.js +33 -0
- package/dist/cjs/modules/markdown/errors.js +28 -0
- package/dist/cjs/modules/markdown/format/index.js +310 -0
- package/dist/cjs/modules/markdown/index.js +30 -0
- package/dist/cjs/modules/markdown/parse/index.js +432 -0
- package/dist/cjs/modules/markdown/types.js +7 -0
- package/dist/esm/index.browser.js +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/modules/archive/compression/compress.browser.js +4 -4
- package/dist/esm/modules/archive/compression/deflate-fallback.js +664 -360
- package/dist/esm/modules/archive/compression/streaming-compress.browser.js +15 -3
- package/dist/esm/modules/archive/compression/streaming-compress.js +7 -0
- package/dist/esm/modules/archive/zip/stream.js +27 -3
- package/dist/esm/modules/excel/workbook.browser.js +226 -0
- package/dist/esm/modules/excel/workbook.js +47 -2
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +42 -4
- package/dist/esm/modules/markdown/constants.js +30 -0
- package/dist/esm/modules/markdown/errors.js +23 -0
- package/dist/esm/modules/markdown/format/index.js +307 -0
- package/dist/esm/modules/markdown/index.js +22 -0
- package/dist/esm/modules/markdown/parse/index.js +428 -0
- package/dist/esm/modules/markdown/types.js +6 -0
- package/dist/iife/excelts.iife.js +1342 -283
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +38 -34
- package/dist/types/index.browser.d.ts +3 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/modules/archive/compression/deflate-fallback.d.ts +24 -22
- package/dist/types/modules/archive/compression/streaming-compress.browser.d.ts +7 -0
- package/dist/types/modules/archive/compression/streaming-compress.d.ts +5 -0
- package/dist/types/modules/excel/workbook.browser.d.ts +72 -0
- package/dist/types/modules/excel/workbook.d.ts +32 -1
- package/dist/types/modules/markdown/constants.d.ts +30 -0
- package/dist/types/modules/markdown/errors.d.ts +21 -0
- package/dist/types/modules/markdown/format/index.d.ts +54 -0
- package/dist/types/modules/markdown/index.d.ts +15 -0
- package/dist/types/modules/markdown/parse/index.d.ts +70 -0
- package/dist/types/modules/markdown/types.d.ts +130 -0
- package/package.json +56 -32
|
@@ -23,6 +23,8 @@ export { WorksheetWriter } from "./modules/excel/stream/worksheet-writer.js";
|
|
|
23
23
|
export { WorksheetReader } from "./modules/excel/stream/worksheet-reader.js";
|
|
24
24
|
export type { CsvOptions, CsvInput } from "./modules/excel/workbook.js";
|
|
25
25
|
export { CsvParserStream, CsvFormatterStream, createCsvParserStream, createCsvFormatterStream } from "./modules/csv/stream/index.js";
|
|
26
|
+
export type { MarkdownOptions } from "./modules/markdown/types.js";
|
|
27
|
+
export type { MarkdownAlignment, MarkdownParseResult, MarkdownParseOptions, MarkdownColumnConfig, MarkdownFormatOptions } from "./modules/markdown/types.js";
|
|
26
28
|
export { DefinedNames, type DefinedNameModel } from "./modules/excel/defined-names.js";
|
|
27
29
|
export type { CheckboxState } from "./modules/excel/form-control.js";
|
|
28
30
|
export type { ColumnDefn, ColumnHeaderValue } from "./modules/excel/column.js";
|
|
@@ -40,3 +42,4 @@ export { concatUint8Arrays, toUint8Array, stringToUint8Array, uint8ArrayToString
|
|
|
40
42
|
export { pdf, excelToPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./modules/pdf/index.js";
|
|
41
43
|
export type { PdfExportOptions, PdfPageSize, PdfOrientation, PdfMargins, PageSizeName, PdfColor } from "./modules/pdf/index.js";
|
|
42
44
|
export { ExcelError, isExcelError, ExcelFileError, ExcelDownloadError, ExcelNotSupportedError, ExcelStreamStateError, InvalidAddressError, ColumnOutOfBoundsError, RowOutOfBoundsError, MergeConflictError, InvalidValueTypeError, XmlParseError, WorksheetNameError, PivotTableError, TableError, ImageError, MaxItemsExceededError } from "./modules/excel/errors.js";
|
|
45
|
+
export { MarkdownError, MarkdownParseError } from "./modules/markdown/errors.js";
|
|
@@ -63,3 +63,5 @@ export { pdf, excelToPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, Pdf
|
|
|
63
63
|
// Errors
|
|
64
64
|
// =============================================================================
|
|
65
65
|
export { ExcelError, isExcelError, ExcelFileError, ExcelDownloadError, ExcelNotSupportedError, ExcelStreamStateError, InvalidAddressError, ColumnOutOfBoundsError, RowOutOfBoundsError, MergeConflictError, InvalidValueTypeError, XmlParseError, WorksheetNameError, PivotTableError, TableError, ImageError, MaxItemsExceededError } from "./modules/excel/errors.js";
|
|
66
|
+
// Markdown errors
|
|
67
|
+
export { MarkdownError, MarkdownParseError } from "./modules/markdown/errors.js";
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export type { WorksheetReaderOptions, WorksheetEvent, RowEvent, HyperlinkEvent,
|
|
|
22
22
|
export type { WorkbookWriterOptions, WorkbookZipOptions, ZlibOptions } from "./modules/excel/stream/workbook-writer.js";
|
|
23
23
|
export type { CsvOptions, CsvInput } from "./modules/excel/workbook.js";
|
|
24
24
|
export { CsvParserStream, CsvFormatterStream, createCsvParserStream, createCsvFormatterStream } from "./modules/csv/stream/index.js";
|
|
25
|
+
export type { MarkdownOptions } from "./modules/markdown/types.js";
|
|
26
|
+
export type { MarkdownAlignment, MarkdownParseResult, MarkdownParseOptions, MarkdownColumnConfig, MarkdownFormatOptions } from "./modules/markdown/types.js";
|
|
25
27
|
export { DefinedNames, type DefinedNameModel } from "./modules/excel/defined-names.js";
|
|
26
28
|
export type { CheckboxState } from "./modules/excel/form-control.js";
|
|
27
29
|
export type { ColumnDefn, ColumnHeaderValue } from "./modules/excel/column.js";
|
|
@@ -40,3 +42,4 @@ export { concatUint8Arrays, toUint8Array, stringToUint8Array, uint8ArrayToString
|
|
|
40
42
|
export { pdf, excelToPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, PdfStructureError, isPdfError } from "./modules/pdf/index.js";
|
|
41
43
|
export type { PdfExportOptions, PdfPageSize, PdfOrientation, PdfMargins, PageSizeName, PdfColor } from "./modules/pdf/index.js";
|
|
42
44
|
export { ExcelError, isExcelError, ExcelFileError, ExcelDownloadError, ExcelNotSupportedError, ExcelStreamStateError, InvalidAddressError, ColumnOutOfBoundsError, RowOutOfBoundsError, MergeConflictError, InvalidValueTypeError, XmlParseError, WorksheetNameError, PivotTableError, TableError, ImageError, MaxItemsExceededError } from "./modules/excel/errors.js";
|
|
45
|
+
export { MarkdownError, MarkdownParseError } from "./modules/markdown/errors.js";
|
package/dist/browser/index.js
CHANGED
|
@@ -59,3 +59,5 @@ export { pdf, excelToPdf, PageSizes, PdfError, PdfRenderError, PdfFontError, Pdf
|
|
|
59
59
|
// Errors
|
|
60
60
|
// =============================================================================
|
|
61
61
|
export { ExcelError, isExcelError, ExcelFileError, ExcelDownloadError, ExcelNotSupportedError, ExcelStreamStateError, InvalidAddressError, ColumnOutOfBoundsError, RowOutOfBoundsError, MergeConflictError, InvalidValueTypeError, XmlParseError, WorksheetNameError, PivotTableError, TableError, ImageError, MaxItemsExceededError } from "./modules/excel/errors.js";
|
|
62
|
+
// Markdown errors
|
|
63
|
+
export { MarkdownError, MarkdownParseError } from "./modules/markdown/errors.js";
|
|
@@ -110,7 +110,7 @@ async function processWithStrategy(strategy, data, options) {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
// Fallback to pure JS implementation.
|
|
113
|
-
return strategy.jsFallback(data);
|
|
113
|
+
return strategy.jsFallback(data, options.level);
|
|
114
114
|
}
|
|
115
115
|
// =============================================================================
|
|
116
116
|
// Public API
|
|
@@ -135,7 +135,7 @@ export function compressSync(data, options = {}) {
|
|
|
135
135
|
if (level === 0) {
|
|
136
136
|
return data;
|
|
137
137
|
}
|
|
138
|
-
return deflateRawCompressed(data);
|
|
138
|
+
return deflateRawCompressed(data, level);
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Decompress data using browser's native DecompressionStream or JS fallback
|
|
@@ -248,7 +248,7 @@ export async function gzip(data, options = {}) {
|
|
|
248
248
|
*/
|
|
249
249
|
export function gzipSync(data, options = {}) {
|
|
250
250
|
const level = options.level ?? DEFAULT_COMPRESS_LEVEL;
|
|
251
|
-
const deflated = level === 0 ? deflateRawStore(data) : deflateRawCompressed(data);
|
|
251
|
+
const deflated = level === 0 ? deflateRawStore(data) : deflateRawCompressed(data, level);
|
|
252
252
|
return wrapGzip(deflated, data);
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
@@ -324,7 +324,7 @@ export async function zlib(data, options = {}) {
|
|
|
324
324
|
*/
|
|
325
325
|
export function zlibSync(data, options = {}) {
|
|
326
326
|
const level = options.level ?? DEFAULT_COMPRESS_LEVEL;
|
|
327
|
-
const deflated = level === 0 ? deflateRawStore(data) : deflateRawCompressed(data);
|
|
327
|
+
const deflated = level === 0 ? deflateRawStore(data) : deflateRawCompressed(data, level);
|
|
328
328
|
return wrapZlib(deflated, data, level);
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
@@ -28,18 +28,18 @@ export declare function inflateRaw(data: Uint8Array): Uint8Array;
|
|
|
28
28
|
*/
|
|
29
29
|
export declare function deflateRawStore(data: Uint8Array): Uint8Array;
|
|
30
30
|
/**
|
|
31
|
-
* Compress data using DEFLATE with
|
|
31
|
+
* Compress data using DEFLATE with Dynamic Huffman codes (BTYPE=2).
|
|
32
32
|
*
|
|
33
|
-
* Uses LZ77 with hash chains and lazy matching for
|
|
34
|
-
*
|
|
35
|
-
* after zlib's "fast" and "slow" deflate strategies.
|
|
33
|
+
* Uses LZ77 with hash chains and lazy matching for match finding, then builds
|
|
34
|
+
* optimal Huffman trees from the symbol frequencies for entropy coding.
|
|
36
35
|
*
|
|
37
36
|
* @param data - Data to compress
|
|
37
|
+
* @param level - Compression level (1-9, default 6)
|
|
38
38
|
* @returns Compressed data in deflate-raw format
|
|
39
39
|
*/
|
|
40
|
-
export declare function deflateRawCompressed(data: Uint8Array): Uint8Array;
|
|
40
|
+
export declare function deflateRawCompressed(data: Uint8Array, level?: number): Uint8Array;
|
|
41
41
|
/**
|
|
42
|
-
* Stateful synchronous DEFLATE compressor.
|
|
42
|
+
* Stateful synchronous DEFLATE compressor with Dynamic Huffman encoding.
|
|
43
43
|
*
|
|
44
44
|
* Unlike `deflateRawCompressed` (which is a one-shot function), this class
|
|
45
45
|
* maintains state across multiple `write()` calls:
|
|
@@ -47,32 +47,29 @@ export declare function deflateRawCompressed(data: Uint8Array): Uint8Array;
|
|
|
47
47
|
* - **LZ77 sliding window**: back-references can span across chunks.
|
|
48
48
|
* - **Hash chains**: match positions persist across chunks with typed-array
|
|
49
49
|
* hash tables for fast lookup.
|
|
50
|
-
* - **Lazy matching**:
|
|
51
|
-
*
|
|
50
|
+
* - **Lazy matching**: configurable per compression level.
|
|
51
|
+
* - **Dynamic Huffman**: each block builds optimal Huffman trees from
|
|
52
|
+
* actual symbol frequencies (BTYPE=2), producing significantly smaller
|
|
53
|
+
* output than fixed Huffman (BTYPE=1).
|
|
52
54
|
* - **Bit writer**: bit position is preserved, so consecutive blocks form
|
|
53
55
|
* a single valid DEFLATE bit-stream without alignment issues.
|
|
54
56
|
*
|
|
55
|
-
* Each `write()` emits one non-final
|
|
56
|
-
* `finish()` emits a final empty block (BFINAL=1)
|
|
57
|
+
* Each `write()` emits one non-final Dynamic Huffman block (BFINAL=0).
|
|
58
|
+
* `finish()` emits a final empty fixed-Huffman block (BFINAL=1).
|
|
57
59
|
*
|
|
58
60
|
* This is the pure-JS equivalent of Node.js `zlib.deflateRawSync` with
|
|
59
61
|
* `Z_SYNC_FLUSH`, used by the streaming ZIP writer (`pushSync`) to achieve
|
|
60
62
|
* constant-memory streaming in both Node.js and browsers.
|
|
63
|
+
*
|
|
64
|
+
* @param level - Compression level (0-9). Level 0 emits STORE blocks.
|
|
65
|
+
* Default: 6 (matching zlib default).
|
|
61
66
|
*/
|
|
62
67
|
export declare class SyncDeflater {
|
|
63
68
|
private _output;
|
|
64
|
-
private
|
|
65
|
-
private
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/** Number of valid bytes currently in the window. */
|
|
69
|
-
private _windowLen;
|
|
70
|
-
/** Total bytes written so far (monotonically increasing; used for hash offsets). */
|
|
71
|
-
private _totalIn;
|
|
72
|
-
private _hasPrevMatch;
|
|
73
|
-
private _prevMatchLen;
|
|
74
|
-
private _prevMatchDist;
|
|
75
|
-
private _prevLiteral;
|
|
69
|
+
private _config;
|
|
70
|
+
private _level;
|
|
71
|
+
private _state;
|
|
72
|
+
constructor(level?: number);
|
|
76
73
|
/**
|
|
77
74
|
* Compress a chunk and return the compressed bytes produced so far.
|
|
78
75
|
* The output is a valid prefix of a DEFLATE stream (one or more non-final blocks).
|
|
@@ -83,4 +80,9 @@ export declare class SyncDeflater {
|
|
|
83
80
|
* and returns any remaining bytes (including partial-byte padding).
|
|
84
81
|
*/
|
|
85
82
|
finish(): Uint8Array;
|
|
83
|
+
/**
|
|
84
|
+
* Write STORE (uncompressed) blocks for level=0.
|
|
85
|
+
* Each block is non-final (BFINAL=0); the final block is emitted by finish().
|
|
86
|
+
*/
|
|
87
|
+
private _writeStore;
|
|
86
88
|
}
|