@cj-tech-master/excelts 1.0.0 → 1.4.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/dist/browser/excelts.iife.js +2568 -1188
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +21 -19
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/stream/xlsx/workbook-reader.js +2 -2
- package/dist/cjs/stream/xlsx/workbook-writer.js +8 -4
- package/dist/cjs/utils/cell-format.js +815 -0
- package/dist/cjs/utils/cell-matrix.js +37 -2
- package/dist/cjs/utils/parse-sax.js +2 -2
- package/dist/cjs/utils/sheet-utils.js +615 -0
- package/dist/cjs/utils/stream-buf.js +15 -4
- package/dist/cjs/utils/unzip/buffer-stream.js +27 -0
- package/dist/cjs/utils/unzip/index.js +23 -0
- package/dist/cjs/utils/unzip/noop-stream.js +20 -0
- package/dist/cjs/utils/unzip/parse-buffer.js +60 -0
- package/dist/cjs/utils/unzip/parse-datetime.js +23 -0
- package/dist/cjs/utils/unzip/parse-extra-field.js +52 -0
- package/dist/cjs/utils/unzip/parse.js +340 -0
- package/dist/cjs/utils/unzip/pull-stream.js +145 -0
- package/dist/cjs/utils/utils.js +13 -17
- package/dist/cjs/utils/zip-stream.js +29 -33
- package/dist/cjs/xlsx/xlsx.js +1 -2
- package/dist/esm/index.browser.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/stream/xlsx/workbook-reader.js +2 -2
- package/dist/esm/stream/xlsx/workbook-writer.js +9 -5
- package/dist/esm/utils/cell-format.js +810 -0
- package/dist/esm/utils/cell-matrix.js +37 -2
- package/dist/esm/utils/parse-sax.js +1 -1
- package/dist/esm/utils/sheet-utils.js +595 -0
- package/dist/esm/utils/stream-buf.js +15 -4
- package/dist/esm/utils/unzip/buffer-stream.js +24 -0
- package/dist/esm/utils/unzip/index.js +12 -0
- package/dist/esm/utils/unzip/noop-stream.js +16 -0
- package/dist/esm/utils/unzip/parse-buffer.js +57 -0
- package/dist/esm/utils/unzip/parse-datetime.js +20 -0
- package/dist/esm/utils/unzip/parse-extra-field.js +49 -0
- package/dist/esm/utils/unzip/parse.js +332 -0
- package/dist/esm/utils/unzip/pull-stream.js +141 -0
- package/dist/esm/utils/utils.js +12 -16
- package/dist/esm/utils/zip-stream.js +30 -34
- package/dist/esm/xlsx/xlsx.js +1 -2
- package/dist/types/doc/column.d.ts +1 -1
- package/dist/types/doc/worksheet.d.ts +2 -2
- package/dist/types/index.browser.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stream/xlsx/workbook-writer.d.ts +1 -0
- package/dist/types/utils/cell-format.d.ts +32 -0
- package/dist/types/utils/sheet-utils.d.ts +203 -0
- package/dist/types/utils/unzip/buffer-stream.d.ts +9 -0
- package/dist/types/utils/unzip/index.d.ts +12 -0
- package/dist/types/utils/unzip/noop-stream.d.ts +13 -0
- package/dist/types/utils/unzip/parse-buffer.d.ts +24 -0
- package/dist/types/utils/unzip/parse-datetime.d.ts +12 -0
- package/dist/types/utils/unzip/parse-extra-field.d.ts +18 -0
- package/dist/types/utils/unzip/parse.d.ts +70 -0
- package/dist/types/utils/unzip/pull-stream.d.ts +24 -0
- package/dist/types/utils/utils.d.ts +5 -2
- package/dist/types/utils/zip-stream.d.ts +5 -1
- package/package.json +35 -32
- package/dist/cjs/utils/browser-buffer-decode.js +0 -13
- package/dist/cjs/utils/browser-buffer-encode.js +0 -13
- package/dist/cjs/utils/browser.js +0 -6
- package/dist/esm/utils/browser-buffer-decode.js +0 -11
- package/dist/esm/utils/browser-buffer-encode.js +0 -11
- package/dist/esm/utils/browser.js +0 -3
- package/dist/types/utils/browser-buffer-decode.d.ts +0 -2
- package/dist/types/utils/browser-buffer-encode.d.ts +0 -2
- package/dist/types/utils/browser.d.ts +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unzipper parse module
|
|
3
|
+
* Original source: https://github.com/ZJONSSON/node-unzipper
|
|
4
|
+
* License: MIT
|
|
5
|
+
* Copyright (c) 2012 - 2013 Near Infinity Corporation
|
|
6
|
+
* Commits in this fork are (c) Ziggy Jonsson (ziggy.jonsson.nyc@gmail.com)
|
|
7
|
+
*/
|
|
8
|
+
import { PassThrough } from "stream";
|
|
9
|
+
import { PullStream } from "./pull-stream.js";
|
|
10
|
+
import { NoopStream } from "./noop-stream.js";
|
|
11
|
+
import { type ExtraField } from "./parse-extra-field.js";
|
|
12
|
+
export interface ParseOptions {
|
|
13
|
+
verbose?: boolean;
|
|
14
|
+
forceStream?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CrxHeader {
|
|
17
|
+
version: number | null;
|
|
18
|
+
pubKeyLength: number | null;
|
|
19
|
+
signatureLength: number | null;
|
|
20
|
+
publicKey?: Buffer;
|
|
21
|
+
signature?: Buffer;
|
|
22
|
+
}
|
|
23
|
+
export interface EntryVars {
|
|
24
|
+
versionsNeededToExtract: number | null;
|
|
25
|
+
flags: number | null;
|
|
26
|
+
compressionMethod: number | null;
|
|
27
|
+
lastModifiedTime: number | null;
|
|
28
|
+
lastModifiedDate: number | null;
|
|
29
|
+
crc32: number | null;
|
|
30
|
+
compressedSize: number;
|
|
31
|
+
uncompressedSize: number;
|
|
32
|
+
fileNameLength: number | null;
|
|
33
|
+
extraFieldLength: number | null;
|
|
34
|
+
lastModifiedDateTime?: Date;
|
|
35
|
+
crxHeader?: CrxHeader;
|
|
36
|
+
}
|
|
37
|
+
export interface EntryProps {
|
|
38
|
+
path: string;
|
|
39
|
+
pathBuffer: Buffer;
|
|
40
|
+
flags: {
|
|
41
|
+
isUnicode: boolean;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface ZipEntry extends PassThrough {
|
|
45
|
+
path: string;
|
|
46
|
+
props: EntryProps;
|
|
47
|
+
type: "Directory" | "File";
|
|
48
|
+
vars: EntryVars;
|
|
49
|
+
extra: ExtraField;
|
|
50
|
+
size?: number;
|
|
51
|
+
__autodraining?: boolean;
|
|
52
|
+
autodrain: () => NoopStream & {
|
|
53
|
+
promise: () => Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
buffer: () => Promise<Buffer>;
|
|
56
|
+
}
|
|
57
|
+
export declare class Parse extends PullStream {
|
|
58
|
+
private _opts;
|
|
59
|
+
crxHeader?: CrxHeader;
|
|
60
|
+
reachedCD?: boolean;
|
|
61
|
+
constructor(opts?: ParseOptions);
|
|
62
|
+
private _readRecord;
|
|
63
|
+
private _readCrxHeader;
|
|
64
|
+
private _readFile;
|
|
65
|
+
private _processDataDescriptor;
|
|
66
|
+
private _readCentralDirectoryFileHeader;
|
|
67
|
+
private _readEndOfCentralDirectoryRecord;
|
|
68
|
+
promise(): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
export declare function createParse(opts?: ParseOptions): Parse;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unzipper pull-stream module
|
|
3
|
+
* Original source: https://github.com/ZJONSSON/node-unzipper
|
|
4
|
+
* License: MIT
|
|
5
|
+
* Copyright (c) 2012 - 2013 Near Infinity Corporation
|
|
6
|
+
* Commits in this fork are (c) Ziggy Jonsson (ziggy.jonsson.nyc@gmail.com)
|
|
7
|
+
*/
|
|
8
|
+
import { Duplex, PassThrough } from "stream";
|
|
9
|
+
export declare class PullStream extends Duplex {
|
|
10
|
+
buffer: Buffer;
|
|
11
|
+
cb?: () => void;
|
|
12
|
+
finished: boolean;
|
|
13
|
+
match?: number;
|
|
14
|
+
__emittedError?: Error;
|
|
15
|
+
constructor();
|
|
16
|
+
_write(chunk: Buffer, _encoding: BufferEncoding, cb: () => void): void;
|
|
17
|
+
_read(): void;
|
|
18
|
+
/**
|
|
19
|
+
* The `eof` parameter is interpreted as `file_length` if the type is number
|
|
20
|
+
* otherwise (i.e. buffer) it is interpreted as a pattern signaling end of stream
|
|
21
|
+
*/
|
|
22
|
+
stream(eof: number | Buffer, includeEof?: boolean): PassThrough;
|
|
23
|
+
pull(eof: number | Buffer, includeEof?: boolean): Promise<Buffer>;
|
|
24
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare function delay(ms: number): Promise<void>;
|
|
2
2
|
export declare function nop(): void;
|
|
3
|
-
export declare function promiseImmediate<T>(value: T): Promise<T>;
|
|
4
3
|
export declare const inherits: <T extends new (...args: any[]) => any, S extends new (...args: any[]) => any>(cls: T, superCtor: S, statics?: any, prototype?: any) => void;
|
|
5
4
|
interface PathInfo {
|
|
6
5
|
path: string;
|
|
@@ -23,7 +22,6 @@ export declare function objectFromProps<T = any>(props: string[], value?: T | nu
|
|
|
23
22
|
/** @deprecated Import functions directly instead of using the utils object */
|
|
24
23
|
export declare const utils: {
|
|
25
24
|
nop: typeof nop;
|
|
26
|
-
promiseImmediate: typeof promiseImmediate;
|
|
27
25
|
inherits: <T extends new (...args: any[]) => any, S extends new (...args: any[]) => any>(cls: T, superCtor: S, statics?: any, prototype?: any) => void;
|
|
28
26
|
dateToExcel: typeof dateToExcel;
|
|
29
27
|
excelToDate: typeof excelToDate;
|
|
@@ -42,4 +40,9 @@ export declare const utils: {
|
|
|
42
40
|
toSortedArray: typeof toSortedArray;
|
|
43
41
|
objectFromProps: typeof objectFromProps;
|
|
44
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Convert a Buffer or ArrayBuffer to a UTF-8 string
|
|
45
|
+
* Works in both Node.js and browser environments
|
|
46
|
+
*/
|
|
47
|
+
export declare function bufferToString(chunk: Buffer | ArrayBuffer | string): string;
|
|
45
48
|
export {};
|
|
@@ -2,7 +2,10 @@ import events from "events";
|
|
|
2
2
|
import { Zip } from "fflate";
|
|
3
3
|
interface ZipWriterOptions {
|
|
4
4
|
type?: string;
|
|
5
|
-
compression?:
|
|
5
|
+
compression?: "DEFLATE" | "STORE";
|
|
6
|
+
compressionOptions?: {
|
|
7
|
+
level?: number;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
10
|
interface AppendOptions {
|
|
8
11
|
name: string;
|
|
@@ -18,6 +21,7 @@ declare class ZipWriter extends events.EventEmitter {
|
|
|
18
21
|
stream: any;
|
|
19
22
|
zip: Zip;
|
|
20
23
|
finalized: boolean;
|
|
24
|
+
compressionLevel: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
21
25
|
constructor(options?: ZipWriterOptions);
|
|
22
26
|
append(data: any, options: AppendOptions): void;
|
|
23
27
|
push(chunk: any): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"browserslist": [
|
|
34
34
|
"chrome >= 85",
|
|
35
35
|
"edge >= 85",
|
|
36
|
-
"firefox >=
|
|
37
|
-
"safari >=
|
|
36
|
+
"firefox >= 113",
|
|
37
|
+
"safari >= 16.4",
|
|
38
38
|
"opera >= 71"
|
|
39
39
|
],
|
|
40
40
|
"exports": {
|
|
@@ -53,6 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"default": "./dist/esm/index.js"
|
|
55
55
|
},
|
|
56
|
+
"./browser": {
|
|
57
|
+
"types": "./dist/types/index.browser.d.ts",
|
|
58
|
+
"import": "./dist/esm/index.browser.js",
|
|
59
|
+
"default": "./dist/esm/index.browser.js"
|
|
60
|
+
},
|
|
56
61
|
"./package.json": "./package.json"
|
|
57
62
|
},
|
|
58
63
|
"files": [
|
|
@@ -93,48 +98,46 @@
|
|
|
93
98
|
"xlsx"
|
|
94
99
|
],
|
|
95
100
|
"dependencies": {
|
|
96
|
-
"dayjs": "^1.11.
|
|
101
|
+
"dayjs": "^1.11.19",
|
|
97
102
|
"fast-csv": "^5.0.5",
|
|
98
103
|
"fflate": "^0.8.2",
|
|
99
|
-
"node-stdlib-browser": "^1.3.1",
|
|
100
104
|
"saxes": "^6.0.0",
|
|
101
|
-
"unzipper": "^0.12.3",
|
|
102
105
|
"uuid": "^13.0.0"
|
|
103
106
|
},
|
|
104
107
|
"devDependencies": {
|
|
105
|
-
"@eslint/js": "9.
|
|
106
|
-
"@oxc-node/core": "^0.0.
|
|
107
|
-
"@types/node": "^24.
|
|
108
|
-
"@
|
|
109
|
-
"@typescript-eslint/
|
|
110
|
-
"@typescript-
|
|
111
|
-
"@
|
|
112
|
-
"@vitest/browser": "^4.0.
|
|
113
|
-
"@vitest/
|
|
114
|
-
"@vitest/ui": "^4.0.5",
|
|
108
|
+
"@eslint/js": "^9.39.1",
|
|
109
|
+
"@oxc-node/core": "^0.0.35",
|
|
110
|
+
"@types/node": "^24.10.1",
|
|
111
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
112
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
113
|
+
"@typescript/native-preview": "^7.0.0-dev.20251208.1",
|
|
114
|
+
"@vitest/browser": "^4.0.15",
|
|
115
|
+
"@vitest/browser-playwright": "^4.0.15",
|
|
116
|
+
"@vitest/ui": "^4.0.15",
|
|
115
117
|
"concurrently": "^9.2.1",
|
|
116
118
|
"cross-env": "^10.1.0",
|
|
117
|
-
"eslint": "9.
|
|
118
|
-
"eslint-config-prettier": "10.1.8",
|
|
119
|
-
"eslint-import-resolver-typescript": "4.4.4",
|
|
120
|
-
"eslint-plugin-import-x": "4.16.1",
|
|
121
|
-
"eslint-plugin-oxlint": "1.
|
|
122
|
-
"eslint-plugin-unused-imports": "4.3.0",
|
|
123
|
-
"express": "^5.1
|
|
124
|
-
"fast-xml-parser": "^5.3.
|
|
119
|
+
"eslint": "^9.39.1",
|
|
120
|
+
"eslint-config-prettier": "^10.1.8",
|
|
121
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
122
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
123
|
+
"eslint-plugin-oxlint": "^1.31.0",
|
|
124
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
125
|
+
"express": "^5.2.1",
|
|
126
|
+
"fast-xml-parser": "^5.3.2",
|
|
125
127
|
"husky": "^9.1.7",
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
128
|
+
"node-stdlib-browser": "^1.3.1",
|
|
129
|
+
"nodemon": "^3.1.11",
|
|
130
|
+
"oxlint": "^1.31.0",
|
|
131
|
+
"playwright": "^1.57.0",
|
|
132
|
+
"prettier": "^3.7.4",
|
|
133
|
+
"rimraf": "^6.1.2",
|
|
134
|
+
"rolldown": "^1.0.0-beta.53",
|
|
132
135
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
133
136
|
"tslib": "^2.8.1",
|
|
134
137
|
"typescript": "^5.9.3",
|
|
135
|
-
"typescript-eslint": "^8.
|
|
138
|
+
"typescript-eslint": "^8.48.1",
|
|
136
139
|
"vite-tsconfig-paths": "^5.1.4",
|
|
137
|
-
"vitest": "^4.0.
|
|
140
|
+
"vitest": "^4.0.15"
|
|
138
141
|
},
|
|
139
142
|
"scripts": {
|
|
140
143
|
"local": "nodemon src/local.ts",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bufferToString = bufferToString;
|
|
4
|
-
const textDecoder = typeof global.TextDecoder === "undefined" ? null : new global.TextDecoder("utf-8");
|
|
5
|
-
function bufferToString(chunk) {
|
|
6
|
-
if (typeof chunk === "string") {
|
|
7
|
-
return chunk;
|
|
8
|
-
}
|
|
9
|
-
if (textDecoder) {
|
|
10
|
-
return textDecoder.decode(chunk);
|
|
11
|
-
}
|
|
12
|
-
return chunk.toString();
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringToBuffer = stringToBuffer;
|
|
4
|
-
const textEncoder = typeof global.TextEncoder === "undefined" ? null : new global.TextEncoder();
|
|
5
|
-
function stringToBuffer(str) {
|
|
6
|
-
if (typeof str !== "string") {
|
|
7
|
-
return str;
|
|
8
|
-
}
|
|
9
|
-
if (textEncoder) {
|
|
10
|
-
return Buffer.from(textEncoder.encode(str).buffer);
|
|
11
|
-
}
|
|
12
|
-
return Buffer.from(str);
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const textDecoder = typeof global.TextDecoder === "undefined" ? null : new global.TextDecoder("utf-8");
|
|
2
|
-
function bufferToString(chunk) {
|
|
3
|
-
if (typeof chunk === "string") {
|
|
4
|
-
return chunk;
|
|
5
|
-
}
|
|
6
|
-
if (textDecoder) {
|
|
7
|
-
return textDecoder.decode(chunk);
|
|
8
|
-
}
|
|
9
|
-
return chunk.toString();
|
|
10
|
-
}
|
|
11
|
-
export { bufferToString };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const textEncoder = typeof global.TextEncoder === "undefined" ? null : new global.TextEncoder();
|
|
2
|
-
function stringToBuffer(str) {
|
|
3
|
-
if (typeof str !== "string") {
|
|
4
|
-
return str;
|
|
5
|
-
}
|
|
6
|
-
if (textEncoder) {
|
|
7
|
-
return Buffer.from(textEncoder.encode(str).buffer);
|
|
8
|
-
}
|
|
9
|
-
return Buffer.from(str);
|
|
10
|
-
}
|
|
11
|
-
export { stringToBuffer };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isBrowser: boolean;
|