@cj-tech-master/excelts 1.6.3-canary.20251224193141.8bff9dd → 1.6.3-canary.20251226035947.ef0b4f2
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 +5 -4
- package/README_zh.md +5 -4
- package/dist/browser/excelts.esm.js +2447 -3094
- package/dist/browser/excelts.esm.js.map +1 -1
- package/dist/browser/excelts.esm.min.js +23 -25
- package/dist/browser/excelts.iife.js +2448 -3095
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +23 -25
- package/dist/cjs/csv/csv-core.js +2 -2
- package/dist/cjs/csv/csv-stream.js +1 -1
- package/dist/cjs/csv/csv.base.js +10 -27
- package/dist/cjs/csv/csv.js +4 -12
- package/dist/cjs/doc/column.js +21 -0
- package/dist/cjs/doc/worksheet.js +4 -0
- package/dist/cjs/stream/xlsx/workbook-writer.js +4 -4
- package/dist/cjs/stream/xlsx/worksheet-writer.js +8 -1
- package/dist/cjs/utils/datetime.js +648 -0
- package/dist/cjs/utils/parse-sax.js +1190 -12
- package/dist/cjs/utils/unzip/zip-parser.js +11 -0
- package/dist/cjs/utils/zip/compress.base.js +3 -0
- package/dist/cjs/utils/zip/compress.browser.js +74 -30
- package/dist/cjs/utils/zip/deflate-fallback.js +575 -0
- package/dist/cjs/utils/zip/streaming-zip.js +264 -0
- package/dist/cjs/xlsx/xform/sheet/col-breaks-xform.js +38 -0
- package/dist/cjs/xlsx/xform/sheet/page-breaks-xform.js +13 -1
- package/dist/cjs/xlsx/xform/sheet/row-breaks-xform.js +11 -13
- package/dist/cjs/xlsx/xform/sheet/worksheet-xform.js +7 -2
- package/dist/cjs/xlsx/xlsx.browser.js +10 -53
- package/dist/cjs/xlsx/xlsx.js +27 -59
- package/dist/esm/csv/csv-core.js +2 -2
- package/dist/esm/csv/csv-stream.js +1 -1
- package/dist/esm/csv/csv.base.js +10 -24
- package/dist/esm/csv/csv.js +4 -12
- package/dist/esm/doc/column.js +21 -0
- package/dist/esm/doc/worksheet.js +4 -0
- package/dist/esm/stream/xlsx/workbook-writer.js +1 -1
- package/dist/esm/stream/xlsx/worksheet-writer.js +8 -1
- package/dist/esm/utils/datetime.js +639 -0
- package/dist/esm/utils/parse-sax.js +1188 -12
- package/dist/esm/utils/unzip/zip-parser.js +11 -0
- package/dist/esm/utils/zip/compress.base.js +3 -0
- package/dist/esm/utils/zip/compress.browser.js +76 -31
- package/dist/esm/utils/zip/deflate-fallback.js +570 -0
- package/dist/esm/utils/zip/streaming-zip.js +259 -0
- package/dist/esm/xlsx/xform/sheet/col-breaks-xform.js +35 -0
- package/dist/esm/xlsx/xform/sheet/page-breaks-xform.js +13 -1
- package/dist/esm/xlsx/xform/sheet/row-breaks-xform.js +11 -13
- package/dist/esm/xlsx/xform/sheet/worksheet-xform.js +7 -2
- package/dist/esm/xlsx/xlsx.browser.js +10 -53
- package/dist/esm/xlsx/xlsx.js +27 -59
- package/dist/types/csv/csv-core.d.ts +6 -6
- package/dist/types/csv/csv.base.d.ts +4 -3
- package/dist/types/doc/column.d.ts +6 -0
- package/dist/types/doc/worksheet.d.ts +3 -1
- package/dist/types/stream/xlsx/workbook-writer.d.ts +1 -1
- package/dist/types/stream/xlsx/worksheet-writer.d.ts +3 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/utils/datetime.d.ts +85 -0
- package/dist/types/utils/parse-sax.d.ts +108 -1
- package/dist/types/utils/unzip/zip-parser.d.ts +5 -0
- package/dist/types/utils/zip/compress.base.d.ts +3 -0
- package/dist/types/utils/zip/compress.browser.d.ts +27 -18
- package/dist/types/utils/zip/deflate-fallback.d.ts +39 -0
- package/dist/types/utils/zip/streaming-zip.d.ts +96 -0
- package/dist/types/xlsx/xform/sheet/col-breaks-xform.d.ts +16 -0
- package/dist/types/xlsx/xform/sheet/page-breaks-xform.d.ts +4 -0
- package/dist/types/xlsx/xform/sheet/row-breaks-xform.d.ts +4 -0
- package/package.json +7 -28
|
@@ -433,6 +433,17 @@ class ZipParser {
|
|
|
433
433
|
}
|
|
434
434
|
return result;
|
|
435
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Extract all files (sync, Node.js only)
|
|
438
|
+
* Returns object with file paths as keys and Uint8Array content as values
|
|
439
|
+
*/
|
|
440
|
+
extractAllSync() {
|
|
441
|
+
const result = {};
|
|
442
|
+
for (const entry of this.entries) {
|
|
443
|
+
result[entry.path] = extractEntryDataSync(this.data, entry);
|
|
444
|
+
}
|
|
445
|
+
return result;
|
|
446
|
+
}
|
|
436
447
|
/**
|
|
437
448
|
* Iterate over entries with async callback
|
|
438
449
|
*/
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Uses CompressionStream/DecompressionStream API with "deflate-raw" format
|
|
7
7
|
* (raw DEFLATE without zlib header/trailer, required for ZIP files)
|
|
8
|
+
*
|
|
9
|
+
* Browser fallback: For browsers without deflate-raw support (Firefox < 113, Safari < 16.4),
|
|
10
|
+
* see deflate-fallback.ts for pure JS implementation
|
|
8
11
|
*/
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.hasCompressionStream = hasCompressionStream;
|
|
@@ -1,19 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Browser compression utilities
|
|
3
|
+
* Browser compression utilities
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Primary: CompressionStream API (Chrome 103+, Firefox 113+, Safari 16.4+)
|
|
6
|
+
* Fallback: Pure JS DEFLATE implementation for older browsers
|
|
7
|
+
*
|
|
8
|
+
* Supported browsers with fallback:
|
|
9
|
+
* - Chrome >= 85
|
|
10
|
+
* - Firefox >= 79
|
|
11
|
+
* - Safari >= 14
|
|
12
|
+
* - Edge >= 85
|
|
7
13
|
*/
|
|
8
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.hasCompressionStream =
|
|
15
|
+
exports.hasCompressionStream = hasCompressionStream;
|
|
10
16
|
exports.hasNativeZlib = hasNativeZlib;
|
|
11
17
|
exports.compress = compress;
|
|
12
18
|
exports.compressSync = compressSync;
|
|
13
19
|
exports.decompress = decompress;
|
|
14
20
|
exports.decompressSync = decompressSync;
|
|
15
21
|
const compress_base_1 = require("./compress.base");
|
|
16
|
-
|
|
22
|
+
const deflate_fallback_1 = require("./deflate-fallback");
|
|
23
|
+
/**
|
|
24
|
+
* Check if CompressionStream with "deflate-raw" is available
|
|
25
|
+
* Note: Chrome 80-102 has CompressionStream but not deflate-raw support
|
|
26
|
+
*/
|
|
27
|
+
function hasCompressionStream() {
|
|
28
|
+
if (typeof CompressionStream === "undefined") {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
// Test if deflate-raw is supported (not just CompressionStream existence)
|
|
32
|
+
try {
|
|
33
|
+
new CompressionStream("deflate-raw");
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Cache the detection result for performance
|
|
41
|
+
let _hasDeflateRaw = null;
|
|
42
|
+
/**
|
|
43
|
+
* Check if deflate-raw is supported, with caching for performance.
|
|
44
|
+
* The cache is bypassed if CompressionStream is undefined (for testing).
|
|
45
|
+
*/
|
|
46
|
+
function hasDeflateRawSupport() {
|
|
47
|
+
// If API doesn't exist, return false immediately (bypass cache for tests)
|
|
48
|
+
if (typeof CompressionStream === "undefined") {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// Use cached result for performance
|
|
52
|
+
if (_hasDeflateRaw === null) {
|
|
53
|
+
_hasDeflateRaw = hasCompressionStream();
|
|
54
|
+
}
|
|
55
|
+
return _hasDeflateRaw;
|
|
56
|
+
}
|
|
17
57
|
/**
|
|
18
58
|
* Check if native zlib is available (always false in browser)
|
|
19
59
|
*/
|
|
@@ -21,7 +61,7 @@ function hasNativeZlib() {
|
|
|
21
61
|
return false;
|
|
22
62
|
}
|
|
23
63
|
/**
|
|
24
|
-
* Compress data using browser's native CompressionStream
|
|
64
|
+
* Compress data using browser's native CompressionStream or JS fallback
|
|
25
65
|
*
|
|
26
66
|
* @param data - Data to compress
|
|
27
67
|
* @param options - Compression options
|
|
@@ -35,49 +75,53 @@ function hasNativeZlib() {
|
|
|
35
75
|
*/
|
|
36
76
|
async function compress(data, options = {}) {
|
|
37
77
|
const level = options.level ?? 6;
|
|
38
|
-
// Level 0 means no compression
|
|
78
|
+
// Level 0 means no compression (STORE mode)
|
|
39
79
|
if (level === 0) {
|
|
40
|
-
return data;
|
|
80
|
+
return (0, deflate_fallback_1.deflateRawStore)(data);
|
|
41
81
|
}
|
|
42
|
-
// Use CompressionStream
|
|
43
|
-
if (
|
|
82
|
+
// Use native CompressionStream if available
|
|
83
|
+
if (hasDeflateRawSupport()) {
|
|
44
84
|
return (0, compress_base_1.compressWithStream)(data);
|
|
45
85
|
}
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
return data;
|
|
86
|
+
// Fallback to pure JS implementation
|
|
87
|
+
return (0, deflate_fallback_1.deflateRawCompressed)(data);
|
|
49
88
|
}
|
|
50
89
|
/**
|
|
51
|
-
* Compress data synchronously
|
|
52
|
-
* Not available in browser - throws error
|
|
90
|
+
* Compress data synchronously using pure JS implementation
|
|
53
91
|
*
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @
|
|
92
|
+
* @param data - Data to compress
|
|
93
|
+
* @param options - Compression options
|
|
94
|
+
* @returns Compressed data
|
|
57
95
|
*/
|
|
58
|
-
function compressSync(
|
|
59
|
-
|
|
96
|
+
function compressSync(data, options = {}) {
|
|
97
|
+
const level = options.level ?? 6;
|
|
98
|
+
// Level 0 means no compression (STORE mode)
|
|
99
|
+
if (level === 0) {
|
|
100
|
+
return (0, deflate_fallback_1.deflateRawStore)(data);
|
|
101
|
+
}
|
|
102
|
+
// Pure JS implementation
|
|
103
|
+
return (0, deflate_fallback_1.deflateRawCompressed)(data);
|
|
60
104
|
}
|
|
61
105
|
/**
|
|
62
|
-
* Decompress data using browser's native DecompressionStream
|
|
106
|
+
* Decompress data using browser's native DecompressionStream or JS fallback
|
|
63
107
|
*
|
|
64
108
|
* @param data - Compressed data (deflate-raw format)
|
|
65
109
|
* @returns Decompressed data
|
|
66
110
|
*/
|
|
67
111
|
async function decompress(data) {
|
|
68
|
-
// Use DecompressionStream
|
|
69
|
-
if (
|
|
112
|
+
// Use native DecompressionStream if available
|
|
113
|
+
if (hasDeflateRawSupport()) {
|
|
70
114
|
return (0, compress_base_1.decompressWithStream)(data);
|
|
71
115
|
}
|
|
72
|
-
|
|
116
|
+
// Fallback to pure JS implementation
|
|
117
|
+
return (0, deflate_fallback_1.inflateRaw)(data);
|
|
73
118
|
}
|
|
74
119
|
/**
|
|
75
|
-
* Decompress data synchronously
|
|
76
|
-
* Not available in browser - throws error
|
|
120
|
+
* Decompress data synchronously using pure JS implementation
|
|
77
121
|
*
|
|
78
|
-
* @param
|
|
79
|
-
* @
|
|
122
|
+
* @param data - Compressed data (deflate-raw format)
|
|
123
|
+
* @returns Decompressed data
|
|
80
124
|
*/
|
|
81
|
-
function decompressSync(
|
|
82
|
-
|
|
125
|
+
function decompressSync(data) {
|
|
126
|
+
return (0, deflate_fallback_1.inflateRaw)(data);
|
|
83
127
|
}
|