javascript-excel 1.0.2 → 2.0.0-alpha.1

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.
Files changed (49) hide show
  1. package/README.md +50 -2
  2. package/dist/auto-width-2oBzjeNG.d.cts +11 -0
  3. package/dist/auto-width-CT-BihTW.d.ts +10 -0
  4. package/dist/csv.cjs +623 -0
  5. package/dist/csv.d.cts +89 -0
  6. package/dist/csv.d.ts +89 -0
  7. package/dist/csv.js +618 -0
  8. package/dist/dom.cjs +464 -0
  9. package/dist/dom.d.cts +78 -0
  10. package/dist/dom.d.ts +78 -0
  11. package/dist/dom.js +461 -0
  12. package/dist/errors-CvGlfw0E.js +28 -0
  13. package/dist/errors-DOPrrGS4.cjs +69 -0
  14. package/dist/index.cjs +1424 -0
  15. package/dist/index.d.cts +140 -0
  16. package/dist/index.d.ts +140 -0
  17. package/dist/index.js +1397 -0
  18. package/dist/infer-BR-J9BZa.js +88 -0
  19. package/dist/infer-D9EC9vJ-.cjs +105 -0
  20. package/dist/iso-date-B22IvwL1.js +21 -0
  21. package/dist/iso-date-BSUsPSWO.cjs +26 -0
  22. package/dist/numfmt-B-TlCgr7.cjs +476 -0
  23. package/dist/numfmt-DEm0sYBJ.js +399 -0
  24. package/dist/read.cjs +2899 -0
  25. package/dist/read.d.cts +88 -0
  26. package/dist/read.d.ts +88 -0
  27. package/dist/read.js +2895 -0
  28. package/dist/sheet-names-CDsVK15c.js +831 -0
  29. package/dist/sheet-names-Cm-IhbBk.cjs +1004 -0
  30. package/dist/signal-Dz0ZYe6d.d.cts +13 -0
  31. package/dist/signal-Dz0ZYe6d.d.ts +13 -0
  32. package/dist/warnings-C_12PT4t.d.cts +410 -0
  33. package/dist/warnings-DXJKe1lx.d.ts +410 -0
  34. package/dist/worker.cjs +11 -0
  35. package/dist/worker.d.cts +8 -0
  36. package/dist/worker.d.ts +8 -0
  37. package/dist/worker.js +10 -0
  38. package/dist/write-C5JgeIar.d.cts +29 -0
  39. package/dist/write-CYpLGuzl.d.ts +29 -0
  40. package/package.json +67 -51
  41. package/.babelrc +0 -10
  42. package/.circleci/config.yml +0 -39
  43. package/lib/index.d.ts +0 -1
  44. package/lib/index.js +0 -23
  45. package/src/index.tsx +0 -11
  46. package/test/unit/sample.spec.js +0 -5
  47. package/tsconfig.json +0 -54
  48. package/webpack.config.js +0 -19
  49. /package/{LICENSE.md → LICENSE} +0 -0
@@ -0,0 +1,88 @@
1
+ /**
2
+ * javascript-excel/read: the xlsx reader (docs/api.md §5.2, §8).
3
+ *
4
+ * Parts are found through relationships, never by fixed path; each part is
5
+ * inflated and streamed through the XML tokenizer; zip limits are counted on
6
+ * the inflated bytes. ISO/IEC 29500 Strict files read like transitional ones,
7
+ * because the tokenizer ignores namespace prefixes and relationship types
8
+ * are matched by their last path segment, which both variants share.
9
+ * .xlsm, .xltx and .xltm read like .xlsx; macros are never read or run.
10
+ */
11
+ import { A as RichTextRun, C as GradientFill, D as PatternType, E as PatternFill, F as Theme, I as Workbook, M as Sheet, N as SheetView, O as PrintSetup, P as Style, S as Font, T as NumFmt, _ as ColumnWidth, a as BlobType, b as ErrorCode, c as BorderSide, d as CellErrorValue, f as CellInput, g as ColumnProps, h as Color, i as BlobLike, j as RowProps, k as RichText, l as BorderStyle, m as CellValue, n as ExcelWarningCode, o as Alignment, p as CellType, r as BinaryInput, s as Border, t as ExcelWarning, u as Cell, v as DefinedName, w as Hyperlink, x as Fill, y as DocProperties } from "./warnings-C_12PT4t.cjs";
12
+ import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
13
+ import { t as Progress } from "./write-C5JgeIar.cjs";
14
+ /**
15
+ * Format detection tables for the reader (docs/api.md §5.2). Internal.
16
+ *
17
+ * Detection is data: container signatures first, then, for OPC packages, the
18
+ * workbook part's content type. Supporting another format later (.xlsb, .xls)
19
+ * is one more row plus a decoder; the reader dispatches on `decoder`.
20
+ */
21
+ /** Every format `detectFormat` can name. */
22
+ type FormatName = "xlsx" | "xlsm" | "xltx" | "xltm" | "xlsb" | "ods" | "cfb" | "zip" | "unknown";
23
+ /** Result of `read`. */
24
+ export interface ReadResult {
25
+ workbook: Workbook<Cell>;
26
+ warnings: ExcelWarning[];
27
+ }
28
+ /** Options for `read`. */
29
+ export interface ReadOptions {
30
+ /** Only parse these sheets (by name or index); the others are listed with empty rows. Default: all. */
31
+ sheets?: Array<string | number> | undefined;
32
+ /** Parse styles (default true). false is faster: no `cell.style`, but date detection still uses the number format. */
33
+ styles?: boolean | undefined;
34
+ /** Return formula text (default true). false: cached values only. */
35
+ formulas?: boolean | undefined;
36
+ /** `'date'` (default): date-formatted numbers become `Date`. `'serial'`: leave them as numbers. */
37
+ dates?: "date" | "serial" | undefined;
38
+ /** Default `'local'`. */
39
+ dateZone?: "local" | "utc" | undefined;
40
+ /** Rich text as runs (default) or flattened to a plain string. */
41
+ richText?: "runs" | "plain" | undefined;
42
+ limits?: Partial<ReadLimits> | undefined;
43
+ /** Rejects with `signal.reason` when aborted. */
44
+ signal?: AbortSignalLike | undefined;
45
+ onProgress?: ((p: Progress) => void) | undefined;
46
+ /** Called as warnings occur, in addition to `ReadResult.warnings`. */
47
+ onWarning?: ((w: ExcelWarning) => void) | undefined;
48
+ }
49
+ /** Limits for untrusted input. Exceeding one throws `LimitError` (`LIMIT_EXCEEDED`, `details.limit` names it). */
50
+ export interface ReadLimits {
51
+ maxInputBytes: number;
52
+ maxEntries: number;
53
+ /** Decompressed bytes of one part. */
54
+ maxEntryBytes: number;
55
+ /** Decompressed bytes of all parts read. */
56
+ maxTotalBytes: number;
57
+ /** Decompressed / compressed, per entry, checked once an entry has produced more than 1 MiB. */
58
+ maxRatio: number;
59
+ maxXmlDepth: number;
60
+ /** All sheets together. */
61
+ maxCells: number;
62
+ maxSharedStrings: number;
63
+ /** Then a single `WARNINGS_TRUNCATED`. */
64
+ maxWarnings: number;
65
+ }
66
+ /** Default limits (docs/api.md §5.2; the measurements behind each value are listed there). */
67
+ export declare const DEFAULT_READ_LIMITS: Readonly<ReadLimits>;
68
+ /** A sheet as listed by `readSheetNames`. */
69
+ export interface SheetInfo {
70
+ name: string;
71
+ index: number;
72
+ state: "visible" | "hidden" | "veryHidden";
73
+ }
74
+ /**
75
+ * What `detectFormat` recognises. `'cfb'` is a legacy `.xls` or an encrypted OOXML file.
76
+ * `read` reads xlsx, xlsm, xltx and xltm; the others are rejected with UNSUPPORTED_FORMAT.
77
+ */
78
+ export type DetectedFormat = FormatName;
79
+ /** Detects the file format from the bytes. Never throws for unreadable input; returns `'unknown'` or `'zip'` instead. */
80
+ export declare function detectFormat(input: BinaryInput): Promise<DetectedFormat>;
81
+ /** Lists the worksheets (name, index, visibility) without parsing any sheet. */
82
+ export declare function readSheetNames(input: BinaryInput, options?: {
83
+ limits?: Partial<ReadLimits> | undefined;
84
+ signal?: AbortSignalLike | undefined;
85
+ }): Promise<SheetInfo[]>;
86
+ /** Reads an .xlsx, .xlsm, .xltx or .xltm file into the model. */
87
+ export declare function read(input: BinaryInput, options?: ReadOptions): Promise<ReadResult>;
88
+ export type { AbortSignalLike, Alignment, BinaryInput, BlobLike, BlobType, Border, BorderSide, BorderStyle, Cell, CellErrorValue, CellInput, CellType, CellValue, Color, ColumnProps, ColumnWidth, DefinedName, DocProperties, ErrorCode, ExcelWarning, ExcelWarningCode, Fill, Font, GradientFill, Hyperlink, NumFmt, PatternFill, PatternType, PrintSetup, Progress, RichText, RichTextRun, RowProps, Sheet, SheetView, Style, Theme, Workbook };
package/dist/read.d.ts ADDED
@@ -0,0 +1,88 @@
1
+ /**
2
+ * javascript-excel/read: the xlsx reader (docs/api.md §5.2, §8).
3
+ *
4
+ * Parts are found through relationships, never by fixed path; each part is
5
+ * inflated and streamed through the XML tokenizer; zip limits are counted on
6
+ * the inflated bytes. ISO/IEC 29500 Strict files read like transitional ones,
7
+ * because the tokenizer ignores namespace prefixes and relationship types
8
+ * are matched by their last path segment, which both variants share.
9
+ * .xlsm, .xltx and .xltm read like .xlsx; macros are never read or run.
10
+ */
11
+ import { A as SheetView, C as PatternFill, D as RichTextRun, E as RichText, F as BlobLike, I as BlobType, M as Theme, N as Workbook, O as RowProps, P as BinaryInput, S as NumFmt, T as PrintSetup, _ as ErrorCode, a as BorderSide, b as GradientFill, c as CellErrorValue, d as CellValue, f as Color, g as DocProperties, h as DefinedName, i as Border, j as Style, k as Sheet, l as CellInput, m as ColumnWidth, n as ExcelWarningCode, o as BorderStyle, p as ColumnProps, r as Alignment, s as Cell, t as ExcelWarning, u as CellType, v as Fill, w as PatternType, x as Hyperlink, y as Font } from "./warnings-DXJKe1lx.js";
12
+ import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
13
+ import { t as Progress } from "./write-CYpLGuzl.js";
14
+ /**
15
+ * Format detection tables for the reader (docs/api.md §5.2). Internal.
16
+ *
17
+ * Detection is data: container signatures first, then, for OPC packages, the
18
+ * workbook part's content type. Supporting another format later (.xlsb, .xls)
19
+ * is one more row plus a decoder; the reader dispatches on `decoder`.
20
+ */
21
+ /** Every format `detectFormat` can name. */
22
+ type FormatName = "xlsx" | "xlsm" | "xltx" | "xltm" | "xlsb" | "ods" | "cfb" | "zip" | "unknown";
23
+ /** Result of `read`. */
24
+ export interface ReadResult {
25
+ workbook: Workbook<Cell>;
26
+ warnings: ExcelWarning[];
27
+ }
28
+ /** Options for `read`. */
29
+ export interface ReadOptions {
30
+ /** Only parse these sheets (by name or index); the others are listed with empty rows. Default: all. */
31
+ sheets?: Array<string | number> | undefined;
32
+ /** Parse styles (default true). false is faster: no `cell.style`, but date detection still uses the number format. */
33
+ styles?: boolean | undefined;
34
+ /** Return formula text (default true). false: cached values only. */
35
+ formulas?: boolean | undefined;
36
+ /** `'date'` (default): date-formatted numbers become `Date`. `'serial'`: leave them as numbers. */
37
+ dates?: "date" | "serial" | undefined;
38
+ /** Default `'local'`. */
39
+ dateZone?: "local" | "utc" | undefined;
40
+ /** Rich text as runs (default) or flattened to a plain string. */
41
+ richText?: "runs" | "plain" | undefined;
42
+ limits?: Partial<ReadLimits> | undefined;
43
+ /** Rejects with `signal.reason` when aborted. */
44
+ signal?: AbortSignalLike | undefined;
45
+ onProgress?: ((p: Progress) => void) | undefined;
46
+ /** Called as warnings occur, in addition to `ReadResult.warnings`. */
47
+ onWarning?: ((w: ExcelWarning) => void) | undefined;
48
+ }
49
+ /** Limits for untrusted input. Exceeding one throws `LimitError` (`LIMIT_EXCEEDED`, `details.limit` names it). */
50
+ export interface ReadLimits {
51
+ maxInputBytes: number;
52
+ maxEntries: number;
53
+ /** Decompressed bytes of one part. */
54
+ maxEntryBytes: number;
55
+ /** Decompressed bytes of all parts read. */
56
+ maxTotalBytes: number;
57
+ /** Decompressed / compressed, per entry, checked once an entry has produced more than 1 MiB. */
58
+ maxRatio: number;
59
+ maxXmlDepth: number;
60
+ /** All sheets together. */
61
+ maxCells: number;
62
+ maxSharedStrings: number;
63
+ /** Then a single `WARNINGS_TRUNCATED`. */
64
+ maxWarnings: number;
65
+ }
66
+ /** Default limits (docs/api.md §5.2; the measurements behind each value are listed there). */
67
+ export declare const DEFAULT_READ_LIMITS: Readonly<ReadLimits>;
68
+ /** A sheet as listed by `readSheetNames`. */
69
+ export interface SheetInfo {
70
+ name: string;
71
+ index: number;
72
+ state: "visible" | "hidden" | "veryHidden";
73
+ }
74
+ /**
75
+ * What `detectFormat` recognises. `'cfb'` is a legacy `.xls` or an encrypted OOXML file.
76
+ * `read` reads xlsx, xlsm, xltx and xltm; the others are rejected with UNSUPPORTED_FORMAT.
77
+ */
78
+ export type DetectedFormat = FormatName;
79
+ /** Detects the file format from the bytes. Never throws for unreadable input; returns `'unknown'` or `'zip'` instead. */
80
+ export declare function detectFormat(input: BinaryInput): Promise<DetectedFormat>;
81
+ /** Lists the worksheets (name, index, visibility) without parsing any sheet. */
82
+ export declare function readSheetNames(input: BinaryInput, options?: {
83
+ limits?: Partial<ReadLimits> | undefined;
84
+ signal?: AbortSignalLike | undefined;
85
+ }): Promise<SheetInfo[]>;
86
+ /** Reads an .xlsx, .xlsm, .xltx or .xltm file into the model. */
87
+ export declare function read(input: BinaryInput, options?: ReadOptions): Promise<ReadResult>;
88
+ export type { AbortSignalLike, Alignment, BinaryInput, BlobLike, BlobType, Border, BorderSide, BorderStyle, Cell, CellErrorValue, CellInput, CellType, CellValue, Color, ColumnProps, ColumnWidth, DefinedName, DocProperties, ErrorCode, ExcelWarning, ExcelWarningCode, Fill, Font, GradientFill, Hyperlink, NumFmt, PatternFill, PatternType, PrintSetup, Progress, RichText, RichTextRun, RowProps, Sheet, SheetView, Style, Theme, Workbook };