@cj-tech-master/excelts 1.6.3-canary.20251224193747.e89b618 → 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
|
@@ -7,7 +7,7 @@ import { Table, type TableModel } from "./table";
|
|
|
7
7
|
import { DataValidations } from "./data-validations";
|
|
8
8
|
import { type PivotTable, type PivotTableModel } from "./pivot-table";
|
|
9
9
|
import type { Workbook } from "./workbook";
|
|
10
|
-
import type { AddImageRange, AutoFilter, CellValue, ConditionalFormattingOptions, DataValidation, RowBreak, RowValues, TableProperties, WorksheetProperties, WorksheetView } from "../types";
|
|
10
|
+
import type { AddImageRange, AutoFilter, CellValue, ColBreak, ConditionalFormattingOptions, DataValidation, RowBreak, RowValues, TableProperties, WorksheetProperties, WorksheetView } from "../types";
|
|
11
11
|
type DataValidationModel = {
|
|
12
12
|
[address: string]: DataValidation | undefined;
|
|
13
13
|
};
|
|
@@ -96,6 +96,7 @@ interface WorksheetModel {
|
|
|
96
96
|
pageSetup: PageSetup;
|
|
97
97
|
headerFooter: HeaderFooter;
|
|
98
98
|
rowBreaks: RowBreak[];
|
|
99
|
+
colBreaks: ColBreak[];
|
|
99
100
|
views: Partial<WorksheetView>[];
|
|
100
101
|
autoFilter: AutoFilter | null;
|
|
101
102
|
media: ImageModel[];
|
|
@@ -120,6 +121,7 @@ declare class Worksheet {
|
|
|
120
121
|
private _keys;
|
|
121
122
|
private _merges;
|
|
122
123
|
rowBreaks: RowBreak[];
|
|
124
|
+
colBreaks: ColBreak[];
|
|
123
125
|
properties: Partial<WorksheetProperties>;
|
|
124
126
|
pageSetup: PageSetup;
|
|
125
127
|
headerFooter: HeaderFooter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import { Zip } from "
|
|
2
|
+
import { Zip } from "../../utils/zip/streaming-zip";
|
|
3
3
|
import { StreamBuf } from "../../utils/stream-buf";
|
|
4
4
|
import { StylesXform } from "../../xlsx/xform/style/styles-xform";
|
|
5
5
|
import { SharedStrings } from "../../utils/shared-strings";
|
|
@@ -6,7 +6,7 @@ import { SheetRelsWriter } from "./sheet-rels-writer";
|
|
|
6
6
|
import { SheetCommentsWriter } from "./sheet-comments-writer";
|
|
7
7
|
import { DataValidations } from "../../doc/data-validations";
|
|
8
8
|
import type { StreamBuf } from "../../utils/stream-buf";
|
|
9
|
-
import type { RowBreak, PageSetup, HeaderFooter, WorksheetProperties, WorksheetView, WorksheetState, AutoFilter, WorksheetProtection, ConditionalFormattingOptions } from "../../types";
|
|
9
|
+
import type { RowBreak, ColBreak, PageSetup, HeaderFooter, WorksheetProperties, WorksheetView, WorksheetState, AutoFilter, WorksheetProtection, ConditionalFormattingOptions } from "../../types";
|
|
10
10
|
interface WorksheetWriterOptions {
|
|
11
11
|
id: number;
|
|
12
12
|
name?: string;
|
|
@@ -46,6 +46,7 @@ declare class WorksheetWriter {
|
|
|
46
46
|
_siFormulae: number;
|
|
47
47
|
conditionalFormatting: ConditionalFormattingOptions[];
|
|
48
48
|
rowBreaks: RowBreak[];
|
|
49
|
+
colBreaks: ColBreak[];
|
|
49
50
|
properties: Partial<WorksheetProperties> & {
|
|
50
51
|
defaultRowHeight: number;
|
|
51
52
|
dyDescent: number;
|
|
@@ -123,6 +124,7 @@ declare class WorksheetWriter {
|
|
|
123
124
|
_writeHyperlinks(): void;
|
|
124
125
|
_writeConditionalFormatting(): void;
|
|
125
126
|
_writeRowBreaks(): void;
|
|
127
|
+
_writeColBreaks(): void;
|
|
126
128
|
_writeDataValidations(): void;
|
|
127
129
|
_writeSheetProtection(): void;
|
|
128
130
|
_writePageMargins(): void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-performance native date parsing and formatting utilities
|
|
3
|
+
*
|
|
4
|
+
* Zero external dependencies. Optimized for CSV batch processing.
|
|
5
|
+
* Uses character code operations and lookup tables for maximum speed.
|
|
6
|
+
*/
|
|
7
|
+
/** Supported date format strings */
|
|
8
|
+
export type DateFormat = "YYYY-MM-DD[T]HH:mm:ssZ" | "YYYY-MM-DD[T]HH:mm:ss" | "YYYY-MM-DD[T]HH:mm:ss.SSSZ" | "YYYY-MM-DD" | "YYYY-MM-DD HH:mm:ss" | "MM-DD-YYYY" | "MM-DD-YYYY HH:mm:ss" | "MM/DD/YYYY HH:mm:ss" | "DD-MM-YYYY" | "DD-MM-YYYY HH:mm:ss" | "DD/MM/YYYY HH:mm:ss";
|
|
9
|
+
/**
|
|
10
|
+
* Quick pre-filter to reject non-date strings
|
|
11
|
+
*/
|
|
12
|
+
export declare function mightBeDate(s: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parse a date string
|
|
15
|
+
*
|
|
16
|
+
* @param value - String to parse
|
|
17
|
+
* @param formats - Specific formats to try (optional, auto-detects ISO if omitted)
|
|
18
|
+
* @returns Date object or null
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* parseDate("2024-12-26") // auto-detect ISO
|
|
22
|
+
* parseDate("12-26-2024", ["MM-DD-YYYY"]) // explicit US format
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseDate(value: string, formats?: DateFormat[]): Date | null;
|
|
25
|
+
/**
|
|
26
|
+
* Format a Date to string
|
|
27
|
+
*
|
|
28
|
+
* @param date - Date to format
|
|
29
|
+
* @param format - Format template (optional, defaults to ISO)
|
|
30
|
+
* @param utc - Use UTC time (default: false)
|
|
31
|
+
* @returns Formatted string or empty string if invalid
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* formatDate(date) // "2024-12-26T10:30:00.000+08:00"
|
|
35
|
+
* formatDate(date, "YYYY-MM-DD", true) // "2024-12-26"
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatDate(date: Date, format?: string, utc?: boolean): string;
|
|
38
|
+
/**
|
|
39
|
+
* Optimized date parser for batch processing
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const parser = DateParser.create(["YYYY-MM-DD"]);
|
|
43
|
+
* const dates = parser.parseAll(csvStrings);
|
|
44
|
+
*/
|
|
45
|
+
export declare class DateParser {
|
|
46
|
+
private readonly fns;
|
|
47
|
+
private readonly single;
|
|
48
|
+
private readonly fn0;
|
|
49
|
+
private constructor();
|
|
50
|
+
/** Create parser for specific formats */
|
|
51
|
+
static create(formats: readonly DateFormat[]): DateParser;
|
|
52
|
+
/** Create parser for auto-detecting ISO formats */
|
|
53
|
+
static iso(): DateParser;
|
|
54
|
+
/** Parse single value */
|
|
55
|
+
parse: (value: string) => Date | null;
|
|
56
|
+
/** Parse array of values */
|
|
57
|
+
parseAll(values: string[]): (Date | null)[];
|
|
58
|
+
/** Parse and filter valid dates */
|
|
59
|
+
parseValid(values: string[]): Date[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Optimized date formatter for batch processing
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const formatter = DateFormatter.create("YYYY-MM-DD", { utc: true });
|
|
66
|
+
* const strings = formatter.formatAll(dates);
|
|
67
|
+
*/
|
|
68
|
+
export declare class DateFormatter {
|
|
69
|
+
private readonly fn;
|
|
70
|
+
private constructor();
|
|
71
|
+
/** Create ISO formatter (fastest) */
|
|
72
|
+
static iso(utc?: boolean): DateFormatter;
|
|
73
|
+
/** Create custom format formatter */
|
|
74
|
+
static create(format: string, options?: {
|
|
75
|
+
utc?: boolean;
|
|
76
|
+
}): DateFormatter;
|
|
77
|
+
/** Generic formatter for arbitrary formats */
|
|
78
|
+
private static createGeneric;
|
|
79
|
+
/** Format single date */
|
|
80
|
+
format: (date: Date) => string;
|
|
81
|
+
/** Format array of dates */
|
|
82
|
+
formatAll(dates: Date[]): string[];
|
|
83
|
+
}
|
|
84
|
+
/** Get supported format strings */
|
|
85
|
+
export declare function getSupportedFormats(): DateFormat[];
|
|
@@ -1,6 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* High-performance SAX XML parser
|
|
3
|
+
*
|
|
4
|
+
* Minimal implementation optimized for Excel XML parsing.
|
|
5
|
+
* Supports: opentag, text, closetag, error events.
|
|
6
|
+
* Zero external dependencies.
|
|
7
|
+
*
|
|
8
|
+
* Based on XML 1.0 specification with optimizations for common Excel XML patterns.
|
|
9
|
+
*/
|
|
10
|
+
export interface SaxEvent {
|
|
2
11
|
eventType: "opentag" | "text" | "closetag";
|
|
3
12
|
value: any;
|
|
4
13
|
}
|
|
14
|
+
export interface SaxesTagPlain {
|
|
15
|
+
name: string;
|
|
16
|
+
attributes: Record<string, string>;
|
|
17
|
+
isSelfClosing: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SaxesOptions {
|
|
20
|
+
xmlns?: boolean;
|
|
21
|
+
position?: boolean;
|
|
22
|
+
fileName?: string;
|
|
23
|
+
fragment?: boolean;
|
|
24
|
+
}
|
|
25
|
+
type TextHandler = (text: string) => void;
|
|
26
|
+
type OpenTagHandler = (tag: SaxesTagPlain) => void;
|
|
27
|
+
type CloseTagHandler = (tag: SaxesTagPlain) => void;
|
|
28
|
+
type ErrorHandler = (err: Error) => void;
|
|
29
|
+
export declare class SaxesParser {
|
|
30
|
+
private trackPosition;
|
|
31
|
+
private fileName?;
|
|
32
|
+
private fragment;
|
|
33
|
+
private state;
|
|
34
|
+
private chunk;
|
|
35
|
+
private i;
|
|
36
|
+
private prevI;
|
|
37
|
+
private text;
|
|
38
|
+
private name;
|
|
39
|
+
private q;
|
|
40
|
+
private tags;
|
|
41
|
+
private tag;
|
|
42
|
+
private attribList;
|
|
43
|
+
private entity;
|
|
44
|
+
private entityReturnState;
|
|
45
|
+
private openWakaBang;
|
|
46
|
+
private sawRoot;
|
|
47
|
+
private closedRoot;
|
|
48
|
+
private carriedFromPrevious?;
|
|
49
|
+
private _closed;
|
|
50
|
+
private reportedTextBeforeRoot;
|
|
51
|
+
private reportedTextAfterRoot;
|
|
52
|
+
line: number;
|
|
53
|
+
column: number;
|
|
54
|
+
private positionAtNewLine;
|
|
55
|
+
private chunkPosition;
|
|
56
|
+
ENTITIES: Record<string, string>;
|
|
57
|
+
private textHandler?;
|
|
58
|
+
private openTagHandler?;
|
|
59
|
+
private closeTagHandler?;
|
|
60
|
+
private errorHandler?;
|
|
61
|
+
constructor(opt?: SaxesOptions);
|
|
62
|
+
get closed(): boolean;
|
|
63
|
+
get position(): number;
|
|
64
|
+
private _init;
|
|
65
|
+
on(name: "text", handler: TextHandler): void;
|
|
66
|
+
on(name: "opentag", handler: OpenTagHandler): void;
|
|
67
|
+
on(name: "closetag", handler: CloseTagHandler): void;
|
|
68
|
+
on(name: "error", handler: ErrorHandler): void;
|
|
69
|
+
off(name: string): void;
|
|
70
|
+
private makeError;
|
|
71
|
+
fail(message: string): this;
|
|
72
|
+
write(chunk: string | null): this;
|
|
73
|
+
close(): this;
|
|
74
|
+
private getCode;
|
|
75
|
+
private unget;
|
|
76
|
+
private processState;
|
|
77
|
+
private sText;
|
|
78
|
+
private handleTextInRoot;
|
|
79
|
+
private handleTextOutsideRoot;
|
|
80
|
+
private sOpenWaka;
|
|
81
|
+
private sOpenWakaBang;
|
|
82
|
+
private sOpenTag;
|
|
83
|
+
private sOpenTagSlash;
|
|
84
|
+
private sAttrib;
|
|
85
|
+
private sAttribName;
|
|
86
|
+
private sAttribNameSawWhite;
|
|
87
|
+
private sAttribValue;
|
|
88
|
+
private sAttribValueQuoted;
|
|
89
|
+
private sAttribValueClosed;
|
|
90
|
+
private sCloseTag;
|
|
91
|
+
private sCloseTagSawWhite;
|
|
92
|
+
private sComment;
|
|
93
|
+
private sCommentEnding;
|
|
94
|
+
private sCommentEnded;
|
|
95
|
+
private sCData;
|
|
96
|
+
private sCDataEnding;
|
|
97
|
+
private sCDataEnding2;
|
|
98
|
+
private sPI;
|
|
99
|
+
private sPIEnding;
|
|
100
|
+
private sDoctype;
|
|
101
|
+
private sDoctypeQuote;
|
|
102
|
+
private sDoctypeDTD;
|
|
103
|
+
private sDoctypeDTDQuoted;
|
|
104
|
+
private sEntity;
|
|
105
|
+
private parseEntity;
|
|
106
|
+
private skipSpaces;
|
|
107
|
+
private openTag;
|
|
108
|
+
private openSelfClosingTag;
|
|
109
|
+
private closeTag;
|
|
110
|
+
private end;
|
|
111
|
+
}
|
|
5
112
|
declare function parseSax(iterable: any): AsyncGenerator<SaxEvent[]>;
|
|
6
113
|
export { parseSax };
|
|
@@ -85,6 +85,11 @@ export declare class ZipParser {
|
|
|
85
85
|
* Extract all files (async)
|
|
86
86
|
*/
|
|
87
87
|
extractAll(): Promise<Map<string, Uint8Array>>;
|
|
88
|
+
/**
|
|
89
|
+
* Extract all files (sync, Node.js only)
|
|
90
|
+
* Returns object with file paths as keys and Uint8Array content as values
|
|
91
|
+
*/
|
|
92
|
+
extractAllSync(): Record<string, Uint8Array>;
|
|
88
93
|
/**
|
|
89
94
|
* Iterate over entries with async callback
|
|
90
95
|
*/
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Uses CompressionStream/DecompressionStream API with "deflate-raw" format
|
|
6
6
|
* (raw DEFLATE without zlib header/trailer, required for ZIP files)
|
|
7
|
+
*
|
|
8
|
+
* Browser fallback: For browsers without deflate-raw support (Firefox < 113, Safari < 16.4),
|
|
9
|
+
* see deflate-fallback.ts for pure JS implementation
|
|
7
10
|
*/
|
|
8
11
|
/**
|
|
9
12
|
* Compression options
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Browser compression utilities
|
|
2
|
+
* Browser compression utilities
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Primary: CompressionStream API (Chrome 103+, Firefox 113+, Safari 16.4+)
|
|
5
|
+
* Fallback: Pure JS DEFLATE implementation for older browsers
|
|
6
|
+
*
|
|
7
|
+
* Supported browsers with fallback:
|
|
8
|
+
* - Chrome >= 85
|
|
9
|
+
* - Firefox >= 79
|
|
10
|
+
* - Safari >= 14
|
|
11
|
+
* - Edge >= 85
|
|
12
|
+
*/
|
|
13
|
+
import { type CompressOptions } from "./compress.base";
|
|
14
|
+
export { type CompressOptions };
|
|
15
|
+
/**
|
|
16
|
+
* Check if CompressionStream with "deflate-raw" is available
|
|
17
|
+
* Note: Chrome 80-102 has CompressionStream but not deflate-raw support
|
|
6
18
|
*/
|
|
7
|
-
|
|
8
|
-
export { type CompressOptions, hasCompressionStream };
|
|
19
|
+
export declare function hasCompressionStream(): boolean;
|
|
9
20
|
/**
|
|
10
21
|
* Check if native zlib is available (always false in browser)
|
|
11
22
|
*/
|
|
12
23
|
export declare function hasNativeZlib(): boolean;
|
|
13
24
|
/**
|
|
14
|
-
* Compress data using browser's native CompressionStream
|
|
25
|
+
* Compress data using browser's native CompressionStream or JS fallback
|
|
15
26
|
*
|
|
16
27
|
* @param data - Data to compress
|
|
17
28
|
* @param options - Compression options
|
|
@@ -27,28 +38,26 @@ export declare function compress(data: Uint8Array, options?: {
|
|
|
27
38
|
level?: number;
|
|
28
39
|
}): Promise<Uint8Array>;
|
|
29
40
|
/**
|
|
30
|
-
* Compress data synchronously
|
|
31
|
-
* Not available in browser - throws error
|
|
41
|
+
* Compress data synchronously using pure JS implementation
|
|
32
42
|
*
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @
|
|
43
|
+
* @param data - Data to compress
|
|
44
|
+
* @param options - Compression options
|
|
45
|
+
* @returns Compressed data
|
|
36
46
|
*/
|
|
37
|
-
export declare function compressSync(
|
|
47
|
+
export declare function compressSync(data: Uint8Array, options?: {
|
|
38
48
|
level?: number;
|
|
39
49
|
}): Uint8Array;
|
|
40
50
|
/**
|
|
41
|
-
* Decompress data using browser's native DecompressionStream
|
|
51
|
+
* Decompress data using browser's native DecompressionStream or JS fallback
|
|
42
52
|
*
|
|
43
53
|
* @param data - Compressed data (deflate-raw format)
|
|
44
54
|
* @returns Decompressed data
|
|
45
55
|
*/
|
|
46
56
|
export declare function decompress(data: Uint8Array): Promise<Uint8Array>;
|
|
47
57
|
/**
|
|
48
|
-
* Decompress data synchronously
|
|
49
|
-
* Not available in browser - throws error
|
|
58
|
+
* Decompress data synchronously using pure JS implementation
|
|
50
59
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* @
|
|
60
|
+
* @param data - Compressed data (deflate-raw format)
|
|
61
|
+
* @returns Decompressed data
|
|
53
62
|
*/
|
|
54
|
-
export declare function decompressSync(
|
|
63
|
+
export declare function decompressSync(data: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure JavaScript DEFLATE implementation for browsers without CompressionStream support
|
|
3
|
+
*
|
|
4
|
+
* This fallback supports:
|
|
5
|
+
* - Decompression: Full DEFLATE decompression (RFC 1951)
|
|
6
|
+
* - Compression: STORE mode only (no compression, but valid DEFLATE format)
|
|
7
|
+
*
|
|
8
|
+
* Used automatically when CompressionStream with "deflate-raw" is unavailable:
|
|
9
|
+
* - Firefox < 113
|
|
10
|
+
* - Safari < 16.4
|
|
11
|
+
* - Chrome < 103
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Decompress DEFLATE data (raw format, no zlib header)
|
|
15
|
+
*
|
|
16
|
+
* @param data - Compressed data in deflate-raw format
|
|
17
|
+
* @returns Decompressed data
|
|
18
|
+
*/
|
|
19
|
+
export declare function inflateRaw(data: Uint8Array): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* Compress data using DEFLATE STORE mode (no compression)
|
|
22
|
+
*
|
|
23
|
+
* This creates valid DEFLATE data but without actual compression.
|
|
24
|
+
* Files will be larger but this works on all browsers.
|
|
25
|
+
*
|
|
26
|
+
* @param data - Data to "compress"
|
|
27
|
+
* @returns DEFLATE-formatted data (stored, not compressed)
|
|
28
|
+
*/
|
|
29
|
+
export declare function deflateRawStore(data: Uint8Array): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Compress data using DEFLATE with fixed Huffman codes
|
|
32
|
+
*
|
|
33
|
+
* This provides real compression using LZ77 + fixed Huffman codes.
|
|
34
|
+
* Not as efficient as full DEFLATE but much better than STORE mode.
|
|
35
|
+
*
|
|
36
|
+
* @param data - Data to compress
|
|
37
|
+
* @returns Compressed data in deflate-raw format
|
|
38
|
+
*/
|
|
39
|
+
export declare function deflateRawCompressed(data: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming ZIP creator - fflate-compatible API
|
|
3
|
+
*
|
|
4
|
+
* This module provides a streaming ZIP API compatible with fflate's Zip/ZipDeflate,
|
|
5
|
+
* but uses native zlib compression for better performance.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* const zip = new StreamingZip((err, data, final) => {
|
|
10
|
+
* if (err) handleError(err);
|
|
11
|
+
* else {
|
|
12
|
+
* stream.write(data);
|
|
13
|
+
* if (final) stream.end();
|
|
14
|
+
* }
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const file = new ZipDeflateFile("path/file.txt", { level: 6 });
|
|
18
|
+
* zip.add(file);
|
|
19
|
+
* file.push(data1);
|
|
20
|
+
* file.push(data2, true); // true = final chunk
|
|
21
|
+
*
|
|
22
|
+
* zip.end();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Internal entry info for central directory
|
|
27
|
+
*/
|
|
28
|
+
interface ZipEntryInfo {
|
|
29
|
+
name: Uint8Array;
|
|
30
|
+
crc: number;
|
|
31
|
+
compressedSize: number;
|
|
32
|
+
uncompressedSize: number;
|
|
33
|
+
compressionMethod: number;
|
|
34
|
+
dosTime: number;
|
|
35
|
+
dosDate: number;
|
|
36
|
+
offset: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* ZipDeflate-compatible file stream
|
|
40
|
+
* Collects data chunks, compresses on finalization
|
|
41
|
+
*/
|
|
42
|
+
export declare class ZipDeflateFile {
|
|
43
|
+
private chunks;
|
|
44
|
+
private totalSize;
|
|
45
|
+
private finalized;
|
|
46
|
+
private _ondata;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly level: number;
|
|
49
|
+
constructor(name: string, options?: {
|
|
50
|
+
level?: number;
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Set data callback (called by StreamingZip)
|
|
54
|
+
*/
|
|
55
|
+
set ondata(cb: (data: Uint8Array, final: boolean) => void);
|
|
56
|
+
/**
|
|
57
|
+
* Push data to the file
|
|
58
|
+
* @param data - Data chunk
|
|
59
|
+
* @param final - Whether this is the final chunk
|
|
60
|
+
*/
|
|
61
|
+
push(data: Uint8Array, final?: boolean): void;
|
|
62
|
+
/**
|
|
63
|
+
* Flush collected data through compression and emit
|
|
64
|
+
*/
|
|
65
|
+
private _flush;
|
|
66
|
+
/**
|
|
67
|
+
* Get entry info (called by StreamingZip after finalization)
|
|
68
|
+
*/
|
|
69
|
+
getEntryInfo(): ZipEntryInfo | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Streaming ZIP - fflate Zip-compatible API
|
|
73
|
+
* Creates ZIP files in a streaming manner
|
|
74
|
+
*/
|
|
75
|
+
export declare class StreamingZip {
|
|
76
|
+
private callback;
|
|
77
|
+
private entries;
|
|
78
|
+
private currentOffset;
|
|
79
|
+
private ended;
|
|
80
|
+
/**
|
|
81
|
+
* Create a streaming ZIP
|
|
82
|
+
* @param callback - Called with (err, data, final) as data becomes available
|
|
83
|
+
*/
|
|
84
|
+
constructor(callback: (err: Error | null, data: Uint8Array, final: boolean) => void);
|
|
85
|
+
/**
|
|
86
|
+
* Add a file to the ZIP
|
|
87
|
+
* @param file - ZipDeflateFile instance
|
|
88
|
+
*/
|
|
89
|
+
add(file: ZipDeflateFile): void;
|
|
90
|
+
/**
|
|
91
|
+
* Finalize the ZIP
|
|
92
|
+
* Writes central directory and end-of-central-directory record
|
|
93
|
+
*/
|
|
94
|
+
end(): void;
|
|
95
|
+
}
|
|
96
|
+
export { StreamingZip as Zip, ZipDeflateFile as ZipDeflate };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ListXform } from "../list-xform";
|
|
2
|
+
/**
|
|
3
|
+
* Xform for column page breaks (colBreaks element in worksheet XML)
|
|
4
|
+
* Used to define manual page breaks between columns when printing.
|
|
5
|
+
*
|
|
6
|
+
* XML structure:
|
|
7
|
+
* <colBreaks count="3" manualBreakCount="3">
|
|
8
|
+
* <brk id="3" max="1048575" man="1"/>
|
|
9
|
+
* <brk id="6" max="1048575" man="1"/>
|
|
10
|
+
* </colBreaks>
|
|
11
|
+
*/
|
|
12
|
+
declare class ColBreaksXform extends ListXform {
|
|
13
|
+
constructor();
|
|
14
|
+
render(xmlStream: any, model: any): void;
|
|
15
|
+
}
|
|
16
|
+
export { ColBreaksXform };
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ListXform } from "../list-xform";
|
|
2
|
+
/**
|
|
3
|
+
* Xform for row page breaks (rowBreaks element in worksheet XML)
|
|
4
|
+
* Used to define manual page breaks between rows when printing.
|
|
5
|
+
*/
|
|
2
6
|
declare class RowBreaksXform extends ListXform {
|
|
3
7
|
constructor();
|
|
4
8
|
render(xmlStream: any, model: any): void;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "1.6.3-canary.
|
|
3
|
+
"version": "1.6.3-canary.20251226035947.ef0b4f2",
|
|
4
4
|
"description": "TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -26,15 +26,14 @@
|
|
|
26
26
|
"bugs": {
|
|
27
27
|
"url": "https://github.com/cjnoname/excelts/issues"
|
|
28
28
|
},
|
|
29
|
-
"type": "module",
|
|
30
29
|
"engines": {
|
|
31
30
|
"node": ">=20.0.0"
|
|
32
31
|
},
|
|
33
32
|
"browserslist": [
|
|
34
33
|
"chrome >= 85",
|
|
35
34
|
"edge >= 85",
|
|
36
|
-
"firefox >=
|
|
37
|
-
"safari >=
|
|
35
|
+
"firefox >= 79",
|
|
36
|
+
"safari >= 14",
|
|
38
37
|
"opera >= 71"
|
|
39
38
|
],
|
|
40
39
|
"exports": {
|
|
@@ -50,13 +49,7 @@
|
|
|
50
49
|
"require": {
|
|
51
50
|
"types": "./dist/types/index.d.ts",
|
|
52
51
|
"default": "./dist/cjs/index.js"
|
|
53
|
-
}
|
|
54
|
-
"default": "./dist/esm/index.js"
|
|
55
|
-
},
|
|
56
|
-
"./browser": {
|
|
57
|
-
"types": "./dist/types/index.browser.d.ts",
|
|
58
|
-
"import": "./dist/browser/excelts.esm.js",
|
|
59
|
-
"default": "./dist/browser/excelts.esm.js"
|
|
52
|
+
}
|
|
60
53
|
},
|
|
61
54
|
"./package.json": "./package.json"
|
|
62
55
|
},
|
|
@@ -97,18 +90,12 @@
|
|
|
97
90
|
"esm",
|
|
98
91
|
"xlsx"
|
|
99
92
|
],
|
|
100
|
-
"dependencies": {
|
|
101
|
-
"dayjs": "^1.11.19",
|
|
102
|
-
"fflate": "^0.8.2",
|
|
103
|
-
"saxes": "^6.0.0"
|
|
104
|
-
},
|
|
105
93
|
"devDependencies": {
|
|
106
94
|
"@eslint/js": "^9.39.2",
|
|
107
|
-
"@oxc-node/core": "^0.0.35",
|
|
108
95
|
"@types/node": "^25.0.3",
|
|
109
96
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
110
97
|
"@typescript-eslint/parser": "^8.50.1",
|
|
111
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
98
|
+
"@typescript/native-preview": "^7.0.0-dev.20251225.1",
|
|
112
99
|
"@vitest/browser": "^4.0.16",
|
|
113
100
|
"@vitest/browser-playwright": "^4.0.16",
|
|
114
101
|
"@vitest/ui": "^4.0.16",
|
|
@@ -120,26 +107,19 @@
|
|
|
120
107
|
"eslint-plugin-import-x": "^4.16.1",
|
|
121
108
|
"eslint-plugin-oxlint": "^1.35.0",
|
|
122
109
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
123
|
-
"express": "^5.2.1",
|
|
124
|
-
"fast-xml-parser": "^5.3.3",
|
|
125
110
|
"husky": "^9.1.7",
|
|
126
|
-
"node-stdlib-browser": "^1.3.1",
|
|
127
|
-
"nodemon": "^3.1.11",
|
|
128
111
|
"oxlint": "^1.35.0",
|
|
129
112
|
"playwright": "^1.57.0",
|
|
130
113
|
"prettier": "^3.7.4",
|
|
131
114
|
"rimraf": "^6.1.2",
|
|
132
115
|
"rolldown": "^1.0.0-beta.57",
|
|
133
|
-
"rollup-plugin-visualizer": "^6.0.5",
|
|
134
|
-
"tslib": "^2.8.1",
|
|
135
116
|
"typescript": "^5.9.3",
|
|
136
117
|
"typescript-eslint": "^8.50.1",
|
|
137
118
|
"vite-tsconfig-paths": "^6.0.3",
|
|
138
119
|
"vitest": "^4.0.16"
|
|
139
120
|
},
|
|
140
121
|
"scripts": {
|
|
141
|
-
"
|
|
142
|
-
"example": "nodemon scripts/run-examples.ts",
|
|
122
|
+
"example": "node scripts/run-examples.ts",
|
|
143
123
|
"check": "concurrently --raw \"npm run type\" \"npm run lint\"",
|
|
144
124
|
"test": "vitest run && npm run test:browser",
|
|
145
125
|
"test:browser": "rimraf dist && npm run build:browser && vitest run --config vitest.browser.config.ts",
|
|
@@ -154,7 +134,6 @@
|
|
|
154
134
|
"build:esm": "tsc --project tsconfig.esm.json && node scripts/fix-esm-imports.mjs",
|
|
155
135
|
"build:cjs": "tsc --project tsconfig.cjs.json && node scripts/fix-cjs-imports.mjs",
|
|
156
136
|
"build:browser": "rolldown -c rolldown.config.js",
|
|
157
|
-
"analyze": "cross-env ANALYZE=1 rolldown -c rolldown.config.js",
|
|
158
137
|
"preversion": "npm run lint && npm run type && npm run build && npm run test"
|
|
159
138
|
}
|
|
160
139
|
}
|