@alosha/xlsx 0.2.0 → 0.3.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 +6 -0
- package/dist/chunk-6XXKAKLS.js +3663 -0
- package/dist/chunk-6XXKAKLS.js.map +1 -0
- package/dist/compat.cjs +4012 -0
- package/dist/compat.cjs.map +1 -0
- package/dist/compat.d.cts +110 -0
- package/dist/compat.d.ts +110 -0
- package/dist/compat.js +302 -0
- package/dist/compat.js.map +1 -0
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -3657
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { CellType, Workbook, FormulaType } from './index.cjs';
|
|
2
|
+
export { AddWorksheetOptions, Alignment, AloshaXlsxError, AloshaXlsxErrorCode, Border, BorderDiagonal, BorderStyle, Borders, CalculationProperties, Cell, CellError, CellFormula, CellModel, CellValue, Color, Column, ColumnDefn, ColumnRange, DEFAULT_COLUMN_WIDTH, Decoded, DecodedEx, DuplicateWorksheetNameError, ErrorCode, Fill, FillPattern, Font, GradientStop, Hyperlink, InvalidAddressError, InvalidCellValueError, InvalidPackageError, InvalidRangeError, InvalidRowNumberError, InvalidWorksheetNameError, InvalidWorksheetNameReason, MergeConflictError, Protection, Range, RangeSource, ReadOptions, ReservedWorksheetNameError, RichText, RichTextRun, Row, RowInheritOption, RowModel, RowValues, SharedStrings, StoredValue, Style, Styles, UnsupportedFeatureError, WorkbookModel, WorkbookProperties, WorkbookView, Worksheet, WorksheetHost, WorksheetModel, WorksheetNameTooLongError, WorksheetProperties, WorksheetView, WriteOptions, XlsxAccessor, colLetterToNumber, colNumberToLetter, createSharedStrings, createStyles, dateToSerial, decodeAddress, decodeEx, detectType, effectiveType, encodeAddress, fromStored, isAloshaXlsxError, readWorkbookBuffer, readWorkbookFile, resolveCellStyle, serialToDate, toCsv, toStored, toText, validateAddress, version, writeWorkbookBuffer, writeWorkbookFile } from './index.cjs';
|
|
3
|
+
|
|
4
|
+
/** ExcelJS's `Enums.ValueType` numbering. */
|
|
5
|
+
declare const ValueType: {
|
|
6
|
+
readonly Null: 0;
|
|
7
|
+
readonly Merge: 1;
|
|
8
|
+
readonly Number: 2;
|
|
9
|
+
readonly String: 3;
|
|
10
|
+
readonly Date: 4;
|
|
11
|
+
readonly Hyperlink: 5;
|
|
12
|
+
readonly Formula: 6;
|
|
13
|
+
readonly SharedString: 7;
|
|
14
|
+
readonly RichText: 8;
|
|
15
|
+
readonly Boolean: 9;
|
|
16
|
+
readonly Error: 10;
|
|
17
|
+
};
|
|
18
|
+
type ValueType = (typeof ValueType)[keyof typeof ValueType];
|
|
19
|
+
|
|
20
|
+
/** `cell.type` in compat mode: our `CellType` → ExcelJS's `ValueType` number. */
|
|
21
|
+
declare function toExcelJSValueType(cellType: CellType): ValueType;
|
|
22
|
+
/** The inverse of {@link toExcelJSValueType}. */
|
|
23
|
+
declare function fromExcelJSValueType(value: ValueType): CellType;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The compat `Workbook`: an ExcelJS drop-in. `new CompatWorkbook()` builds a plain core workbook and
|
|
27
|
+
* returns a facade Proxy over it — so `instanceof` still holds (the proxy's target *is* a Workbook),
|
|
28
|
+
* while every reachable cell/row/column/worksheet reports ExcelJS semantics (§5).
|
|
29
|
+
*/
|
|
30
|
+
declare class CompatWorkbook extends Workbook {
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @alosha/xlsx/compat — the ExcelJS drop-in shim entry point (docs/COMPAT-SPEC.md).
|
|
36
|
+
*
|
|
37
|
+
* The default export is shaped like the `exceljs` namespace (`{ Workbook, ValueType, Enums, stream }`)
|
|
38
|
+
* and the named `Workbook` is the ExcelJS-faithful facade (`CompatWorkbook`, §5): compat-constructed
|
|
39
|
+
* workbooks report ExcelJS `ValueType` numbers, apply whole-object style precedence, and throw
|
|
40
|
+
* `UnsupportedFeatureError` on the deferred surface (§6). An ExcelJS user changes one import.
|
|
41
|
+
*
|
|
42
|
+
* Re-exports from `../index.js` (not `../model/index.js`) so the `workbook.xlsx` accessor — attached
|
|
43
|
+
* to `Workbook.prototype` as a side effect of loading the main entry — is present on compat workbooks.
|
|
44
|
+
* The star export's plain `Workbook` is deliberately shadowed by the explicit `CompatWorkbook as
|
|
45
|
+
* Workbook` re-export below (explicit named exports win over `export *`).
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** ExcelJS's `Enums` grouping (`import { Enums } from "exceljs"`). */
|
|
49
|
+
declare const Enums: {
|
|
50
|
+
readonly ValueType: {
|
|
51
|
+
readonly Null: 0;
|
|
52
|
+
readonly Merge: 1;
|
|
53
|
+
readonly Number: 2;
|
|
54
|
+
readonly String: 3;
|
|
55
|
+
readonly Date: 4;
|
|
56
|
+
readonly Hyperlink: 5;
|
|
57
|
+
readonly Formula: 6;
|
|
58
|
+
readonly SharedString: 7;
|
|
59
|
+
readonly RichText: 8;
|
|
60
|
+
readonly Boolean: 9;
|
|
61
|
+
readonly Error: 10;
|
|
62
|
+
};
|
|
63
|
+
readonly FormulaType: typeof FormulaType;
|
|
64
|
+
};
|
|
65
|
+
/** The ExcelJS-shaped default export: `import ExcelJS from "@alosha/xlsx/compat"`. */
|
|
66
|
+
declare const ExcelJS: {
|
|
67
|
+
Workbook: typeof CompatWorkbook;
|
|
68
|
+
ValueType: {
|
|
69
|
+
readonly Null: 0;
|
|
70
|
+
readonly Merge: 1;
|
|
71
|
+
readonly Number: 2;
|
|
72
|
+
readonly String: 3;
|
|
73
|
+
readonly Date: 4;
|
|
74
|
+
readonly Hyperlink: 5;
|
|
75
|
+
readonly Formula: 6;
|
|
76
|
+
readonly SharedString: 7;
|
|
77
|
+
readonly RichText: 8;
|
|
78
|
+
readonly Boolean: 9;
|
|
79
|
+
readonly Error: 10;
|
|
80
|
+
};
|
|
81
|
+
FormulaType: typeof FormulaType;
|
|
82
|
+
Enums: {
|
|
83
|
+
readonly ValueType: {
|
|
84
|
+
readonly Null: 0;
|
|
85
|
+
readonly Merge: 1;
|
|
86
|
+
readonly Number: 2;
|
|
87
|
+
readonly String: 3;
|
|
88
|
+
readonly Date: 4;
|
|
89
|
+
readonly Hyperlink: 5;
|
|
90
|
+
readonly Formula: 6;
|
|
91
|
+
readonly SharedString: 7;
|
|
92
|
+
readonly RichText: 8;
|
|
93
|
+
readonly Boolean: 9;
|
|
94
|
+
readonly Error: 10;
|
|
95
|
+
};
|
|
96
|
+
readonly FormulaType: typeof FormulaType;
|
|
97
|
+
};
|
|
98
|
+
stream: {
|
|
99
|
+
readonly xlsx: {
|
|
100
|
+
readonly WorkbookWriter: {
|
|
101
|
+
new (): {};
|
|
102
|
+
};
|
|
103
|
+
readonly WorkbookReader: {
|
|
104
|
+
new (): {};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { CellType, CompatWorkbook, Enums, FormulaType, ValueType, CompatWorkbook as Workbook, ExcelJS as default, fromExcelJSValueType, toExcelJSValueType };
|
package/dist/compat.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { CellType, Workbook, FormulaType } from './index.js';
|
|
2
|
+
export { AddWorksheetOptions, Alignment, AloshaXlsxError, AloshaXlsxErrorCode, Border, BorderDiagonal, BorderStyle, Borders, CalculationProperties, Cell, CellError, CellFormula, CellModel, CellValue, Color, Column, ColumnDefn, ColumnRange, DEFAULT_COLUMN_WIDTH, Decoded, DecodedEx, DuplicateWorksheetNameError, ErrorCode, Fill, FillPattern, Font, GradientStop, Hyperlink, InvalidAddressError, InvalidCellValueError, InvalidPackageError, InvalidRangeError, InvalidRowNumberError, InvalidWorksheetNameError, InvalidWorksheetNameReason, MergeConflictError, Protection, Range, RangeSource, ReadOptions, ReservedWorksheetNameError, RichText, RichTextRun, Row, RowInheritOption, RowModel, RowValues, SharedStrings, StoredValue, Style, Styles, UnsupportedFeatureError, WorkbookModel, WorkbookProperties, WorkbookView, Worksheet, WorksheetHost, WorksheetModel, WorksheetNameTooLongError, WorksheetProperties, WorksheetView, WriteOptions, XlsxAccessor, colLetterToNumber, colNumberToLetter, createSharedStrings, createStyles, dateToSerial, decodeAddress, decodeEx, detectType, effectiveType, encodeAddress, fromStored, isAloshaXlsxError, readWorkbookBuffer, readWorkbookFile, resolveCellStyle, serialToDate, toCsv, toStored, toText, validateAddress, version, writeWorkbookBuffer, writeWorkbookFile } from './index.js';
|
|
3
|
+
|
|
4
|
+
/** ExcelJS's `Enums.ValueType` numbering. */
|
|
5
|
+
declare const ValueType: {
|
|
6
|
+
readonly Null: 0;
|
|
7
|
+
readonly Merge: 1;
|
|
8
|
+
readonly Number: 2;
|
|
9
|
+
readonly String: 3;
|
|
10
|
+
readonly Date: 4;
|
|
11
|
+
readonly Hyperlink: 5;
|
|
12
|
+
readonly Formula: 6;
|
|
13
|
+
readonly SharedString: 7;
|
|
14
|
+
readonly RichText: 8;
|
|
15
|
+
readonly Boolean: 9;
|
|
16
|
+
readonly Error: 10;
|
|
17
|
+
};
|
|
18
|
+
type ValueType = (typeof ValueType)[keyof typeof ValueType];
|
|
19
|
+
|
|
20
|
+
/** `cell.type` in compat mode: our `CellType` → ExcelJS's `ValueType` number. */
|
|
21
|
+
declare function toExcelJSValueType(cellType: CellType): ValueType;
|
|
22
|
+
/** The inverse of {@link toExcelJSValueType}. */
|
|
23
|
+
declare function fromExcelJSValueType(value: ValueType): CellType;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The compat `Workbook`: an ExcelJS drop-in. `new CompatWorkbook()` builds a plain core workbook and
|
|
27
|
+
* returns a facade Proxy over it — so `instanceof` still holds (the proxy's target *is* a Workbook),
|
|
28
|
+
* while every reachable cell/row/column/worksheet reports ExcelJS semantics (§5).
|
|
29
|
+
*/
|
|
30
|
+
declare class CompatWorkbook extends Workbook {
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @alosha/xlsx/compat — the ExcelJS drop-in shim entry point (docs/COMPAT-SPEC.md).
|
|
36
|
+
*
|
|
37
|
+
* The default export is shaped like the `exceljs` namespace (`{ Workbook, ValueType, Enums, stream }`)
|
|
38
|
+
* and the named `Workbook` is the ExcelJS-faithful facade (`CompatWorkbook`, §5): compat-constructed
|
|
39
|
+
* workbooks report ExcelJS `ValueType` numbers, apply whole-object style precedence, and throw
|
|
40
|
+
* `UnsupportedFeatureError` on the deferred surface (§6). An ExcelJS user changes one import.
|
|
41
|
+
*
|
|
42
|
+
* Re-exports from `../index.js` (not `../model/index.js`) so the `workbook.xlsx` accessor — attached
|
|
43
|
+
* to `Workbook.prototype` as a side effect of loading the main entry — is present on compat workbooks.
|
|
44
|
+
* The star export's plain `Workbook` is deliberately shadowed by the explicit `CompatWorkbook as
|
|
45
|
+
* Workbook` re-export below (explicit named exports win over `export *`).
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** ExcelJS's `Enums` grouping (`import { Enums } from "exceljs"`). */
|
|
49
|
+
declare const Enums: {
|
|
50
|
+
readonly ValueType: {
|
|
51
|
+
readonly Null: 0;
|
|
52
|
+
readonly Merge: 1;
|
|
53
|
+
readonly Number: 2;
|
|
54
|
+
readonly String: 3;
|
|
55
|
+
readonly Date: 4;
|
|
56
|
+
readonly Hyperlink: 5;
|
|
57
|
+
readonly Formula: 6;
|
|
58
|
+
readonly SharedString: 7;
|
|
59
|
+
readonly RichText: 8;
|
|
60
|
+
readonly Boolean: 9;
|
|
61
|
+
readonly Error: 10;
|
|
62
|
+
};
|
|
63
|
+
readonly FormulaType: typeof FormulaType;
|
|
64
|
+
};
|
|
65
|
+
/** The ExcelJS-shaped default export: `import ExcelJS from "@alosha/xlsx/compat"`. */
|
|
66
|
+
declare const ExcelJS: {
|
|
67
|
+
Workbook: typeof CompatWorkbook;
|
|
68
|
+
ValueType: {
|
|
69
|
+
readonly Null: 0;
|
|
70
|
+
readonly Merge: 1;
|
|
71
|
+
readonly Number: 2;
|
|
72
|
+
readonly String: 3;
|
|
73
|
+
readonly Date: 4;
|
|
74
|
+
readonly Hyperlink: 5;
|
|
75
|
+
readonly Formula: 6;
|
|
76
|
+
readonly SharedString: 7;
|
|
77
|
+
readonly RichText: 8;
|
|
78
|
+
readonly Boolean: 9;
|
|
79
|
+
readonly Error: 10;
|
|
80
|
+
};
|
|
81
|
+
FormulaType: typeof FormulaType;
|
|
82
|
+
Enums: {
|
|
83
|
+
readonly ValueType: {
|
|
84
|
+
readonly Null: 0;
|
|
85
|
+
readonly Merge: 1;
|
|
86
|
+
readonly Number: 2;
|
|
87
|
+
readonly String: 3;
|
|
88
|
+
readonly Date: 4;
|
|
89
|
+
readonly Hyperlink: 5;
|
|
90
|
+
readonly Formula: 6;
|
|
91
|
+
readonly SharedString: 7;
|
|
92
|
+
readonly RichText: 8;
|
|
93
|
+
readonly Boolean: 9;
|
|
94
|
+
readonly Error: 10;
|
|
95
|
+
};
|
|
96
|
+
readonly FormulaType: typeof FormulaType;
|
|
97
|
+
};
|
|
98
|
+
stream: {
|
|
99
|
+
readonly xlsx: {
|
|
100
|
+
readonly WorkbookWriter: {
|
|
101
|
+
new (): {};
|
|
102
|
+
};
|
|
103
|
+
readonly WorkbookReader: {
|
|
104
|
+
new (): {};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { CellType, CompatWorkbook, Enums, FormulaType, ValueType, CompatWorkbook as Workbook, ExcelJS as default, fromExcelJSValueType, toExcelJSValueType };
|
package/dist/compat.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { UnsupportedFeatureError, FormulaType, Workbook, Cell, Row, Column, Worksheet } from './chunk-6XXKAKLS.js';
|
|
2
|
+
export { AloshaXlsxError, Cell, CellType, Column, DEFAULT_COLUMN_WIDTH, DuplicateWorksheetNameError, FormulaType, InvalidAddressError, InvalidCellValueError, InvalidPackageError, InvalidRangeError, InvalidRowNumberError, InvalidWorksheetNameError, MergeConflictError, Range, ReservedWorksheetNameError, Row, UnsupportedFeatureError, Worksheet, WorksheetNameTooLongError, colLetterToNumber, colNumberToLetter, createSharedStrings, createStyles, dateToSerial, decodeAddress, decodeEx, detectType, effectiveType, encodeAddress, fromStored, isAloshaXlsxError, readWorkbookBuffer, readWorkbookFile, resolveCellStyle, serialToDate, toCsv, toStored, toText, validateAddress, version, writeWorkbookBuffer, writeWorkbookFile } from './chunk-6XXKAKLS.js';
|
|
3
|
+
|
|
4
|
+
// src/compat/value-type.ts
|
|
5
|
+
var ValueType = {
|
|
6
|
+
Null: 0,
|
|
7
|
+
Merge: 1,
|
|
8
|
+
Number: 2,
|
|
9
|
+
String: 3,
|
|
10
|
+
Date: 4,
|
|
11
|
+
Hyperlink: 5,
|
|
12
|
+
Formula: 6,
|
|
13
|
+
SharedString: 7,
|
|
14
|
+
RichText: 8,
|
|
15
|
+
Boolean: 9,
|
|
16
|
+
Error: 10
|
|
17
|
+
};
|
|
18
|
+
var TO_EXCELJS_VALUE_TYPE = {
|
|
19
|
+
[0 /* Null */]: ValueType.Null,
|
|
20
|
+
[1 /* Number */]: ValueType.Number,
|
|
21
|
+
[2 /* String */]: ValueType.String,
|
|
22
|
+
[3 /* Boolean */]: ValueType.Boolean,
|
|
23
|
+
[4 /* Date */]: ValueType.Date,
|
|
24
|
+
[5 /* Error */]: ValueType.Error,
|
|
25
|
+
[6 /* RichText */]: ValueType.RichText,
|
|
26
|
+
[7 /* Hyperlink */]: ValueType.Hyperlink,
|
|
27
|
+
[8 /* Formula */]: ValueType.Formula,
|
|
28
|
+
[9 /* Merge */]: ValueType.Merge,
|
|
29
|
+
[10 /* SharedString */]: ValueType.SharedString
|
|
30
|
+
};
|
|
31
|
+
var FROM_EXCELJS_VALUE_TYPE = {
|
|
32
|
+
[ValueType.Null]: 0 /* Null */,
|
|
33
|
+
[ValueType.Merge]: 9 /* Merge */,
|
|
34
|
+
[ValueType.Number]: 1 /* Number */,
|
|
35
|
+
[ValueType.String]: 2 /* String */,
|
|
36
|
+
[ValueType.Date]: 4 /* Date */,
|
|
37
|
+
[ValueType.Hyperlink]: 7 /* Hyperlink */,
|
|
38
|
+
[ValueType.Formula]: 8 /* Formula */,
|
|
39
|
+
[ValueType.SharedString]: 10 /* SharedString */,
|
|
40
|
+
[ValueType.RichText]: 6 /* RichText */,
|
|
41
|
+
[ValueType.Boolean]: 3 /* Boolean */,
|
|
42
|
+
[ValueType.Error]: 5 /* Error */
|
|
43
|
+
};
|
|
44
|
+
function toExcelJSValueType(cellType) {
|
|
45
|
+
return TO_EXCELJS_VALUE_TYPE[cellType];
|
|
46
|
+
}
|
|
47
|
+
function fromExcelJSValueType(value) {
|
|
48
|
+
return FROM_EXCELJS_VALUE_TYPE[value];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/compat/style-compat.ts
|
|
52
|
+
var STYLE_CATEGORIES = ["numFmt", "font", "fill", "border", "alignment", "protection"];
|
|
53
|
+
function applyExcelJsStyle(cell, patch) {
|
|
54
|
+
const inherited = cell.style;
|
|
55
|
+
const next = {};
|
|
56
|
+
for (const key of STYLE_CATEGORIES) {
|
|
57
|
+
copyCategory(next, Object.hasOwn(patch, key) ? patch : inherited, key);
|
|
58
|
+
}
|
|
59
|
+
cell.style = next;
|
|
60
|
+
}
|
|
61
|
+
function copyCategory(target, source, key) {
|
|
62
|
+
const value = source[key];
|
|
63
|
+
if (value !== void 0) target[key] = value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/compat/workbook.ts
|
|
67
|
+
var COMPAT_DEFER = "not yet supported in @alosha/xlsx/compat; see https://github.com/avlisodraude/alosha-xlsx/issues";
|
|
68
|
+
var RAW = /* @__PURE__ */ Symbol("alosha.compat.raw");
|
|
69
|
+
var STYLE_SETTERS = /* @__PURE__ */ new Set(["numFmt", "font", "fill", "border", "alignment", "protection"]);
|
|
70
|
+
function thrower(feature) {
|
|
71
|
+
return () => {
|
|
72
|
+
throw new UnsupportedFeatureError(feature, COMPAT_DEFER);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function stubNamespace(prefix, methods) {
|
|
76
|
+
const ns = {};
|
|
77
|
+
for (const m of methods) ns[m] = thrower(`${prefix}.${m}`);
|
|
78
|
+
return ns;
|
|
79
|
+
}
|
|
80
|
+
var CSV_STUB = stubNamespace("workbook.csv", [
|
|
81
|
+
"read",
|
|
82
|
+
"readFile",
|
|
83
|
+
"write",
|
|
84
|
+
"writeFile",
|
|
85
|
+
"writeBuffer"
|
|
86
|
+
]);
|
|
87
|
+
var DEFINED_NAMES_STUB = stubNamespace("workbook.definedNames", [
|
|
88
|
+
"add",
|
|
89
|
+
"remove",
|
|
90
|
+
"getRanges",
|
|
91
|
+
"forEach",
|
|
92
|
+
"getNames"
|
|
93
|
+
]);
|
|
94
|
+
var WORKSHEET_UNSUPPORTED = /* @__PURE__ */ new Set([
|
|
95
|
+
"addImage",
|
|
96
|
+
"getImages",
|
|
97
|
+
"addBackgroundImage",
|
|
98
|
+
"addTable",
|
|
99
|
+
"getTable",
|
|
100
|
+
"getTables",
|
|
101
|
+
"addConditionalFormatting",
|
|
102
|
+
"removeConditionalFormatting",
|
|
103
|
+
"protect",
|
|
104
|
+
"unprotect"
|
|
105
|
+
]);
|
|
106
|
+
var streamStub = {
|
|
107
|
+
xlsx: {
|
|
108
|
+
WorkbookWriter: class {
|
|
109
|
+
constructor() {
|
|
110
|
+
throw new UnsupportedFeatureError("stream.xlsx.WorkbookWriter", COMPAT_DEFER);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
WorkbookReader: class {
|
|
114
|
+
constructor() {
|
|
115
|
+
throw new UnsupportedFeatureError("stream.xlsx.WorkbookReader", COMPAT_DEFER);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var workbookProxies = /* @__PURE__ */ new WeakMap();
|
|
121
|
+
var worksheetProxies = /* @__PURE__ */ new WeakMap();
|
|
122
|
+
var rowProxies = /* @__PURE__ */ new WeakMap();
|
|
123
|
+
var columnProxies = /* @__PURE__ */ new WeakMap();
|
|
124
|
+
var cellProxies = /* @__PURE__ */ new WeakMap();
|
|
125
|
+
function wrap(value) {
|
|
126
|
+
if (Array.isArray(value)) return value.map(wrap);
|
|
127
|
+
if (value instanceof Cell) return proxyCell(value);
|
|
128
|
+
if (value instanceof Row) return proxyRow(value);
|
|
129
|
+
if (value instanceof Column) return proxyColumn(value);
|
|
130
|
+
if (value instanceof Worksheet) return proxyWorksheet(value);
|
|
131
|
+
if (value instanceof Workbook) return proxyWorkbook(value);
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
function unwrap(value) {
|
|
135
|
+
if (value !== null && typeof value === "object") {
|
|
136
|
+
const raw = value[RAW];
|
|
137
|
+
if (raw !== void 0) return raw;
|
|
138
|
+
}
|
|
139
|
+
return value;
|
|
140
|
+
}
|
|
141
|
+
function mapArgIn(arg) {
|
|
142
|
+
if (typeof arg === "function") {
|
|
143
|
+
const cb = arg;
|
|
144
|
+
return (...cbArgs) => cb(...cbArgs.map(wrap));
|
|
145
|
+
}
|
|
146
|
+
return unwrap(arg);
|
|
147
|
+
}
|
|
148
|
+
function reflectGet(target, prop) {
|
|
149
|
+
const value = Reflect.get(target, prop, target);
|
|
150
|
+
if (typeof value === "function") {
|
|
151
|
+
const fn = value;
|
|
152
|
+
return (...args) => wrap(fn.apply(target, args.map(mapArgIn)));
|
|
153
|
+
}
|
|
154
|
+
return wrap(value);
|
|
155
|
+
}
|
|
156
|
+
function proxyCell(cell) {
|
|
157
|
+
const cached = cellProxies.get(cell);
|
|
158
|
+
if (cached) return cached;
|
|
159
|
+
const proxy = new Proxy(cell, {
|
|
160
|
+
get(target, prop) {
|
|
161
|
+
if (prop === RAW) return target;
|
|
162
|
+
if (prop === "type") return toExcelJSValueType(target.type);
|
|
163
|
+
if (prop === "effectiveType") return toExcelJSValueType(target.effectiveType);
|
|
164
|
+
return reflectGet(target, prop);
|
|
165
|
+
},
|
|
166
|
+
set(target, prop, value) {
|
|
167
|
+
if (typeof prop === "string" && STYLE_SETTERS.has(prop)) {
|
|
168
|
+
const patch = {};
|
|
169
|
+
patch[prop] = value;
|
|
170
|
+
applyExcelJsStyle(target, patch);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
if (prop === "note") {
|
|
174
|
+
throw new UnsupportedFeatureError("cell.note (comments)", COMPAT_DEFER);
|
|
175
|
+
}
|
|
176
|
+
if (prop === "dataValidation") {
|
|
177
|
+
throw new UnsupportedFeatureError("cell.dataValidation (data validation)", COMPAT_DEFER);
|
|
178
|
+
}
|
|
179
|
+
return Reflect.set(target, prop, value, target);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
cellProxies.set(cell, proxy);
|
|
183
|
+
return proxy;
|
|
184
|
+
}
|
|
185
|
+
function proxyRow(row) {
|
|
186
|
+
const cached = rowProxies.get(row);
|
|
187
|
+
if (cached) return cached;
|
|
188
|
+
const proxy = new Proxy(row, {
|
|
189
|
+
get(target, prop) {
|
|
190
|
+
if (prop === RAW) return target;
|
|
191
|
+
return reflectGet(target, prop);
|
|
192
|
+
},
|
|
193
|
+
set(target, prop, value) {
|
|
194
|
+
return Reflect.set(target, prop, value, target);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
rowProxies.set(row, proxy);
|
|
198
|
+
return proxy;
|
|
199
|
+
}
|
|
200
|
+
function proxyColumn(column) {
|
|
201
|
+
const cached = columnProxies.get(column);
|
|
202
|
+
if (cached) return cached;
|
|
203
|
+
const proxy = new Proxy(column, {
|
|
204
|
+
get(target, prop) {
|
|
205
|
+
if (prop === RAW) return target;
|
|
206
|
+
return reflectGet(target, prop);
|
|
207
|
+
},
|
|
208
|
+
set(target, prop, value) {
|
|
209
|
+
return Reflect.set(target, prop, value, target);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
columnProxies.set(column, proxy);
|
|
213
|
+
return proxy;
|
|
214
|
+
}
|
|
215
|
+
function proxyWorksheet(worksheet) {
|
|
216
|
+
const cached = worksheetProxies.get(worksheet);
|
|
217
|
+
if (cached) return cached;
|
|
218
|
+
const proxy = new Proxy(worksheet, {
|
|
219
|
+
get(target, prop) {
|
|
220
|
+
if (prop === RAW) return target;
|
|
221
|
+
if (typeof prop === "string" && WORKSHEET_UNSUPPORTED.has(prop)) {
|
|
222
|
+
return thrower(`worksheet.${prop}`);
|
|
223
|
+
}
|
|
224
|
+
if (prop === "dataValidations") {
|
|
225
|
+
throw new UnsupportedFeatureError(
|
|
226
|
+
"worksheet.dataValidations (data validation)",
|
|
227
|
+
COMPAT_DEFER
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
return reflectGet(target, prop);
|
|
231
|
+
},
|
|
232
|
+
set(target, prop, value) {
|
|
233
|
+
return Reflect.set(target, prop, value, target);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
worksheetProxies.set(worksheet, proxy);
|
|
237
|
+
return proxy;
|
|
238
|
+
}
|
|
239
|
+
function proxyWorkbook(workbook) {
|
|
240
|
+
const cached = workbookProxies.get(workbook);
|
|
241
|
+
if (cached) return cached;
|
|
242
|
+
const proxy = new Proxy(workbook, {
|
|
243
|
+
get(target, prop) {
|
|
244
|
+
if (prop === RAW) return target;
|
|
245
|
+
if (prop === "xlsx") {
|
|
246
|
+
const acc = Reflect.get(target, "xlsx", target);
|
|
247
|
+
return {
|
|
248
|
+
writeBuffer: (...args) => acc.writeBuffer(...args),
|
|
249
|
+
writeFile: (...args) => acc.writeFile(...args),
|
|
250
|
+
load: async (...args) => {
|
|
251
|
+
await acc.load(...args);
|
|
252
|
+
return proxy;
|
|
253
|
+
},
|
|
254
|
+
readFile: async (...args) => {
|
|
255
|
+
await acc.readFile(...args);
|
|
256
|
+
return proxy;
|
|
257
|
+
},
|
|
258
|
+
read: async (...args) => {
|
|
259
|
+
await acc.read(...args);
|
|
260
|
+
return proxy;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (prop === "csv") return CSV_STUB;
|
|
265
|
+
if (prop === "definedNames") return DEFINED_NAMES_STUB;
|
|
266
|
+
if (prop === "addImage" || prop === "getImage") return thrower(`workbook.${prop}`);
|
|
267
|
+
if (prop === "media") {
|
|
268
|
+
throw new UnsupportedFeatureError("workbook.media (images)", COMPAT_DEFER);
|
|
269
|
+
}
|
|
270
|
+
return reflectGet(target, prop);
|
|
271
|
+
},
|
|
272
|
+
set(target, prop, value) {
|
|
273
|
+
return Reflect.set(target, prop, value, target);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
workbookProxies.set(workbook, proxy);
|
|
277
|
+
return proxy;
|
|
278
|
+
}
|
|
279
|
+
var CompatWorkbook = class extends Workbook {
|
|
280
|
+
constructor() {
|
|
281
|
+
super();
|
|
282
|
+
return proxyWorkbook(this);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// src/compat/index.ts
|
|
287
|
+
var Enums = {
|
|
288
|
+
ValueType,
|
|
289
|
+
FormulaType
|
|
290
|
+
};
|
|
291
|
+
var ExcelJS = {
|
|
292
|
+
Workbook: CompatWorkbook,
|
|
293
|
+
ValueType,
|
|
294
|
+
FormulaType,
|
|
295
|
+
Enums,
|
|
296
|
+
stream: streamStub
|
|
297
|
+
};
|
|
298
|
+
var compat_default = ExcelJS;
|
|
299
|
+
|
|
300
|
+
export { CompatWorkbook, Enums, ValueType, CompatWorkbook as Workbook, compat_default as default, fromExcelJSValueType, toExcelJSValueType };
|
|
301
|
+
//# sourceMappingURL=compat.js.map
|
|
302
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/compat/value-type.ts","../src/compat/style-compat.ts","../src/compat/workbook.ts","../src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KAAS,gBAAgB,OAAO,kBAAA;AACpC,MAAA,IAAI,IAAA,KAAS,cAAc,IAAA,KAAS,UAAA,SAAmB,OAAA,CAAQ,CAAA,SAAA,EAAY,IAAI,CAAA,CAAE,CAAA;AACjF,MAAA,IAAI,SAAS,OAAA,EAAS;AACpB,QAAA,MAAM,IAAI,uBAAA,CAAwB,yBAAA,EAA2B,YAAY,CAAA;AAAA,MAC3E;AACA,MAAA,OAAO,UAAA,CAAW,QAAQ,IAAI,CAAA;AAAA,IAChC,CAAA;AAAA,IACA,GAAA,CAAI,MAAA,EAAQ,IAAA,EAAM,KAAA,EAAO;AACvB,MAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,IAAA,EAAM,OAAO,MAAM,CAAA;AAAA,IAChD;AAAA,GACD,CAAA;AACD,EAAA,eAAA,CAAgB,GAAA,CAAI,UAAU,KAAK,CAAA;AACnC,EAAA,OAAO,KAAA;AACT;AAOO,IAAM,cAAA,GAAN,cAA6B,QAAA,CAAS;AAAA,EAC3C,WAAA,GAAc;AACZ,IAAA,KAAA,EAAM;AAKN,IAAA,OAAO,cAAc,IAAI,CAAA;AAAA,EAC3B;AACF;;;ACtRO,IAAM,KAAA,GAAQ;AAAA,EACnB,SAAA;AAAA,EACA;AACF;AAGA,IAAM,OAAA,GAAU;AAAA,EACd,QAAA,EAAU,cAAA;AAAA,EACV,SAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA,EAAQ;AACV,CAAA;AAEA,IAAO,cAAA,GAAQ","file":"compat.js","sourcesContent":["// The ExcelJS `Enums.ValueType`/`FormulaType` bridge (docs/COMPAT-SPEC.md §3). Our `CellType`\n// shares names with ExcelJS's `ValueType` but not numbers; these maps translate between the two.\n// `FormulaType` numbering already matches ExcelJS 1:1, so it's a straight re-export.\n\nimport { CellType } from \"../model/index.js\";\n\n/** ExcelJS's `Enums.ValueType` numbering. */\nexport const ValueType = {\n Null: 0,\n Merge: 1,\n Number: 2,\n String: 3,\n Date: 4,\n Hyperlink: 5,\n Formula: 6,\n SharedString: 7,\n RichText: 8,\n Boolean: 9,\n Error: 10,\n} as const;\n\nexport type ValueType = (typeof ValueType)[keyof typeof ValueType];\n\nexport { FormulaType } from \"../model/index.js\";\n\nconst TO_EXCELJS_VALUE_TYPE: Record<CellType, ValueType> = {\n [CellType.Null]: ValueType.Null,\n [CellType.Number]: ValueType.Number,\n [CellType.String]: ValueType.String,\n [CellType.Boolean]: ValueType.Boolean,\n [CellType.Date]: ValueType.Date,\n [CellType.Error]: ValueType.Error,\n [CellType.RichText]: ValueType.RichText,\n [CellType.Hyperlink]: ValueType.Hyperlink,\n [CellType.Formula]: ValueType.Formula,\n [CellType.Merge]: ValueType.Merge,\n [CellType.SharedString]: ValueType.SharedString,\n};\n\nconst FROM_EXCELJS_VALUE_TYPE: Record<ValueType, CellType> = {\n [ValueType.Null]: CellType.Null,\n [ValueType.Merge]: CellType.Merge,\n [ValueType.Number]: CellType.Number,\n [ValueType.String]: CellType.String,\n [ValueType.Date]: CellType.Date,\n [ValueType.Hyperlink]: CellType.Hyperlink,\n [ValueType.Formula]: CellType.Formula,\n [ValueType.SharedString]: CellType.SharedString,\n [ValueType.RichText]: CellType.RichText,\n [ValueType.Boolean]: CellType.Boolean,\n [ValueType.Error]: CellType.Error,\n};\n\n/** `cell.type` in compat mode: our `CellType` → ExcelJS's `ValueType` number. */\nexport function toExcelJSValueType(cellType: CellType): ValueType {\n return TO_EXCELJS_VALUE_TYPE[cellType];\n}\n\n/** The inverse of {@link toExcelJSValueType}. */\nexport function fromExcelJSValueType(value: ValueType): CellType {\n return FROM_EXCELJS_VALUE_TYPE[value];\n}\n","// The style-precedence divergence the compat shim must emulate (docs/COMPAT-SPEC.md §4).\n//\n// The core resolver (`resolveCellStyle`) does a **deep field-level merge**: a lone `cell.font.bold`\n// coexists with an inherited `font.name`/`font.size`. ExcelJS instead replaces the **whole**\n// category — assigning `cell.font` discards every inherited font field. A migrated spreadsheet must\n// render identically, so the compat facade's style setters route through `applyExcelJsStyle`, which\n// applies ExcelJS whole-object-per-category semantics.\n//\n// This only affects the authoring path: on read, styles come back already fully-resolved per cell,\n// so there is no divergence to bridge there. The core `resolveCellStyle` is deliberately left\n// untouched — the divergence is emulated here, scoped to compat-constructed workbooks.\n\nimport type { Cell, Style } from \"../model/index.js\";\n\n/** The six independently-inheritable style categories, in the order the core resolver lists them. */\nconst STYLE_CATEGORIES = [\"numFmt\", \"font\", \"fill\", \"border\", \"alignment\", \"protection\"] as const;\n\n/**\n * Apply a style `patch` to `cell` with ExcelJS whole-object precedence: every category **present**\n * in the patch replaces the cell's inherited category **outright** (no field-level merge), while\n * categories absent from the patch keep their current (possibly inherited) value. A category set to\n * `undefined` in the patch clears it. The underlying model store is otherwise unchanged — the\n * serializer still dedups the final styles.\n */\nexport function applyExcelJsStyle(cell: Cell, patch: Style): void {\n const inherited = cell.style;\n const next: Style = {};\n for (const key of STYLE_CATEGORIES) {\n // A category the patch mentions comes from the patch (whole-object replacement); otherwise it is\n // inherited from the cell's current style. Either way we copy the value as-is, never merging its\n // fields into the inherited one — that field-merge is exactly the core behaviour we diverge from.\n copyCategory(next, Object.hasOwn(patch, key) ? patch : inherited, key);\n }\n cell.style = next;\n}\n\n/** Copy one style category from `source` to `target`, skipping it entirely when unset. */\nfunction copyCategory<K extends keyof Style>(target: Style, source: Style, key: K): void {\n const value = source[key];\n if (value !== undefined) target[key] = value;\n}\n","// The ExcelJS-faithful facade over the core model (docs/COMPAT-SPEC.md §5).\n//\n// Mechanism (§5 leaves it to the implementer, with one hard rule: it MUST NOT leak ExcelJS\n// semantics into the core `@alosha/xlsx` entry): a **Proxy tree**. `CompatWorkbook`'s constructor\n// returns a Proxy over a plain core `Workbook`; every model object reachable from it (worksheets,\n// rows, columns, cells) is wrapped on the way out. The proxies delegate everything by default and\n// override only the three documented divergences plus the deferred surface:\n//\n// 1. `cell.type` / `cell.effectiveType` report ExcelJS `ValueType` numbers (§3, Decision D1 = full\n// emulation) instead of our `CellType` numbers.\n// 2. cell style setters (`font`/`fill`/`border`/`alignment`/`protection`/`numFmt`) route through\n// `applyExcelJsStyle` — ExcelJS whole-object-per-category precedence (§4).\n// 3. the deferred surface (§6: stream/csv/images/tables/conditional-formatting/data-validation/\n// comments/defined-names/protection) throws `UnsupportedFeatureError` at the exact call, naming\n// the feature, rather than silently no-op'ing.\n//\n// Everything else — `addRow(array | object)`, `row.values` (1-based, empty `[0]`), `worksheet.columns\n// = [{header, key, width}]`, the `workbook.xlsx.*` I/O accessor — is already ExcelJS-shaped in the\n// core model (COMPAT-SPEC.md §2 \"already compatible\"), so the proxies pass it straight through. The\n// core classes are never mutated; the divergence lives entirely in these compat-only wrappers.\n\nimport { UnsupportedFeatureError } from \"../errors.js\";\nimport type { XlsxAccessor } from \"../index.js\";\nimport { Cell, Column, Row, Workbook, Worksheet } from \"../index.js\";\nimport type { Style } from \"../model/index.js\";\nimport { applyExcelJsStyle } from \"./style-compat.js\";\nimport { toExcelJSValueType } from \"./value-type.js\";\n\n/** The pointer appended to every compat `UnsupportedFeatureError` (§6). */\nexport const COMPAT_DEFER =\n \"not yet supported in @alosha/xlsx/compat; see https://github.com/avlisodraude/alosha-xlsx/issues\";\n\n/** Sentinel prop that unwraps a facade back to its raw target (used by {@link unwrap}). */\nconst RAW = Symbol(\"alosha.compat.raw\");\n\n/** The cell style categories whose setters must apply ExcelJS whole-object precedence (§4). */\nconst STYLE_SETTERS = new Set([\"numFmt\", \"font\", \"fill\", \"border\", \"alignment\", \"protection\"]);\n\n// --- deferred surface (§6) ----------------------------------------------------------------------\n\n/** A method stub that always throws, naming `feature`. */\nfunction thrower(feature: string): (...args: never[]) => never {\n return () => {\n throw new UnsupportedFeatureError(feature, COMPAT_DEFER);\n };\n}\n\n/** A namespace-shaped object (e.g. `workbook.csv`) whose every method throws. */\nfunction stubNamespace(prefix: string, methods: readonly string[]): Record<string, () => never> {\n const ns: Record<string, () => never> = {};\n for (const m of methods) ns[m] = thrower(`${prefix}.${m}`);\n return ns;\n}\n\nconst CSV_STUB = stubNamespace(\"workbook.csv\", [\n \"read\",\n \"readFile\",\n \"write\",\n \"writeFile\",\n \"writeBuffer\",\n]);\nconst DEFINED_NAMES_STUB = stubNamespace(\"workbook.definedNames\", [\n \"add\",\n \"remove\",\n \"getRanges\",\n \"forEach\",\n \"getNames\",\n]);\n\n/** Worksheet methods that don't exist in the core model and must fail loud in compat mode. */\nconst WORKSHEET_UNSUPPORTED = new Set([\n \"addImage\",\n \"getImages\",\n \"addBackgroundImage\",\n \"addTable\",\n \"getTable\",\n \"getTables\",\n \"addConditionalFormatting\",\n \"removeConditionalFormatting\",\n \"protect\",\n \"unprotect\",\n]);\n\n/** Streaming entry points hung off the ExcelJS namespace (`ExcelJS.stream.xlsx.*`); each throws. */\nexport const streamStub = {\n xlsx: {\n WorkbookWriter: class {\n constructor() {\n throw new UnsupportedFeatureError(\"stream.xlsx.WorkbookWriter\", COMPAT_DEFER);\n }\n },\n WorkbookReader: class {\n constructor() {\n throw new UnsupportedFeatureError(\"stream.xlsx.WorkbookReader\", COMPAT_DEFER);\n }\n },\n },\n} as const;\n\n// --- facade plumbing ----------------------------------------------------------------------------\n\n// One proxy per underlying object, so facade identity is stable (`ws.getCell('A1') === ws.getCell\n// ('A1')`) and re-wrapping is idempotent.\nconst workbookProxies = new WeakMap<Workbook, Workbook>();\nconst worksheetProxies = new WeakMap<Worksheet, Worksheet>();\nconst rowProxies = new WeakMap<Row, Row>();\nconst columnProxies = new WeakMap<Column, Column>();\nconst cellProxies = new WeakMap<Cell, Cell>();\n\n/** Wrap a value crossing the facade boundary on the way out: model objects become their proxies,\n * arrays are wrapped element-wise (preserving sparse holes, e.g. `row.values`), primitives pass. */\nfunction wrap(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(wrap);\n if (value instanceof Cell) return proxyCell(value);\n if (value instanceof Row) return proxyRow(value);\n if (value instanceof Column) return proxyColumn(value);\n if (value instanceof Worksheet) return proxyWorksheet(value);\n if (value instanceof Workbook) return proxyWorkbook(value);\n return value;\n}\n\n/** The inverse of {@link wrap} for a single value: a facade proxy back to its raw target. */\nfunction unwrap(value: unknown): unknown {\n if (value !== null && typeof value === \"object\") {\n const raw = (value as { [RAW]?: unknown })[RAW];\n if (raw !== undefined) return raw;\n }\n return value;\n}\n\n/** Transform one argument passed *into* a model method: unwrap facade args, and wrap the arguments\n * a user callback receives (so `eachRow`/`eachCell` hand back proxied rows/cells, not raw ones). */\nfunction mapArgIn(arg: unknown): unknown {\n if (typeof arg === \"function\") {\n const cb = arg as (...cbArgs: unknown[]) => unknown;\n return (...cbArgs: unknown[]) => cb(...cbArgs.map(wrap));\n }\n return unwrap(arg);\n}\n\n/** Default `get` behaviour shared by every facade: read the raw property, bind-and-wrap methods so\n * their return value (and callback args) cross the boundary, else wrap the plain value. */\nfunction reflectGet(target: object, prop: string | symbol): unknown {\n const value = Reflect.get(target, prop, target);\n if (typeof value === \"function\") {\n const fn = value as (...args: unknown[]) => unknown;\n return (...args: unknown[]) => wrap(fn.apply(target, args.map(mapArgIn)));\n }\n return wrap(value);\n}\n\n// --- the per-level proxies ----------------------------------------------------------------------\n\nfunction proxyCell(cell: Cell): Cell {\n const cached = cellProxies.get(cell);\n if (cached) return cached;\n const proxy = new Proxy(cell, {\n get(target, prop) {\n if (prop === RAW) return target;\n // Decision D1: compat cells always report ExcelJS ValueType numbers (§3).\n if (prop === \"type\") return toExcelJSValueType(target.type);\n if (prop === \"effectiveType\") return toExcelJSValueType(target.effectiveType);\n return reflectGet(target, prop);\n },\n set(target, prop, value) {\n // §4: assigning a style category replaces it whole-object, never field-merges.\n if (typeof prop === \"string\" && STYLE_SETTERS.has(prop)) {\n const patch: Style = {};\n (patch as Record<string, unknown>)[prop] = value;\n applyExcelJsStyle(target, patch);\n return true;\n }\n if (prop === \"note\") {\n throw new UnsupportedFeatureError(\"cell.note (comments)\", COMPAT_DEFER);\n }\n if (prop === \"dataValidation\") {\n throw new UnsupportedFeatureError(\"cell.dataValidation (data validation)\", COMPAT_DEFER);\n }\n return Reflect.set(target, prop, value, target);\n },\n });\n cellProxies.set(cell, proxy);\n return proxy;\n}\n\nfunction proxyRow(row: Row): Row {\n const cached = rowProxies.get(row);\n if (cached) return cached;\n const proxy = new Proxy(row, {\n get(target, prop) {\n if (prop === RAW) return target;\n return reflectGet(target, prop);\n },\n set(target, prop, value) {\n return Reflect.set(target, prop, value, target);\n },\n });\n rowProxies.set(row, proxy);\n return proxy;\n}\n\nfunction proxyColumn(column: Column): Column {\n const cached = columnProxies.get(column);\n if (cached) return cached;\n const proxy = new Proxy(column, {\n get(target, prop) {\n if (prop === RAW) return target;\n return reflectGet(target, prop);\n },\n set(target, prop, value) {\n return Reflect.set(target, prop, value, target);\n },\n });\n columnProxies.set(column, proxy);\n return proxy;\n}\n\nfunction proxyWorksheet(worksheet: Worksheet): Worksheet {\n const cached = worksheetProxies.get(worksheet);\n if (cached) return cached;\n const proxy = new Proxy(worksheet, {\n get(target, prop) {\n if (prop === RAW) return target;\n if (typeof prop === \"string\" && WORKSHEET_UNSUPPORTED.has(prop)) {\n return thrower(`worksheet.${prop}`);\n }\n if (prop === \"dataValidations\") {\n throw new UnsupportedFeatureError(\n \"worksheet.dataValidations (data validation)\",\n COMPAT_DEFER,\n );\n }\n return reflectGet(target, prop);\n },\n set(target, prop, value) {\n return Reflect.set(target, prop, value, target);\n },\n });\n worksheetProxies.set(worksheet, proxy);\n return proxy;\n}\n\nfunction proxyWorkbook(workbook: Workbook): Workbook {\n const cached = workbookProxies.get(workbook);\n if (cached) return cached;\n const proxy = new Proxy(workbook, {\n get(target, prop) {\n if (prop === RAW) return target;\n // The I/O accessor is already ExcelJS-shaped; only rebind load/read/readFile so they resolve\n // to the *facade* (not the raw workbook), keeping the returned handle inside compat mode.\n if (prop === \"xlsx\") {\n const acc = Reflect.get(target, \"xlsx\", target) as XlsxAccessor;\n return {\n writeBuffer: (...args: Parameters<XlsxAccessor[\"writeBuffer\"]>) =>\n acc.writeBuffer(...args),\n writeFile: (...args: Parameters<XlsxAccessor[\"writeFile\"]>) => acc.writeFile(...args),\n load: async (...args: Parameters<XlsxAccessor[\"load\"]>) => {\n await acc.load(...args);\n return proxy;\n },\n readFile: async (...args: Parameters<XlsxAccessor[\"readFile\"]>) => {\n await acc.readFile(...args);\n return proxy;\n },\n read: async (...args: Parameters<XlsxAccessor[\"read\"]>) => {\n await acc.read(...args);\n return proxy;\n },\n } satisfies XlsxAccessor;\n }\n if (prop === \"csv\") return CSV_STUB;\n if (prop === \"definedNames\") return DEFINED_NAMES_STUB;\n if (prop === \"addImage\" || prop === \"getImage\") return thrower(`workbook.${prop}`);\n if (prop === \"media\") {\n throw new UnsupportedFeatureError(\"workbook.media (images)\", COMPAT_DEFER);\n }\n return reflectGet(target, prop);\n },\n set(target, prop, value) {\n return Reflect.set(target, prop, value, target);\n },\n });\n workbookProxies.set(workbook, proxy);\n return proxy;\n}\n\n/**\n * The compat `Workbook`: an ExcelJS drop-in. `new CompatWorkbook()` builds a plain core workbook and\n * returns a facade Proxy over it — so `instanceof` still holds (the proxy's target *is* a Workbook),\n * while every reachable cell/row/column/worksheet reports ExcelJS semantics (§5).\n */\nexport class CompatWorkbook extends Workbook {\n constructor() {\n super();\n // A constructor may return an object in place of `this`; we deliberately return the facade\n // wrapping the fully-initialised core instance — the whole mechanism of the shim (§5). Cast:\n // the proxy's target is this CompatWorkbook, so `instanceof` still holds.\n // biome-ignore lint/correctness/noConstructorReturn: returning the facade Proxy is intentional.\n return proxyWorkbook(this) as CompatWorkbook;\n }\n}\n","/**\n * @alosha/xlsx/compat — the ExcelJS drop-in shim entry point (docs/COMPAT-SPEC.md).\n *\n * The default export is shaped like the `exceljs` namespace (`{ Workbook, ValueType, Enums, stream }`)\n * and the named `Workbook` is the ExcelJS-faithful facade (`CompatWorkbook`, §5): compat-constructed\n * workbooks report ExcelJS `ValueType` numbers, apply whole-object style precedence, and throw\n * `UnsupportedFeatureError` on the deferred surface (§6). An ExcelJS user changes one import.\n *\n * Re-exports from `../index.js` (not `../model/index.js`) so the `workbook.xlsx` accessor — attached\n * to `Workbook.prototype` as a side effect of loading the main entry — is present on compat workbooks.\n * The star export's plain `Workbook` is deliberately shadowed by the explicit `CompatWorkbook as\n * Workbook` re-export below (explicit named exports win over `export *`).\n */\n\nimport { FormulaType, ValueType } from \"./value-type.js\";\nimport { CompatWorkbook, streamStub } from \"./workbook.js\";\n\nexport * from \"../index.js\";\nexport { fromExcelJSValueType, toExcelJSValueType, ValueType } from \"./value-type.js\";\nexport { CompatWorkbook, CompatWorkbook as Workbook } from \"./workbook.js\";\n\n/** ExcelJS's `Enums` grouping (`import { Enums } from \"exceljs\"`). */\nexport const Enums = {\n ValueType,\n FormulaType,\n} as const;\n\n/** The ExcelJS-shaped default export: `import ExcelJS from \"@alosha/xlsx/compat\"`. */\nconst ExcelJS = {\n Workbook: CompatWorkbook,\n ValueType,\n FormulaType,\n Enums,\n stream: streamStub,\n};\n\nexport default ExcelJS;\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -110,11 +110,15 @@ var InvalidCellValueError = class _InvalidCellValueError extends AloshaXlsxError
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
var UnsupportedFeatureError = class extends AloshaXlsxError {
|
|
113
|
-
constructor(feature) {
|
|
114
|
-
super(
|
|
113
|
+
constructor(feature, detail) {
|
|
114
|
+
super(
|
|
115
|
+
detail === void 0 ? `Feature not yet supported in @alosha/xlsx: ${feature}` : `${feature}: ${detail}`
|
|
116
|
+
);
|
|
115
117
|
this.feature = feature;
|
|
118
|
+
this.detail = detail;
|
|
116
119
|
}
|
|
117
120
|
feature;
|
|
121
|
+
detail;
|
|
118
122
|
code = "UNSUPPORTED_FEATURE";
|
|
119
123
|
};
|
|
120
124
|
var InvalidPackageError = class extends AloshaXlsxError {
|