@loaders.gl/excel 5.0.0-alpha.2 → 5.0.0-alpha.3
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/LICENSE +1 -1
- package/dist/dist.dev.js +3 -3
- package/dist/dist.min.js +1 -1
- package/dist/excel-loader.js +1 -1
- package/dist/excel-worker.js +302 -262
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/package.json +5 -5
package/dist/excel-worker.js
CHANGED
|
@@ -9813,11 +9813,11 @@
|
|
|
9813
9813
|
function make_cell(val, ixfe, t) {
|
|
9814
9814
|
return { v: val, ixfe, t };
|
|
9815
9815
|
}
|
|
9816
|
-
function parse_workbook(blob,
|
|
9816
|
+
function parse_workbook(blob, options) {
|
|
9817
9817
|
var wb = { opts: {} };
|
|
9818
9818
|
var Sheets = {};
|
|
9819
|
-
if (DENSE != null &&
|
|
9820
|
-
var out =
|
|
9819
|
+
if (DENSE != null && options.dense == null) options.dense = DENSE;
|
|
9820
|
+
var out = options.dense ? [] : {};
|
|
9821
9821
|
var Directory = {};
|
|
9822
9822
|
var range = {};
|
|
9823
9823
|
var last_formula = null;
|
|
@@ -9837,9 +9837,9 @@
|
|
|
9837
9837
|
if (icv < 64) return palette[icv - 8] || XLSIcv[icv];
|
|
9838
9838
|
return XLSIcv[icv];
|
|
9839
9839
|
};
|
|
9840
|
-
var process_cell_style = function pcs(cell, line,
|
|
9840
|
+
var process_cell_style = function pcs(cell, line, options2) {
|
|
9841
9841
|
var xfd = line.XF.data;
|
|
9842
|
-
if (!xfd || !xfd.patternType || !
|
|
9842
|
+
if (!xfd || !xfd.patternType || !options2 || !options2.cellStyles) return;
|
|
9843
9843
|
line.s = {};
|
|
9844
9844
|
line.s.patternType = xfd.patternType;
|
|
9845
9845
|
var t;
|
|
@@ -9850,10 +9850,10 @@
|
|
|
9850
9850
|
line.s.bgColor = { rgb: t };
|
|
9851
9851
|
}
|
|
9852
9852
|
};
|
|
9853
|
-
var addcell = function addcell2(cell, line,
|
|
9853
|
+
var addcell = function addcell2(cell, line, options2) {
|
|
9854
9854
|
if (file_depth > 1) return;
|
|
9855
|
-
if (
|
|
9856
|
-
if (
|
|
9855
|
+
if (options2.sheetRows && cell.r >= options2.sheetRows) return;
|
|
9856
|
+
if (options2.cellStyles && line.XF && line.XF.data) process_cell_style(cell, line, options2);
|
|
9857
9857
|
delete line.ixfe;
|
|
9858
9858
|
delete line.XF;
|
|
9859
9859
|
lastcell = cell;
|
|
@@ -9863,7 +9863,7 @@
|
|
|
9863
9863
|
if (cell.c < range.s.c) range.s.c = cell.c;
|
|
9864
9864
|
if (cell.r + 1 > range.e.r) range.e.r = cell.r + 1;
|
|
9865
9865
|
if (cell.c + 1 > range.e.c) range.e.c = cell.c + 1;
|
|
9866
|
-
if (
|
|
9866
|
+
if (options2.cellFormula && line.f) {
|
|
9867
9867
|
for (var afi = 0; afi < arrayf.length; ++afi) {
|
|
9868
9868
|
if (arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue;
|
|
9869
9869
|
if (arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue;
|
|
@@ -9874,7 +9874,7 @@
|
|
|
9874
9874
|
}
|
|
9875
9875
|
}
|
|
9876
9876
|
{
|
|
9877
|
-
if (
|
|
9877
|
+
if (options2.dense) {
|
|
9878
9878
|
if (!out[cell.r]) out[cell.r] = [];
|
|
9879
9879
|
out[cell.r][cell.c] = line;
|
|
9880
9880
|
} else out[last_cell] = line;
|
|
@@ -9901,10 +9901,10 @@
|
|
|
9901
9901
|
// CP from CodePage record
|
|
9902
9902
|
winlocked: 0,
|
|
9903
9903
|
// fLockWn from WinProtect
|
|
9904
|
-
cellStyles: !!
|
|
9905
|
-
WTF: !!
|
|
9904
|
+
cellStyles: !!options && !!options.cellStyles,
|
|
9905
|
+
WTF: !!options && !!options.wtf
|
|
9906
9906
|
};
|
|
9907
|
-
if (
|
|
9907
|
+
if (options.password) opts.password = options.password;
|
|
9908
9908
|
var themes;
|
|
9909
9909
|
var merges = [];
|
|
9910
9910
|
var objects = [];
|
|
@@ -9931,7 +9931,7 @@
|
|
|
9931
9931
|
var length = blob.l === blob.length ? 0 : blob.read_shift(2);
|
|
9932
9932
|
var R = XLSRecordEnum[RecordType];
|
|
9933
9933
|
if (R && R.f) {
|
|
9934
|
-
if (
|
|
9934
|
+
if (options.bookSheets) {
|
|
9935
9935
|
if (last_RT === 133 && RecordType !== 133) break;
|
|
9936
9936
|
}
|
|
9937
9937
|
last_RT = RecordType;
|
|
@@ -9960,7 +9960,7 @@
|
|
|
9960
9960
|
case 47:
|
|
9961
9961
|
if (!opts.enc) blob.l = 0;
|
|
9962
9962
|
opts.enc = val;
|
|
9963
|
-
if (!
|
|
9963
|
+
if (!options.password) throw new Error("File is password-protected");
|
|
9964
9964
|
if (val.valid == null) throw new Error("Encryption scheme unsupported");
|
|
9965
9965
|
if (!val.valid) throw new Error("Password is incorrect");
|
|
9966
9966
|
break;
|
|
@@ -10088,9 +10088,9 @@
|
|
|
10088
10088
|
range.e.r--;
|
|
10089
10089
|
range.e.c--;
|
|
10090
10090
|
out["!ref"] = encode_range(range);
|
|
10091
|
-
if (
|
|
10091
|
+
if (options.sheetRows && options.sheetRows <= range.e.r) {
|
|
10092
10092
|
var tmpri = range.e.r;
|
|
10093
|
-
range.e.r =
|
|
10093
|
+
range.e.r = options.sheetRows - 1;
|
|
10094
10094
|
out["!fullref"] = out["!ref"];
|
|
10095
10095
|
out["!ref"] = encode_range(range);
|
|
10096
10096
|
range.e.r = tmpri;
|
|
@@ -10106,7 +10106,7 @@
|
|
|
10106
10106
|
}
|
|
10107
10107
|
if (cur_sheet === "") Preamble = out;
|
|
10108
10108
|
else Sheets[cur_sheet] = out;
|
|
10109
|
-
out =
|
|
10109
|
+
out = options.dense ? [] : {};
|
|
10110
10110
|
}
|
|
10111
10111
|
break;
|
|
10112
10112
|
case 9:
|
|
@@ -10145,10 +10145,10 @@
|
|
|
10145
10145
|
}
|
|
10146
10146
|
if (opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
|
10147
10147
|
if (file_depth++) break;
|
|
10148
|
-
out =
|
|
10148
|
+
out = options.dense ? [] : {};
|
|
10149
10149
|
if (opts.biff < 8 && !seen_codepage) {
|
|
10150
10150
|
seen_codepage = true;
|
|
10151
|
-
set_cp(opts.codepage =
|
|
10151
|
+
set_cp(opts.codepage = options.codepage || 1252);
|
|
10152
10152
|
}
|
|
10153
10153
|
if (opts.biff < 5 || val.BIFFVer == 0 && val.dt == 4096) {
|
|
10154
10154
|
if (cur_sheet === "") cur_sheet = "Sheet1";
|
|
@@ -10173,12 +10173,12 @@
|
|
|
10173
10173
|
case 2:
|
|
10174
10174
|
{
|
|
10175
10175
|
if (out["!type"] == "chart") {
|
|
10176
|
-
if (
|
|
10176
|
+
if (options.dense ? (out[val.r] || [])[val.c] : out[encode_cell({ c: val.c, r: val.r })]) ++val.c;
|
|
10177
10177
|
}
|
|
10178
10178
|
temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe] || {}, v: val.val, t: "n" };
|
|
10179
10179
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10180
|
-
safe_format_xf(temp_val,
|
|
10181
|
-
addcell({ c: val.c, r: val.r }, temp_val,
|
|
10180
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10181
|
+
addcell({ c: val.c, r: val.r }, temp_val, options);
|
|
10182
10182
|
}
|
|
10183
10183
|
break;
|
|
10184
10184
|
case 5:
|
|
@@ -10186,16 +10186,16 @@
|
|
|
10186
10186
|
{
|
|
10187
10187
|
temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe], v: val.val, t: val.t };
|
|
10188
10188
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10189
|
-
safe_format_xf(temp_val,
|
|
10190
|
-
addcell({ c: val.c, r: val.r }, temp_val,
|
|
10189
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10190
|
+
addcell({ c: val.c, r: val.r }, temp_val, options);
|
|
10191
10191
|
}
|
|
10192
10192
|
break;
|
|
10193
10193
|
case 638:
|
|
10194
10194
|
{
|
|
10195
10195
|
temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe], v: val.rknum, t: "n" };
|
|
10196
10196
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10197
|
-
safe_format_xf(temp_val,
|
|
10198
|
-
addcell({ c: val.c, r: val.r }, temp_val,
|
|
10197
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10198
|
+
addcell({ c: val.c, r: val.r }, temp_val, options);
|
|
10199
10199
|
}
|
|
10200
10200
|
break;
|
|
10201
10201
|
case 189:
|
|
@@ -10204,8 +10204,8 @@
|
|
|
10204
10204
|
var ixfe = val.rkrec[j - val.c][0];
|
|
10205
10205
|
temp_val = { ixfe, XF: XFs[ixfe], v: val.rkrec[j - val.c][1], t: "n" };
|
|
10206
10206
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10207
|
-
safe_format_xf(temp_val,
|
|
10208
|
-
addcell({ c: j, r: val.r }, temp_val,
|
|
10207
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10208
|
+
addcell({ c: j, r: val.r }, temp_val, options);
|
|
10209
10209
|
}
|
|
10210
10210
|
}
|
|
10211
10211
|
break;
|
|
@@ -10219,18 +10219,18 @@
|
|
|
10219
10219
|
}
|
|
10220
10220
|
temp_val = make_cell(val.val, val.cell.ixfe, val.tt);
|
|
10221
10221
|
temp_val.XF = XFs[temp_val.ixfe];
|
|
10222
|
-
if (
|
|
10222
|
+
if (options.cellFormula) {
|
|
10223
10223
|
var _f2 = val.formula;
|
|
10224
10224
|
if (_f2 && _f2[0] && _f2[0][0] && _f2[0][0][0] == "PtgExp") {
|
|
10225
10225
|
var _fr = _f2[0][0][1][0], _fc = _f2[0][0][1][1];
|
|
10226
10226
|
var _fe = encode_cell({ r: _fr, c: _fc });
|
|
10227
10227
|
if (sharedf[_fe]) temp_val.f = "" + stringify_formula(val.formula, range, val.cell, supbooks, opts);
|
|
10228
|
-
else temp_val.F = ((
|
|
10228
|
+
else temp_val.F = ((options.dense ? (out[_fr] || [])[_fc] : out[_fe]) || {}).F;
|
|
10229
10229
|
} else temp_val.f = "" + stringify_formula(val.formula, range, val.cell, supbooks, opts);
|
|
10230
10230
|
}
|
|
10231
10231
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10232
|
-
safe_format_xf(temp_val,
|
|
10233
|
-
addcell(val.cell, temp_val,
|
|
10232
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10233
|
+
addcell(val.cell, temp_val, options);
|
|
10234
10234
|
last_formula = val;
|
|
10235
10235
|
}
|
|
10236
10236
|
break;
|
|
@@ -10241,12 +10241,12 @@
|
|
|
10241
10241
|
last_formula.val = val;
|
|
10242
10242
|
temp_val = make_cell(val, last_formula.cell.ixfe, "s");
|
|
10243
10243
|
temp_val.XF = XFs[temp_val.ixfe];
|
|
10244
|
-
if (
|
|
10244
|
+
if (options.cellFormula) {
|
|
10245
10245
|
temp_val.f = "" + stringify_formula(last_formula.formula, range, last_formula.cell, supbooks, opts);
|
|
10246
10246
|
}
|
|
10247
10247
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10248
|
-
safe_format_xf(temp_val,
|
|
10249
|
-
addcell(last_formula.cell, temp_val,
|
|
10248
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10249
|
+
addcell(last_formula.cell, temp_val, options);
|
|
10250
10250
|
last_formula = null;
|
|
10251
10251
|
} else throw new Error("String record expects Formula");
|
|
10252
10252
|
}
|
|
@@ -10256,8 +10256,8 @@
|
|
|
10256
10256
|
{
|
|
10257
10257
|
arrayf.push(val);
|
|
10258
10258
|
var _arraystart = encode_cell(val[0].s);
|
|
10259
|
-
cc =
|
|
10260
|
-
if (
|
|
10259
|
+
cc = options.dense ? (out[val[0].s.r] || [])[val[0].s.c] : out[_arraystart];
|
|
10260
|
+
if (options.cellFormula && cc) {
|
|
10261
10261
|
if (!last_formula) break;
|
|
10262
10262
|
if (!_arraystart || !cc) break;
|
|
10263
10263
|
cc.f = "" + stringify_formula(val[1], range, val[0], supbooks, opts);
|
|
@@ -10267,11 +10267,11 @@
|
|
|
10267
10267
|
break;
|
|
10268
10268
|
case 1212:
|
|
10269
10269
|
{
|
|
10270
|
-
if (!
|
|
10270
|
+
if (!options.cellFormula) break;
|
|
10271
10271
|
if (last_cell) {
|
|
10272
10272
|
if (!last_formula) break;
|
|
10273
10273
|
sharedf[encode_cell(last_formula.cell)] = val[0];
|
|
10274
|
-
cc =
|
|
10274
|
+
cc = options.dense ? (out[last_formula.cell.r] || [])[last_formula.cell.c] : out[encode_cell(last_formula.cell)];
|
|
10275
10275
|
(cc || {}).f = "" + stringify_formula(val[0], range, lastcell, supbooks, opts);
|
|
10276
10276
|
}
|
|
10277
10277
|
}
|
|
@@ -10281,25 +10281,25 @@
|
|
|
10281
10281
|
if (sst[val.isst].h) temp_val.h = sst[val.isst].h;
|
|
10282
10282
|
temp_val.XF = XFs[temp_val.ixfe];
|
|
10283
10283
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10284
|
-
safe_format_xf(temp_val,
|
|
10285
|
-
addcell({ c: val.c, r: val.r }, temp_val,
|
|
10284
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10285
|
+
addcell({ c: val.c, r: val.r }, temp_val, options);
|
|
10286
10286
|
break;
|
|
10287
10287
|
case 513:
|
|
10288
|
-
if (
|
|
10288
|
+
if (options.sheetStubs) {
|
|
10289
10289
|
temp_val = { ixfe: val.ixfe, XF: XFs[val.ixfe], t: "z" };
|
|
10290
10290
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10291
|
-
safe_format_xf(temp_val,
|
|
10292
|
-
addcell({ c: val.c, r: val.r }, temp_val,
|
|
10291
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10292
|
+
addcell({ c: val.c, r: val.r }, temp_val, options);
|
|
10293
10293
|
}
|
|
10294
10294
|
break;
|
|
10295
10295
|
case 190:
|
|
10296
|
-
if (
|
|
10296
|
+
if (options.sheetStubs) {
|
|
10297
10297
|
for (var _j2 = val.c; _j2 <= val.C; ++_j2) {
|
|
10298
10298
|
var _ixfe = val.ixfe[_j2 - val.c];
|
|
10299
10299
|
temp_val = { ixfe: _ixfe, XF: XFs[_ixfe], t: "z" };
|
|
10300
10300
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10301
|
-
safe_format_xf(temp_val,
|
|
10302
|
-
addcell({ c: _j2, r: val.r }, temp_val,
|
|
10301
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10302
|
+
addcell({ c: _j2, r: val.r }, temp_val, options);
|
|
10303
10303
|
}
|
|
10304
10304
|
}
|
|
10305
10305
|
break;
|
|
@@ -10309,8 +10309,8 @@
|
|
|
10309
10309
|
temp_val = make_cell(val.val, val.ixfe, "s");
|
|
10310
10310
|
temp_val.XF = XFs[temp_val.ixfe];
|
|
10311
10311
|
if (BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[temp_val.ixfe >> 8 & 63];
|
|
10312
|
-
safe_format_xf(temp_val,
|
|
10313
|
-
addcell({ c: val.c, r: val.r }, temp_val,
|
|
10312
|
+
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
10313
|
+
addcell({ c: val.c, r: val.r }, temp_val, options);
|
|
10314
10314
|
break;
|
|
10315
10315
|
case 0:
|
|
10316
10316
|
case 512:
|
|
@@ -10355,7 +10355,7 @@
|
|
|
10355
10355
|
{
|
|
10356
10356
|
for (rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
|
|
10357
10357
|
for (rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
|
|
10358
|
-
cc =
|
|
10358
|
+
cc = options.dense ? (out[rngR] || [])[rngC] : out[encode_cell({ c: rngC, r: rngR })];
|
|
10359
10359
|
if (cc) cc.l = val[1];
|
|
10360
10360
|
}
|
|
10361
10361
|
}
|
|
@@ -10364,7 +10364,7 @@
|
|
|
10364
10364
|
{
|
|
10365
10365
|
for (rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
|
|
10366
10366
|
for (rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
|
|
10367
|
-
cc =
|
|
10367
|
+
cc = options.dense ? (out[rngR] || [])[rngC] : out[encode_cell({ c: rngC, r: rngR })];
|
|
10368
10368
|
if (cc && cc.l) cc.l.Tooltip = val[1];
|
|
10369
10369
|
}
|
|
10370
10370
|
}
|
|
@@ -10372,10 +10372,10 @@
|
|
|
10372
10372
|
case 28:
|
|
10373
10373
|
{
|
|
10374
10374
|
if (opts.biff <= 5 && opts.biff >= 2) break;
|
|
10375
|
-
cc =
|
|
10375
|
+
cc = options.dense ? (out[val[0].r] || [])[val[0].c] : out[encode_cell(val[0])];
|
|
10376
10376
|
var noteobj = objects[val[2]];
|
|
10377
10377
|
if (!cc) {
|
|
10378
|
-
if (
|
|
10378
|
+
if (options.dense) {
|
|
10379
10379
|
if (!out[val[0].r]) out[val[0].r] = [];
|
|
10380
10380
|
cc = out[val[0].r][val[0].c] = { t: "z" };
|
|
10381
10381
|
} else {
|
|
@@ -10466,7 +10466,7 @@
|
|
|
10466
10466
|
}).map(function(x) {
|
|
10467
10467
|
return Directory[x].name;
|
|
10468
10468
|
});
|
|
10469
|
-
if (!
|
|
10469
|
+
if (!options.bookSheets) wb.Sheets = Sheets;
|
|
10470
10470
|
if (!wb.SheetNames.length && Preamble["!ref"]) {
|
|
10471
10471
|
wb.SheetNames.push("Sheet1");
|
|
10472
10472
|
if (wb.Sheets) wb.Sheets["Sheet1"] = Preamble;
|
|
@@ -10505,18 +10505,18 @@
|
|
|
10505
10505
|
delete props.TitlesOfParts;
|
|
10506
10506
|
}
|
|
10507
10507
|
}
|
|
10508
|
-
function parse_xlscfb(cfb,
|
|
10509
|
-
if (!
|
|
10510
|
-
fix_read_opts(
|
|
10508
|
+
function parse_xlscfb(cfb, options) {
|
|
10509
|
+
if (!options) options = {};
|
|
10510
|
+
fix_read_opts(options);
|
|
10511
10511
|
reset_cp();
|
|
10512
|
-
if (
|
|
10512
|
+
if (options.codepage) set_ansi(options.codepage);
|
|
10513
10513
|
var CompObj, WB;
|
|
10514
10514
|
if (cfb.FullPaths) {
|
|
10515
10515
|
if (CFB.find(cfb, "/encryption")) throw new Error("File is password-protected");
|
|
10516
10516
|
CompObj = CFB.find(cfb, "!CompObj");
|
|
10517
10517
|
WB = CFB.find(cfb, "/Workbook") || CFB.find(cfb, "/Book");
|
|
10518
10518
|
} else {
|
|
10519
|
-
switch (
|
|
10519
|
+
switch (options.type) {
|
|
10520
10520
|
case "base64":
|
|
10521
10521
|
cfb = s2a(Base64_decode(cfb));
|
|
10522
10522
|
break;
|
|
@@ -10535,25 +10535,25 @@
|
|
|
10535
10535
|
var WorkbookP;
|
|
10536
10536
|
var _data;
|
|
10537
10537
|
if (CompObj) parse_compobj(CompObj);
|
|
10538
|
-
if (
|
|
10538
|
+
if (options.bookProps && !options.bookSheets) WorkbookP = {};
|
|
10539
10539
|
else {
|
|
10540
10540
|
var T = has_buf ? "buffer" : "array";
|
|
10541
|
-
if (WB && WB.content) WorkbookP = parse_workbook(WB.content,
|
|
10542
|
-
else if ((_data = CFB.find(cfb, "PerfectOffice_MAIN")) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (
|
|
10543
|
-
else if ((_data = CFB.find(cfb, "NativeContent_MAIN")) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (
|
|
10541
|
+
if (WB && WB.content) WorkbookP = parse_workbook(WB.content, options);
|
|
10542
|
+
else if ((_data = CFB.find(cfb, "PerfectOffice_MAIN")) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options));
|
|
10543
|
+
else if ((_data = CFB.find(cfb, "NativeContent_MAIN")) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options));
|
|
10544
10544
|
else if ((_data = CFB.find(cfb, "MN0")) && _data.content) throw new Error("Unsupported Works 4 for Mac file");
|
|
10545
10545
|
else throw new Error("Cannot find Workbook stream");
|
|
10546
|
-
if (
|
|
10546
|
+
if (options.bookVBA && cfb.FullPaths && CFB.find(cfb, "/_VBA_PROJECT_CUR/VBA/dir")) WorkbookP.vbaraw = make_vba_xls(cfb);
|
|
10547
10547
|
}
|
|
10548
10548
|
var props = {};
|
|
10549
10549
|
if (cfb.FullPaths) parse_xls_props(
|
|
10550
10550
|
/*::((*/
|
|
10551
10551
|
cfb,
|
|
10552
10552
|
props,
|
|
10553
|
-
|
|
10553
|
+
options
|
|
10554
10554
|
);
|
|
10555
10555
|
WorkbookP.Props = WorkbookP.Custprops = props;
|
|
10556
|
-
if (
|
|
10556
|
+
if (options.bookFiles) WorkbookP.cfb = cfb;
|
|
10557
10557
|
return WorkbookP;
|
|
10558
10558
|
}
|
|
10559
10559
|
function write_biff_rec(ba, type, payload, length) {
|
|
@@ -13609,9 +13609,9 @@
|
|
|
13609
13609
|
function get_fs() {
|
|
13610
13610
|
return fs || (fs = {});
|
|
13611
13611
|
}
|
|
13612
|
-
function parse(file,
|
|
13613
|
-
if (file[0] == 80 && file[1] == 75) return parse_zip2(file,
|
|
13614
|
-
if ((file[0] | 32) == 109 && (file[1] | 32) == 105) return parse_mad(file,
|
|
13612
|
+
function parse(file, options) {
|
|
13613
|
+
if (file[0] == 80 && file[1] == 75) return parse_zip2(file, options);
|
|
13614
|
+
if ((file[0] | 32) == 109 && (file[1] | 32) == 105) return parse_mad(file, options);
|
|
13615
13615
|
if (file.length < 512) throw new Error("CFB file size " + file.length + " < 512");
|
|
13616
13616
|
var mver = 3;
|
|
13617
13617
|
var ssz = 512;
|
|
@@ -13636,7 +13636,7 @@
|
|
|
13636
13636
|
ssz = 4096;
|
|
13637
13637
|
break;
|
|
13638
13638
|
case 0:
|
|
13639
|
-
if (mv[1] == 0) return parse_zip2(file,
|
|
13639
|
+
if (mv[1] == 0) return parse_zip2(file, options);
|
|
13640
13640
|
/* falls through */
|
|
13641
13641
|
default:
|
|
13642
13642
|
throw new Error("Major Version: Expected 3 or 4 saw " + mver);
|
|
@@ -13683,7 +13683,7 @@
|
|
|
13683
13683
|
FileIndex,
|
|
13684
13684
|
FullPaths
|
|
13685
13685
|
};
|
|
13686
|
-
if (
|
|
13686
|
+
if (options && options.raw) o.raw = { header, sectors };
|
|
13687
13687
|
return o;
|
|
13688
13688
|
}
|
|
13689
13689
|
function check_get_mver(blob) {
|
|
@@ -13888,27 +13888,27 @@
|
|
|
13888
13888
|
function read_date(blob, offset) {
|
|
13889
13889
|
return new Date((__readUInt32LE(blob, offset + 4) / 1e7 * Math.pow(2, 32) + __readUInt32LE(blob, offset) / 1e7 - 11644473600) * 1e3);
|
|
13890
13890
|
}
|
|
13891
|
-
function read_file(filename2,
|
|
13891
|
+
function read_file(filename2, options) {
|
|
13892
13892
|
get_fs();
|
|
13893
|
-
return parse(fs.readFileSync(filename2),
|
|
13893
|
+
return parse(fs.readFileSync(filename2), options);
|
|
13894
13894
|
}
|
|
13895
|
-
function read(blob,
|
|
13896
|
-
var type =
|
|
13895
|
+
function read(blob, options) {
|
|
13896
|
+
var type = options && options.type;
|
|
13897
13897
|
if (!type) {
|
|
13898
13898
|
if (has_buf && Buffer.isBuffer(blob)) type = "buffer";
|
|
13899
13899
|
}
|
|
13900
13900
|
switch (type || "base64") {
|
|
13901
13901
|
case "file":
|
|
13902
|
-
return read_file(blob,
|
|
13902
|
+
return read_file(blob, options);
|
|
13903
13903
|
case "base64":
|
|
13904
|
-
return parse(s2a(Base64_decode(blob)),
|
|
13904
|
+
return parse(s2a(Base64_decode(blob)), options);
|
|
13905
13905
|
case "binary":
|
|
13906
|
-
return parse(s2a(blob),
|
|
13906
|
+
return parse(s2a(blob), options);
|
|
13907
13907
|
}
|
|
13908
13908
|
return parse(
|
|
13909
13909
|
/*::typeof blob == 'string' ? new Buffer(blob, 'utf-8') : */
|
|
13910
13910
|
blob,
|
|
13911
|
-
|
|
13911
|
+
options
|
|
13912
13912
|
);
|
|
13913
13913
|
}
|
|
13914
13914
|
function init_cfb(cfb, opts) {
|
|
@@ -14016,8 +14016,8 @@
|
|
|
14016
14016
|
}
|
|
14017
14017
|
}
|
|
14018
14018
|
}
|
|
14019
|
-
function _write(cfb,
|
|
14020
|
-
var _opts =
|
|
14019
|
+
function _write(cfb, options) {
|
|
14020
|
+
var _opts = options || {};
|
|
14021
14021
|
if (_opts.fileType == "mad") return write_mad(cfb, _opts);
|
|
14022
14022
|
rebuild_cfb(cfb);
|
|
14023
14023
|
switch (_opts.fileType) {
|
|
@@ -14217,9 +14217,9 @@
|
|
|
14217
14217
|
/* 2.6.1 Compound File Directory Entry */
|
|
14218
14218
|
EntryTypes: ["unknown", "storage", "stream", "lockbytes", "property", "root"]
|
|
14219
14219
|
};
|
|
14220
|
-
function write_file(cfb, filename2,
|
|
14220
|
+
function write_file(cfb, filename2, options) {
|
|
14221
14221
|
get_fs();
|
|
14222
|
-
var o = _write(cfb,
|
|
14222
|
+
var o = _write(cfb, options);
|
|
14223
14223
|
fs.writeFileSync(filename2, o);
|
|
14224
14224
|
}
|
|
14225
14225
|
function a2s2(o) {
|
|
@@ -14227,12 +14227,12 @@
|
|
|
14227
14227
|
for (var i2 = 0; i2 < o.length; ++i2) out[i2] = String.fromCharCode(o[i2]);
|
|
14228
14228
|
return out.join("");
|
|
14229
14229
|
}
|
|
14230
|
-
function write(cfb,
|
|
14231
|
-
var o = _write(cfb,
|
|
14232
|
-
switch (
|
|
14230
|
+
function write(cfb, options) {
|
|
14231
|
+
var o = _write(cfb, options);
|
|
14232
|
+
switch (options && options.type || "buffer") {
|
|
14233
14233
|
case "file":
|
|
14234
14234
|
get_fs();
|
|
14235
|
-
fs.writeFileSync(
|
|
14235
|
+
fs.writeFileSync(options.filename, o);
|
|
14236
14236
|
return o;
|
|
14237
14237
|
case "binary":
|
|
14238
14238
|
return typeof o == "string" ? o : a2s2(o);
|
|
@@ -14686,7 +14686,7 @@
|
|
|
14686
14686
|
if (typeof console !== "undefined") console.error(msg);
|
|
14687
14687
|
} else throw new Error(msg);
|
|
14688
14688
|
}
|
|
14689
|
-
function parse_zip2(file,
|
|
14689
|
+
function parse_zip2(file, options) {
|
|
14690
14690
|
var blob = (
|
|
14691
14691
|
/*::(*/
|
|
14692
14692
|
file
|
|
@@ -14697,7 +14697,7 @@
|
|
|
14697
14697
|
FileIndex,
|
|
14698
14698
|
FullPaths
|
|
14699
14699
|
};
|
|
14700
|
-
init_cfb(o, { root:
|
|
14700
|
+
init_cfb(o, { root: options.root });
|
|
14701
14701
|
var i2 = blob.length - 4;
|
|
14702
14702
|
while ((blob[i2] != 80 || blob[i2 + 1] != 75 || blob[i2 + 2] != 5 || blob[i2 + 3] != 6) && i2 >= 0) --i2;
|
|
14703
14703
|
blob.l = i2 + 4;
|
|
@@ -14776,8 +14776,8 @@
|
|
|
14776
14776
|
if (_usz != usz) warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz);
|
|
14777
14777
|
cfb_add(o, name, data, { unsafe: true, mt: date });
|
|
14778
14778
|
}
|
|
14779
|
-
function write_zip(cfb,
|
|
14780
|
-
var _opts =
|
|
14779
|
+
function write_zip(cfb, options) {
|
|
14780
|
+
var _opts = options || {};
|
|
14781
14781
|
var out = [], cdirs = [];
|
|
14782
14782
|
var o = new_buf(1);
|
|
14783
14783
|
var method = _opts.compression ? 8 : 0, flags = 0;
|
|
@@ -14974,9 +14974,9 @@
|
|
|
14974
14974
|
var file = cfb_add(cfb, fname.slice(root.length), fdata, { unsafe: true });
|
|
14975
14975
|
if (ctype) file.ctype = ctype;
|
|
14976
14976
|
}
|
|
14977
|
-
function parse_mad(file,
|
|
14977
|
+
function parse_mad(file, options) {
|
|
14978
14978
|
if (a2s2(file.slice(0, 13)).toLowerCase() != "mime-version:") throw new Error("Unsupported MAD header");
|
|
14979
|
-
var root =
|
|
14979
|
+
var root = options && options.root || "";
|
|
14980
14980
|
var data = (has_buf && Buffer.isBuffer(file) ? file.toString("binary") : a2s2(file)).split("\r\n");
|
|
14981
14981
|
var di = 0, row = "";
|
|
14982
14982
|
for (di = 0; di < data.length; ++di) {
|
|
@@ -15009,8 +15009,8 @@
|
|
|
15009
15009
|
}
|
|
15010
15010
|
return o;
|
|
15011
15011
|
}
|
|
15012
|
-
function write_mad(cfb,
|
|
15013
|
-
var opts =
|
|
15012
|
+
function write_mad(cfb, options) {
|
|
15013
|
+
var opts = options || {};
|
|
15014
15014
|
var boundary = opts.boundary || "SheetJS";
|
|
15015
15015
|
boundary = "------=" + boundary;
|
|
15016
15016
|
var out = [
|
|
@@ -26815,7 +26815,7 @@
|
|
|
26815
26815
|
});
|
|
26816
26816
|
|
|
26817
26817
|
// src/lib/parse-excel.ts
|
|
26818
|
-
function parseExcel(arrayBuffer,
|
|
26818
|
+
function parseExcel(arrayBuffer, options) {
|
|
26819
26819
|
const dataUrl = "dummy";
|
|
26820
26820
|
const workbook = readSync(arrayBuffer, {
|
|
26821
26821
|
type: "array"
|
|
@@ -26828,8 +26828,8 @@
|
|
|
26828
26828
|
dataTableNamesMap[dataUrl] = workbook.SheetNames;
|
|
26829
26829
|
}
|
|
26830
26830
|
let sheetName = workbook.SheetNames[0];
|
|
26831
|
-
if (
|
|
26832
|
-
sheetName =
|
|
26831
|
+
if (options?.excel?.sheet && workbook.SheetNames.indexOf(options?.excel?.sheet) >= 0) {
|
|
26832
|
+
sheetName = options?.excel?.sheet;
|
|
26833
26833
|
}
|
|
26834
26834
|
const worksheet = workbook.Sheets[sheetName];
|
|
26835
26835
|
dataRows = utils.sheet_to_json(worksheet);
|
|
@@ -27522,11 +27522,11 @@
|
|
|
27522
27522
|
return pump2(fromNodeStream(stream));
|
|
27523
27523
|
},
|
|
27524
27524
|
// @ts-ignore
|
|
27525
|
-
toDOMStream(source,
|
|
27525
|
+
toDOMStream(source, options) {
|
|
27526
27526
|
throw new Error(`"toDOMStream" not available in this environment`);
|
|
27527
27527
|
},
|
|
27528
27528
|
// @ts-ignore
|
|
27529
|
-
toNodeStream(source,
|
|
27529
|
+
toNodeStream(source, options) {
|
|
27530
27530
|
throw new Error(`"toNodeStream" not available in this environment`);
|
|
27531
27531
|
}
|
|
27532
27532
|
};
|
|
@@ -34329,12 +34329,12 @@ return true;`);
|
|
|
34329
34329
|
Builder2 = class {
|
|
34330
34330
|
/** @nocollapse */
|
|
34331
34331
|
// @ts-ignore
|
|
34332
|
-
static throughNode(
|
|
34332
|
+
static throughNode(options) {
|
|
34333
34333
|
throw new Error(`"throughNode" not available in this environment`);
|
|
34334
34334
|
}
|
|
34335
34335
|
/** @nocollapse */
|
|
34336
34336
|
// @ts-ignore
|
|
34337
|
-
static throughDOM(
|
|
34337
|
+
static throughDOM(options) {
|
|
34338
34338
|
throw new Error(`"throughDOM" not available in this environment`);
|
|
34339
34339
|
}
|
|
34340
34340
|
/**
|
|
@@ -36064,14 +36064,14 @@ return true;`);
|
|
|
36064
36064
|
tee() {
|
|
36065
36065
|
return this._getDOMStream().tee();
|
|
36066
36066
|
}
|
|
36067
|
-
pipe(writable,
|
|
36068
|
-
return this._getNodeStream().pipe(writable,
|
|
36067
|
+
pipe(writable, options) {
|
|
36068
|
+
return this._getNodeStream().pipe(writable, options);
|
|
36069
36069
|
}
|
|
36070
|
-
pipeTo(writable,
|
|
36071
|
-
return this._getDOMStream().pipeTo(writable,
|
|
36070
|
+
pipeTo(writable, options) {
|
|
36071
|
+
return this._getDOMStream().pipeTo(writable, options);
|
|
36072
36072
|
}
|
|
36073
|
-
pipeThrough(duplex,
|
|
36074
|
-
return this._getDOMStream().pipeThrough(duplex,
|
|
36073
|
+
pipeThrough(duplex, options) {
|
|
36074
|
+
return this._getDOMStream().pipeThrough(duplex, options);
|
|
36075
36075
|
}
|
|
36076
36076
|
_getDOMStream() {
|
|
36077
36077
|
return this._DOMStream || (this._DOMStream = this.toDOMStream());
|
|
@@ -36118,11 +36118,11 @@ return true;`);
|
|
|
36118
36118
|
[Symbol.asyncIterator]() {
|
|
36119
36119
|
return this;
|
|
36120
36120
|
}
|
|
36121
|
-
toDOMStream(
|
|
36122
|
-
return adapters_default.toDOMStream(this._closedPromiseResolve || this._error ? this : this._values,
|
|
36121
|
+
toDOMStream(options) {
|
|
36122
|
+
return adapters_default.toDOMStream(this._closedPromiseResolve || this._error ? this : this._values, options);
|
|
36123
36123
|
}
|
|
36124
|
-
toNodeStream(
|
|
36125
|
-
return adapters_default.toNodeStream(this._closedPromiseResolve || this._error ? this : this._values,
|
|
36124
|
+
toNodeStream(options) {
|
|
36125
|
+
return adapters_default.toNodeStream(this._closedPromiseResolve || this._error ? this : this._values, options);
|
|
36126
36126
|
}
|
|
36127
36127
|
throw(_) {
|
|
36128
36128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -37239,8 +37239,8 @@ return true;`);
|
|
|
37239
37239
|
init_buffer3();
|
|
37240
37240
|
init_builder2();
|
|
37241
37241
|
BoolBuilder = class extends Builder2 {
|
|
37242
|
-
constructor(
|
|
37243
|
-
super(
|
|
37242
|
+
constructor(options) {
|
|
37243
|
+
super(options);
|
|
37244
37244
|
this._values = new BitmapBufferBuilder();
|
|
37245
37245
|
}
|
|
37246
37246
|
setValue(index, value) {
|
|
@@ -37746,11 +37746,11 @@ return true;`);
|
|
|
37746
37746
|
init_builder2();
|
|
37747
37747
|
init_type2();
|
|
37748
37748
|
UnionBuilder = class extends Builder2 {
|
|
37749
|
-
constructor(
|
|
37750
|
-
super(
|
|
37749
|
+
constructor(options) {
|
|
37750
|
+
super(options);
|
|
37751
37751
|
this._typeIds = new DataBufferBuilder(Int8Array, 0, 1);
|
|
37752
|
-
if (typeof
|
|
37753
|
-
this._valueToChildTypeId =
|
|
37752
|
+
if (typeof options["valueToChildTypeId"] === "function") {
|
|
37753
|
+
this._valueToChildTypeId = options["valueToChildTypeId"];
|
|
37754
37754
|
}
|
|
37755
37755
|
}
|
|
37756
37756
|
get typeIdToChildIndex() {
|
|
@@ -37789,8 +37789,8 @@ return true;`);
|
|
|
37789
37789
|
SparseUnionBuilder = class extends UnionBuilder {
|
|
37790
37790
|
};
|
|
37791
37791
|
DenseUnionBuilder = class extends UnionBuilder {
|
|
37792
|
-
constructor(
|
|
37793
|
-
super(
|
|
37792
|
+
constructor(options) {
|
|
37793
|
+
super(options);
|
|
37794
37794
|
this._offsets = new DataBufferBuilder(Int32Array);
|
|
37795
37795
|
}
|
|
37796
37796
|
/** @ignore */
|
|
@@ -38338,12 +38338,12 @@ return true;`);
|
|
|
38338
38338
|
});
|
|
38339
38339
|
|
|
38340
38340
|
// ../../node_modules/apache-arrow/factories.mjs
|
|
38341
|
-
function makeBuilder(
|
|
38342
|
-
const type =
|
|
38343
|
-
const builder = new (instance6.getVisitFn(type)())(
|
|
38341
|
+
function makeBuilder(options) {
|
|
38342
|
+
const type = options.type;
|
|
38343
|
+
const builder = new (instance6.getVisitFn(type)())(options);
|
|
38344
38344
|
if (type.children && type.children.length > 0) {
|
|
38345
|
-
const children =
|
|
38346
|
-
const defaultOptions = { "nullValues":
|
|
38345
|
+
const children = options["children"] || [];
|
|
38346
|
+
const defaultOptions = { "nullValues": options["nullValues"] };
|
|
38347
38347
|
const getChildOptions = Array.isArray(children) ? ((_, i) => children[i] || defaultOptions) : (({ name }) => children[name] || defaultOptions);
|
|
38348
38348
|
for (const [index, field] of type.children.entries()) {
|
|
38349
38349
|
const { type: type2 } = field;
|
|
@@ -38357,8 +38357,8 @@ return true;`);
|
|
|
38357
38357
|
if (init instanceof Data || init instanceof Vector || init.type instanceof DataType || ArrayBuffer.isView(init)) {
|
|
38358
38358
|
return makeVector(init);
|
|
38359
38359
|
}
|
|
38360
|
-
const
|
|
38361
|
-
const chunks = [...builderThroughIterable(
|
|
38360
|
+
const options = { type: type !== null && type !== void 0 ? type : inferType(init), nullValues: [null] };
|
|
38361
|
+
const chunks = [...builderThroughIterable(options)(init)];
|
|
38362
38362
|
const vector = chunks.length === 1 ? chunks[0] : chunks.reduce((a, b) => a.concat(b));
|
|
38363
38363
|
if (DataType.isDictionary(vector.type)) {
|
|
38364
38364
|
return vector.memoize();
|
|
@@ -38441,13 +38441,13 @@ return true;`);
|
|
|
38441
38441
|
}
|
|
38442
38442
|
throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.");
|
|
38443
38443
|
}
|
|
38444
|
-
function builderThroughIterable(
|
|
38445
|
-
const { ["queueingStrategy"]: queueingStrategy = "count" } =
|
|
38446
|
-
const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } =
|
|
38444
|
+
function builderThroughIterable(options) {
|
|
38445
|
+
const { ["queueingStrategy"]: queueingStrategy = "count" } = options;
|
|
38446
|
+
const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } = options;
|
|
38447
38447
|
const sizeProperty = queueingStrategy !== "bytes" ? "length" : "byteLength";
|
|
38448
38448
|
return function* (source) {
|
|
38449
38449
|
let numChunks = 0;
|
|
38450
|
-
const builder = makeBuilder(
|
|
38450
|
+
const builder = makeBuilder(options);
|
|
38451
38451
|
for (const value of source) {
|
|
38452
38452
|
if (builder.append(value)[sizeProperty] >= highWaterMark) {
|
|
38453
38453
|
++numChunks && (yield builder.toVector());
|
|
@@ -38458,15 +38458,15 @@ return true;`);
|
|
|
38458
38458
|
}
|
|
38459
38459
|
};
|
|
38460
38460
|
}
|
|
38461
|
-
function builderThroughAsyncIterable(
|
|
38462
|
-
const { ["queueingStrategy"]: queueingStrategy = "count" } =
|
|
38463
|
-
const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } =
|
|
38461
|
+
function builderThroughAsyncIterable(options) {
|
|
38462
|
+
const { ["queueingStrategy"]: queueingStrategy = "count" } = options;
|
|
38463
|
+
const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } = options;
|
|
38464
38464
|
const sizeProperty = queueingStrategy !== "bytes" ? "length" : "byteLength";
|
|
38465
38465
|
return function(source) {
|
|
38466
38466
|
return __asyncGenerator(this, arguments, function* () {
|
|
38467
38467
|
var _a5, e_1, _b2, _c2;
|
|
38468
38468
|
let numChunks = 0;
|
|
38469
|
-
const builder = makeBuilder(
|
|
38469
|
+
const builder = makeBuilder(options);
|
|
38470
38470
|
try {
|
|
38471
38471
|
for (var _d2 = true, source_1 = __asyncValues(source), source_1_1; source_1_1 = yield __await(source_1.next()), _a5 = source_1_1.done, !_a5; _d2 = true) {
|
|
38472
38472
|
_c2 = source_1_1.value;
|
|
@@ -39572,8 +39572,8 @@ return true;`);
|
|
|
39572
39572
|
});
|
|
39573
39573
|
|
|
39574
39574
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
39575
|
-
function shouldAutoDestroy(self2,
|
|
39576
|
-
return
|
|
39575
|
+
function shouldAutoDestroy(self2, options) {
|
|
39576
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
39577
39577
|
}
|
|
39578
39578
|
function* readAllSync(source) {
|
|
39579
39579
|
const reader = RecordBatchReader.from(source);
|
|
@@ -39706,8 +39706,8 @@ return true;`);
|
|
|
39706
39706
|
this._nodeStream = void 0;
|
|
39707
39707
|
return this;
|
|
39708
39708
|
}
|
|
39709
|
-
open(
|
|
39710
|
-
const opening = this._impl.open(
|
|
39709
|
+
open(options) {
|
|
39710
|
+
const opening = this._impl.open(options);
|
|
39711
39711
|
return isPromise(opening) ? opening.then(() => this) : this;
|
|
39712
39712
|
}
|
|
39713
39713
|
readRecordBatch(index) {
|
|
@@ -39727,7 +39727,7 @@ return true;`);
|
|
|
39727
39727
|
}
|
|
39728
39728
|
/** @nocollapse */
|
|
39729
39729
|
// @ts-ignore
|
|
39730
|
-
static throughNode(
|
|
39730
|
+
static throughNode(options) {
|
|
39731
39731
|
throw new Error(`"throughNode" not available in this environment`);
|
|
39732
39732
|
}
|
|
39733
39733
|
/** @nocollapse */
|
|
@@ -39948,9 +39948,9 @@ return true;`);
|
|
|
39948
39948
|
this.dictionaries = null;
|
|
39949
39949
|
}
|
|
39950
39950
|
}
|
|
39951
|
-
open(
|
|
39951
|
+
open(options) {
|
|
39952
39952
|
if (!this.closed) {
|
|
39953
|
-
this.autoDestroy = shouldAutoDestroy(this,
|
|
39953
|
+
this.autoDestroy = shouldAutoDestroy(this, options);
|
|
39954
39954
|
if (!(this.schema || (this.schema = this._reader.readSchema()))) {
|
|
39955
39955
|
this.cancel();
|
|
39956
39956
|
}
|
|
@@ -40025,10 +40025,10 @@ return true;`);
|
|
|
40025
40025
|
}
|
|
40026
40026
|
});
|
|
40027
40027
|
}
|
|
40028
|
-
open(
|
|
40028
|
+
open(options) {
|
|
40029
40029
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40030
40030
|
if (!this.closed) {
|
|
40031
|
-
this.autoDestroy = shouldAutoDestroy(this,
|
|
40031
|
+
this.autoDestroy = shouldAutoDestroy(this, options);
|
|
40032
40032
|
if (!(this.schema || (this.schema = yield this._reader.readSchema()))) {
|
|
40033
40033
|
yield this.cancel();
|
|
40034
40034
|
}
|
|
@@ -40108,14 +40108,14 @@ return true;`);
|
|
|
40108
40108
|
isFile() {
|
|
40109
40109
|
return true;
|
|
40110
40110
|
}
|
|
40111
|
-
open(
|
|
40111
|
+
open(options) {
|
|
40112
40112
|
if (!this.closed && !this._footer) {
|
|
40113
40113
|
this.schema = (this._footer = this._readFooter()).schema;
|
|
40114
40114
|
for (const block of this._footer.dictionaryBatches()) {
|
|
40115
40115
|
block && this._readDictionaryBatch(this._dictionaryIndex++);
|
|
40116
40116
|
}
|
|
40117
40117
|
}
|
|
40118
|
-
return super.open(
|
|
40118
|
+
return super.open(options);
|
|
40119
40119
|
}
|
|
40120
40120
|
readRecordBatch(index) {
|
|
40121
40121
|
var _a5;
|
|
@@ -40192,7 +40192,7 @@ return true;`);
|
|
|
40192
40192
|
isAsync() {
|
|
40193
40193
|
return true;
|
|
40194
40194
|
}
|
|
40195
|
-
open(
|
|
40195
|
+
open(options) {
|
|
40196
40196
|
const _super = Object.create(null, {
|
|
40197
40197
|
open: { get: () => super.open }
|
|
40198
40198
|
});
|
|
@@ -40203,7 +40203,7 @@ return true;`);
|
|
|
40203
40203
|
block && (yield this._readDictionaryBatch(this._dictionaryIndex++));
|
|
40204
40204
|
}
|
|
40205
40205
|
}
|
|
40206
|
-
return yield _super.open.call(this,
|
|
40206
|
+
return yield _super.open.call(this, options);
|
|
40207
40207
|
});
|
|
40208
40208
|
}
|
|
40209
40209
|
readRecordBatch(index) {
|
|
@@ -40822,14 +40822,14 @@ return true;`);
|
|
|
40822
40822
|
RecordBatchWriter = class extends ReadableInterop {
|
|
40823
40823
|
/** @nocollapse */
|
|
40824
40824
|
// @ts-ignore
|
|
40825
|
-
static throughNode(
|
|
40825
|
+
static throughNode(options) {
|
|
40826
40826
|
throw new Error(`"throughNode" not available in this environment`);
|
|
40827
40827
|
}
|
|
40828
40828
|
/** @nocollapse */
|
|
40829
40829
|
static throughDOM(writableStrategy, readableStrategy) {
|
|
40830
40830
|
throw new Error(`"throughDOM" not available in this environment`);
|
|
40831
40831
|
}
|
|
40832
|
-
constructor(
|
|
40832
|
+
constructor(options) {
|
|
40833
40833
|
super();
|
|
40834
40834
|
this._position = 0;
|
|
40835
40835
|
this._started = false;
|
|
@@ -40840,18 +40840,18 @@ return true;`);
|
|
|
40840
40840
|
this._recordBatchBlocks = [];
|
|
40841
40841
|
this._seenDictionaries = /* @__PURE__ */ new Map();
|
|
40842
40842
|
this._dictionaryDeltaOffsets = /* @__PURE__ */ new Map();
|
|
40843
|
-
isObject(
|
|
40844
|
-
this._autoDestroy = typeof
|
|
40845
|
-
this._writeLegacyIpcFormat = typeof
|
|
40846
|
-
if (
|
|
40843
|
+
isObject(options) || (options = { autoDestroy: true, writeLegacyIpcFormat: false, compressionType: null });
|
|
40844
|
+
this._autoDestroy = typeof options.autoDestroy === "boolean" ? options.autoDestroy : true;
|
|
40845
|
+
this._writeLegacyIpcFormat = typeof options.writeLegacyIpcFormat === "boolean" ? options.writeLegacyIpcFormat : false;
|
|
40846
|
+
if (options.compressionType != null) {
|
|
40847
40847
|
if (this._writeLegacyIpcFormat) {
|
|
40848
40848
|
throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");
|
|
40849
40849
|
}
|
|
40850
|
-
if (Object.values(CompressionType).includes(
|
|
40851
|
-
this._compression = new BodyCompression2(
|
|
40850
|
+
if (Object.values(CompressionType).includes(options.compressionType)) {
|
|
40851
|
+
this._compression = new BodyCompression2(options.compressionType);
|
|
40852
40852
|
} else {
|
|
40853
40853
|
const validCompressionTypes = Object.values(CompressionType).filter((v) => typeof v === "string");
|
|
40854
|
-
throw new Error(`Unsupported compressionType: ${
|
|
40854
|
+
throw new Error(`Unsupported compressionType: ${options.compressionType} Available types: ${validCompressionTypes.join(", ")}`);
|
|
40855
40855
|
}
|
|
40856
40856
|
} else {
|
|
40857
40857
|
this._compression = null;
|
|
@@ -40877,11 +40877,11 @@ return true;`);
|
|
|
40877
40877
|
[Symbol.asyncIterator]() {
|
|
40878
40878
|
return this._sink[Symbol.asyncIterator]();
|
|
40879
40879
|
}
|
|
40880
|
-
toDOMStream(
|
|
40881
|
-
return this._sink.toDOMStream(
|
|
40880
|
+
toDOMStream(options) {
|
|
40881
|
+
return this._sink.toDOMStream(options);
|
|
40882
40882
|
}
|
|
40883
|
-
toNodeStream(
|
|
40884
|
-
return this._sink.toNodeStream(
|
|
40883
|
+
toNodeStream(options) {
|
|
40884
|
+
return this._sink.toNodeStream(options);
|
|
40885
40885
|
}
|
|
40886
40886
|
close() {
|
|
40887
40887
|
return this.reset()._sink.close();
|
|
@@ -41089,8 +41089,8 @@ return true;`);
|
|
|
41089
41089
|
};
|
|
41090
41090
|
RecordBatchStreamWriter = class _RecordBatchStreamWriter extends RecordBatchWriter {
|
|
41091
41091
|
/** @nocollapse */
|
|
41092
|
-
static writeAll(input,
|
|
41093
|
-
const writer = new _RecordBatchStreamWriter(
|
|
41092
|
+
static writeAll(input, options) {
|
|
41093
|
+
const writer = new _RecordBatchStreamWriter(options);
|
|
41094
41094
|
if (isPromise(input)) {
|
|
41095
41095
|
return input.then((x) => writer.writeAll(x));
|
|
41096
41096
|
} else if (isAsyncIterable(input)) {
|
|
@@ -41101,8 +41101,8 @@ return true;`);
|
|
|
41101
41101
|
};
|
|
41102
41102
|
RecordBatchFileWriter = class _RecordBatchFileWriter extends RecordBatchWriter {
|
|
41103
41103
|
/** @nocollapse */
|
|
41104
|
-
static writeAll(input,
|
|
41105
|
-
const writer = new _RecordBatchFileWriter(
|
|
41104
|
+
static writeAll(input, options) {
|
|
41105
|
+
const writer = new _RecordBatchFileWriter(options);
|
|
41106
41106
|
if (isPromise(input)) {
|
|
41107
41107
|
return input.then((x) => writer.writeAll(x));
|
|
41108
41108
|
} else if (isAsyncIterable(input)) {
|
|
@@ -41110,8 +41110,8 @@ return true;`);
|
|
|
41110
41110
|
}
|
|
41111
41111
|
return writeAll(writer, input);
|
|
41112
41112
|
}
|
|
41113
|
-
constructor(
|
|
41114
|
-
super(
|
|
41113
|
+
constructor(options) {
|
|
41114
|
+
super(options);
|
|
41115
41115
|
this._autoDestroy = true;
|
|
41116
41116
|
this._writeLegacyIpcFormat = false;
|
|
41117
41117
|
}
|
|
@@ -41206,20 +41206,20 @@ return true;`);
|
|
|
41206
41206
|
});
|
|
41207
41207
|
|
|
41208
41208
|
// ../../node_modules/apache-arrow/io/whatwg/iterable.mjs
|
|
41209
|
-
function toDOMStream(source,
|
|
41209
|
+
function toDOMStream(source, options) {
|
|
41210
41210
|
if (isAsyncIterable(source)) {
|
|
41211
|
-
return asyncIterableAsReadableDOMStream(source,
|
|
41211
|
+
return asyncIterableAsReadableDOMStream(source, options);
|
|
41212
41212
|
}
|
|
41213
41213
|
if (isIterable(source)) {
|
|
41214
|
-
return iterableAsReadableDOMStream(source,
|
|
41214
|
+
return iterableAsReadableDOMStream(source, options);
|
|
41215
41215
|
}
|
|
41216
41216
|
throw new Error(`toDOMStream() must be called with an Iterable or AsyncIterable`);
|
|
41217
41217
|
}
|
|
41218
|
-
function iterableAsReadableDOMStream(source,
|
|
41218
|
+
function iterableAsReadableDOMStream(source, options) {
|
|
41219
41219
|
let it = null;
|
|
41220
|
-
const bm = (
|
|
41221
|
-
const hwm = (
|
|
41222
|
-
return new ReadableStream(Object.assign(Object.assign({},
|
|
41220
|
+
const bm = (options === null || options === void 0 ? void 0 : options.type) === "bytes" || false;
|
|
41221
|
+
const hwm = (options === null || options === void 0 ? void 0 : options.highWaterMark) || Math.pow(2, 24);
|
|
41222
|
+
return new ReadableStream(Object.assign(Object.assign({}, options), {
|
|
41223
41223
|
start(controller) {
|
|
41224
41224
|
next(controller, it || (it = source[Symbol.iterator]()));
|
|
41225
41225
|
},
|
|
@@ -41230,7 +41230,7 @@ return true;`);
|
|
|
41230
41230
|
(it === null || it === void 0 ? void 0 : it.return) && it.return();
|
|
41231
41231
|
it = null;
|
|
41232
41232
|
}
|
|
41233
|
-
}), Object.assign({ highWaterMark: bm ? hwm : void 0 },
|
|
41233
|
+
}), Object.assign({ highWaterMark: bm ? hwm : void 0 }, options));
|
|
41234
41234
|
function next(controller, it2) {
|
|
41235
41235
|
let buf;
|
|
41236
41236
|
let r = null;
|
|
@@ -41248,11 +41248,11 @@ return true;`);
|
|
|
41248
41248
|
controller.close();
|
|
41249
41249
|
}
|
|
41250
41250
|
}
|
|
41251
|
-
function asyncIterableAsReadableDOMStream(source,
|
|
41251
|
+
function asyncIterableAsReadableDOMStream(source, options) {
|
|
41252
41252
|
let it = null;
|
|
41253
|
-
const bm = (
|
|
41254
|
-
const hwm = (
|
|
41255
|
-
return new ReadableStream(Object.assign(Object.assign({},
|
|
41253
|
+
const bm = (options === null || options === void 0 ? void 0 : options.type) === "bytes" || false;
|
|
41254
|
+
const hwm = (options === null || options === void 0 ? void 0 : options.highWaterMark) || Math.pow(2, 24);
|
|
41255
|
+
return new ReadableStream(Object.assign(Object.assign({}, options), {
|
|
41256
41256
|
start(controller) {
|
|
41257
41257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41258
41258
|
yield next(controller, it || (it = source[Symbol.asyncIterator]()));
|
|
@@ -41269,7 +41269,7 @@ return true;`);
|
|
|
41269
41269
|
it = null;
|
|
41270
41270
|
});
|
|
41271
41271
|
}
|
|
41272
|
-
}), Object.assign({ highWaterMark: bm ? hwm : void 0 },
|
|
41272
|
+
}), Object.assign({ highWaterMark: bm ? hwm : void 0 }, options));
|
|
41273
41273
|
function next(controller, it2) {
|
|
41274
41274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41275
41275
|
let buf;
|
|
@@ -41298,8 +41298,8 @@ return true;`);
|
|
|
41298
41298
|
});
|
|
41299
41299
|
|
|
41300
41300
|
// ../../node_modules/apache-arrow/io/whatwg/builder.mjs
|
|
41301
|
-
function builderThroughDOMStream(
|
|
41302
|
-
return new BuilderTransform(
|
|
41301
|
+
function builderThroughDOMStream(options) {
|
|
41302
|
+
return new BuilderTransform(options);
|
|
41303
41303
|
}
|
|
41304
41304
|
var BuilderTransform, chunkLength, chunkByteLength;
|
|
41305
41305
|
var init_builder3 = __esm({
|
|
@@ -41307,11 +41307,11 @@ return true;`);
|
|
|
41307
41307
|
init_tslib_es6();
|
|
41308
41308
|
init_factories();
|
|
41309
41309
|
BuilderTransform = class {
|
|
41310
|
-
constructor(
|
|
41310
|
+
constructor(options) {
|
|
41311
41311
|
this._numChunks = 0;
|
|
41312
41312
|
this._finished = false;
|
|
41313
41313
|
this._bufferedSize = 0;
|
|
41314
|
-
const { ["readableStrategy"]: readableStrategy, ["writableStrategy"]: writableStrategy, ["queueingStrategy"]: queueingStrategy = "count" } =
|
|
41314
|
+
const { ["readableStrategy"]: readableStrategy, ["writableStrategy"]: writableStrategy, ["queueingStrategy"]: queueingStrategy = "count" } = options, builderOptions = __rest(options, ["readableStrategy", "writableStrategy", "queueingStrategy"]);
|
|
41315
41315
|
this._controller = null;
|
|
41316
41316
|
this._builder = makeBuilder(builderOptions);
|
|
41317
41317
|
this._getSize = queueingStrategy !== "bytes" ? chunkLength : chunkByteLength;
|
|
@@ -41808,8 +41808,8 @@ return true;`);
|
|
|
41808
41808
|
function convertArrowToSchema(arrowSchema) {
|
|
41809
41809
|
return serializeArrowSchema(arrowSchema);
|
|
41810
41810
|
}
|
|
41811
|
-
function convertSchemaToArrow(schema,
|
|
41812
|
-
return deserializeArrowSchema(schema,
|
|
41811
|
+
function convertSchemaToArrow(schema, options) {
|
|
41812
|
+
return deserializeArrowSchema(schema, options);
|
|
41813
41813
|
}
|
|
41814
41814
|
function serializeArrowSchema(arrowSchema) {
|
|
41815
41815
|
return {
|
|
@@ -41817,9 +41817,9 @@ return true;`);
|
|
|
41817
41817
|
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
41818
41818
|
};
|
|
41819
41819
|
}
|
|
41820
|
-
function deserializeArrowSchema(schema,
|
|
41820
|
+
function deserializeArrowSchema(schema, options) {
|
|
41821
41821
|
return new Schema2(
|
|
41822
|
-
schema.fields.map((field) => deserializeArrowField(field,
|
|
41822
|
+
schema.fields.map((field) => deserializeArrowField(field, options)),
|
|
41823
41823
|
deserializeArrowMetadata(schema.metadata)
|
|
41824
41824
|
);
|
|
41825
41825
|
}
|
|
@@ -41837,10 +41837,10 @@ return true;`);
|
|
|
41837
41837
|
metadata: serializeArrowMetadata(field.metadata)
|
|
41838
41838
|
};
|
|
41839
41839
|
}
|
|
41840
|
-
function deserializeArrowField(field,
|
|
41840
|
+
function deserializeArrowField(field, options) {
|
|
41841
41841
|
return new Field2(
|
|
41842
41842
|
field.name,
|
|
41843
|
-
deserializeArrowType(field.type,
|
|
41843
|
+
deserializeArrowType(field.type, options),
|
|
41844
41844
|
field.nullable,
|
|
41845
41845
|
deserializeArrowMetadata(field.metadata)
|
|
41846
41846
|
);
|
|
@@ -41866,7 +41866,7 @@ return true;`);
|
|
|
41866
41866
|
return "bool";
|
|
41867
41867
|
case Int_:
|
|
41868
41868
|
const intType = arrowType;
|
|
41869
|
-
return `${intType.isSigned ? "
|
|
41869
|
+
return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
|
|
41870
41870
|
case Int8:
|
|
41871
41871
|
return "int8";
|
|
41872
41872
|
case Int16:
|
|
@@ -42016,36 +42016,36 @@ return true;`);
|
|
|
42016
42016
|
throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
|
|
42017
42017
|
}
|
|
42018
42018
|
}
|
|
42019
|
-
function deserializeArrowType(dataType,
|
|
42019
|
+
function deserializeArrowType(dataType, options) {
|
|
42020
42020
|
if (typeof dataType === "object") {
|
|
42021
42021
|
switch (dataType.type) {
|
|
42022
42022
|
case "decimal":
|
|
42023
42023
|
return new Decimal2(dataType.scale, dataType.precision, dataType.bitWidth);
|
|
42024
42024
|
case "map": {
|
|
42025
42025
|
const children = dataType.children.map(
|
|
42026
|
-
(arrowField) => deserializeArrowField(arrowField,
|
|
42026
|
+
(arrowField) => deserializeArrowField(arrowField, options)
|
|
42027
42027
|
);
|
|
42028
|
-
return new Map_(children, dataType.keysSorted);
|
|
42028
|
+
return new Map_(children[0], dataType.keysSorted);
|
|
42029
42029
|
}
|
|
42030
42030
|
case "list": {
|
|
42031
|
-
const field = deserializeArrowField(dataType.children[0],
|
|
42031
|
+
const field = deserializeArrowField(dataType.children[0], options);
|
|
42032
42032
|
return new List2(field);
|
|
42033
42033
|
}
|
|
42034
42034
|
case "fixed-size-list": {
|
|
42035
|
-
const child = deserializeArrowField(dataType.children[0],
|
|
42035
|
+
const child = deserializeArrowField(dataType.children[0], options);
|
|
42036
42036
|
return new FixedSizeList2(dataType.listSize, child);
|
|
42037
42037
|
}
|
|
42038
42038
|
case "fixed-size-binary":
|
|
42039
42039
|
return new FixedSizeBinary2(dataType.byteWidth);
|
|
42040
42040
|
case "struct": {
|
|
42041
42041
|
const children = dataType.children.map(
|
|
42042
|
-
(arrowField) => deserializeArrowField(arrowField,
|
|
42042
|
+
(arrowField) => deserializeArrowField(arrowField, options)
|
|
42043
42043
|
);
|
|
42044
42044
|
return new Struct(children);
|
|
42045
42045
|
}
|
|
42046
42046
|
case "dictionary": {
|
|
42047
42047
|
return new Dictionary(
|
|
42048
|
-
deserializeArrowType(dataType.dictionary,
|
|
42048
|
+
deserializeArrowType(dataType.dictionary, options),
|
|
42049
42049
|
deserializeArrowDictionaryKeyType(dataType.indices),
|
|
42050
42050
|
dataType.id,
|
|
42051
42051
|
dataType.isOrdered
|
|
@@ -42059,7 +42059,7 @@ return true;`);
|
|
|
42059
42059
|
case "null":
|
|
42060
42060
|
return new Null2();
|
|
42061
42061
|
case "binary":
|
|
42062
|
-
return makeVariableWidthArrowType("BinaryView", new Binary2(),
|
|
42062
|
+
return makeVariableWidthArrowType("BinaryView", new Binary2(), options);
|
|
42063
42063
|
case "binary-view":
|
|
42064
42064
|
return makeRequiredArrowViewType("BinaryView");
|
|
42065
42065
|
case "bool":
|
|
@@ -42087,7 +42087,7 @@ return true;`);
|
|
|
42087
42087
|
case "float64":
|
|
42088
42088
|
return new Float64();
|
|
42089
42089
|
case "utf8":
|
|
42090
|
-
return makeVariableWidthArrowType("Utf8View", new Utf82(),
|
|
42090
|
+
return makeVariableWidthArrowType("Utf8View", new Utf82(), options);
|
|
42091
42091
|
case "utf8-view":
|
|
42092
42092
|
return makeRequiredArrowViewType("Utf8View");
|
|
42093
42093
|
case "date-day":
|
|
@@ -42130,8 +42130,8 @@ return true;`);
|
|
|
42130
42130
|
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
42131
42131
|
return Boolean(guard?.(arrowType));
|
|
42132
42132
|
}
|
|
42133
|
-
function makeVariableWidthArrowType(viewTypeName, fallbackType,
|
|
42134
|
-
const viewTypeMode =
|
|
42133
|
+
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
42134
|
+
const viewTypeMode = options?.viewTypes || "never";
|
|
42135
42135
|
if (viewTypeMode === "never") {
|
|
42136
42136
|
return fallbackType;
|
|
42137
42137
|
}
|
|
@@ -42354,9 +42354,9 @@ return true;`);
|
|
|
42354
42354
|
arrowSchema;
|
|
42355
42355
|
arrowBuilders;
|
|
42356
42356
|
length;
|
|
42357
|
-
constructor(schema,
|
|
42358
|
-
this.arrowSchema = convertSchemaToArrow(schema,
|
|
42359
|
-
this.schema =
|
|
42357
|
+
constructor(schema, options) {
|
|
42358
|
+
this.arrowSchema = convertSchemaToArrow(schema, options);
|
|
42359
|
+
this.schema = options?.viewTypes && options.viewTypes !== "never" ? convertArrowToSchema(this.arrowSchema) : schema;
|
|
42360
42360
|
this.arrowBuilders = this.arrowSchema.fields.map(
|
|
42361
42361
|
(field) => makeBuilder({ type: field.type, nullValues: [null] })
|
|
42362
42362
|
);
|
|
@@ -42408,7 +42408,7 @@ return true;`);
|
|
|
42408
42408
|
finishBatch() {
|
|
42409
42409
|
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
42410
42410
|
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
42411
|
-
if (arrowRecordBatch.numCols === 0) {
|
|
42411
|
+
if (arrowRecordBatch.numCols === 0 && arrowRecordBatch.numRows === 0) {
|
|
42412
42412
|
return null;
|
|
42413
42413
|
}
|
|
42414
42414
|
return {
|
|
@@ -42541,7 +42541,7 @@ return true;`);
|
|
|
42541
42541
|
"src/excel-loader.ts"() {
|
|
42542
42542
|
"use strict";
|
|
42543
42543
|
init_excel_format();
|
|
42544
|
-
VERSION = true ? "5.0.0-alpha.
|
|
42544
|
+
VERSION = true ? "5.0.0-alpha.3" : "latest";
|
|
42545
42545
|
ExcelWorkerLoader = {
|
|
42546
42546
|
...ExcelFormat,
|
|
42547
42547
|
dataType: null,
|
|
@@ -42585,10 +42585,10 @@ return true;`);
|
|
|
42585
42585
|
};
|
|
42586
42586
|
ExcelLoaderWithParser = {
|
|
42587
42587
|
...ExcelLoaderMetadataWithoutPreload,
|
|
42588
|
-
async parse(arrayBuffer,
|
|
42588
|
+
async parse(arrayBuffer, options) {
|
|
42589
42589
|
const excelOptions = {
|
|
42590
|
-
...
|
|
42591
|
-
excel: { ...ExcelLoaderWithParser.options.excel, ...
|
|
42590
|
+
...options,
|
|
42591
|
+
excel: { ...ExcelLoaderWithParser.options.excel, ...options?.excel }
|
|
42592
42592
|
};
|
|
42593
42593
|
const rows = parseExcel(arrayBuffer, excelOptions);
|
|
42594
42594
|
if (excelOptions.excel?.shape === "arrow-table") {
|
|
@@ -42671,18 +42671,18 @@ return true;`);
|
|
|
42671
42671
|
static async addEventListener(onMessage) {
|
|
42672
42672
|
let onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
42673
42673
|
if (!onMessageWrapper) {
|
|
42674
|
-
onMessageWrapper =
|
|
42675
|
-
|
|
42674
|
+
onMessageWrapper = (message) => {
|
|
42675
|
+
const messageData = getWorkerMessageData(message);
|
|
42676
|
+
if (!messageData) {
|
|
42676
42677
|
return;
|
|
42677
42678
|
}
|
|
42678
|
-
|
|
42679
|
-
const { type, payload } = parentPort3 ? message : message.data;
|
|
42680
|
-
onMessage(type, payload);
|
|
42679
|
+
onMessage(messageData.type, messageData.payload);
|
|
42681
42680
|
};
|
|
42681
|
+
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
42682
42682
|
}
|
|
42683
42683
|
const parentPort2 = await getParentPort();
|
|
42684
42684
|
if (parentPort2) {
|
|
42685
|
-
|
|
42685
|
+
parentPort2.on("message", onMessageWrapper);
|
|
42686
42686
|
} else {
|
|
42687
42687
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
42688
42688
|
}
|
|
@@ -42690,9 +42690,12 @@ return true;`);
|
|
|
42690
42690
|
static async removeEventListener(onMessage) {
|
|
42691
42691
|
const onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
42692
42692
|
onMessageWrapperMap.delete(onMessage);
|
|
42693
|
+
if (!onMessageWrapper) {
|
|
42694
|
+
return;
|
|
42695
|
+
}
|
|
42693
42696
|
const parentPort2 = await getParentPort();
|
|
42694
42697
|
if (parentPort2) {
|
|
42695
|
-
|
|
42698
|
+
parentPort2.off("message", onMessageWrapper);
|
|
42696
42699
|
} else {
|
|
42697
42700
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
42698
42701
|
}
|
|
@@ -42713,9 +42716,12 @@ return true;`);
|
|
|
42713
42716
|
}
|
|
42714
42717
|
}
|
|
42715
42718
|
};
|
|
42716
|
-
function
|
|
42717
|
-
|
|
42718
|
-
|
|
42719
|
+
function getWorkerMessageData(message) {
|
|
42720
|
+
if (!message || typeof message !== "object") {
|
|
42721
|
+
return null;
|
|
42722
|
+
}
|
|
42723
|
+
const messageData = "data" in message && message.type === "message" ? message.data : message;
|
|
42724
|
+
return messageData && typeof messageData.source === "string" && messageData.source.startsWith("loaders.gl") ? messageData : null;
|
|
42719
42725
|
}
|
|
42720
42726
|
|
|
42721
42727
|
// ../worker-utils/src/lib/async-queue/async-queue.ts
|
|
@@ -42790,8 +42796,8 @@ return true;`);
|
|
|
42790
42796
|
|
|
42791
42797
|
// ../worker-utils/src/lib/worker-api/create-worker.ts
|
|
42792
42798
|
var requestId = 0;
|
|
42793
|
-
var
|
|
42794
|
-
var
|
|
42799
|
+
var activeInputBatches = null;
|
|
42800
|
+
var activeOutputAcknowledgements = null;
|
|
42795
42801
|
async function createWorker(process2, processInBatches) {
|
|
42796
42802
|
if (!await WorkerBody.inWorkerThread()) {
|
|
42797
42803
|
return;
|
|
@@ -42821,24 +42827,44 @@ return true;`);
|
|
|
42821
42827
|
if (!processInBatches) {
|
|
42822
42828
|
throw new Error("Worker does not support batched processing");
|
|
42823
42829
|
}
|
|
42824
|
-
inputBatches = new AsyncQueue();
|
|
42825
|
-
|
|
42826
|
-
|
|
42827
|
-
|
|
42828
|
-
|
|
42829
|
-
|
|
42830
|
-
|
|
42831
|
-
|
|
42832
|
-
|
|
42833
|
-
|
|
42830
|
+
const inputBatches = new AsyncQueue();
|
|
42831
|
+
const outputAcknowledgements = new AsyncQueue();
|
|
42832
|
+
activeInputBatches = inputBatches;
|
|
42833
|
+
activeOutputAcknowledgements = outputAcknowledgements;
|
|
42834
|
+
try {
|
|
42835
|
+
const resultIterator = processInBatches(
|
|
42836
|
+
createDemandDrivenIterator(inputBatches),
|
|
42837
|
+
payload.options || {},
|
|
42838
|
+
context,
|
|
42839
|
+
payload.context || {}
|
|
42840
|
+
);
|
|
42841
|
+
for await (const batch of resultIterator) {
|
|
42842
|
+
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
42843
|
+
await outputAcknowledgements.next();
|
|
42844
|
+
}
|
|
42845
|
+
await WorkerBody.postMessage("done", {});
|
|
42846
|
+
} finally {
|
|
42847
|
+
activeInputBatches = null;
|
|
42848
|
+
activeOutputAcknowledgements = null;
|
|
42834
42849
|
}
|
|
42835
|
-
WorkerBody.postMessage("done", {});
|
|
42836
42850
|
break;
|
|
42837
42851
|
case "input-batch":
|
|
42838
|
-
|
|
42852
|
+
if (!activeInputBatches) {
|
|
42853
|
+
throw new Error("Worker has no active batched processing session");
|
|
42854
|
+
}
|
|
42855
|
+
activeInputBatches.push(payload.input);
|
|
42839
42856
|
break;
|
|
42840
42857
|
case "input-done":
|
|
42841
|
-
|
|
42858
|
+
if (!activeInputBatches) {
|
|
42859
|
+
throw new Error("Worker has no active batched processing session");
|
|
42860
|
+
}
|
|
42861
|
+
activeInputBatches.close();
|
|
42862
|
+
break;
|
|
42863
|
+
case "output-ack":
|
|
42864
|
+
if (!activeOutputAcknowledgements) {
|
|
42865
|
+
throw new Error("Worker has no active batched processing session");
|
|
42866
|
+
}
|
|
42867
|
+
activeOutputAcknowledgements.push(void 0);
|
|
42842
42868
|
break;
|
|
42843
42869
|
default:
|
|
42844
42870
|
}
|
|
@@ -42848,7 +42874,17 @@ return true;`);
|
|
|
42848
42874
|
}
|
|
42849
42875
|
};
|
|
42850
42876
|
}
|
|
42851
|
-
function
|
|
42877
|
+
async function* createDemandDrivenIterator(inputBatches) {
|
|
42878
|
+
while (true) {
|
|
42879
|
+
await WorkerBody.postMessage("input-request", {});
|
|
42880
|
+
const nextBatch = await inputBatches.next();
|
|
42881
|
+
if (nextBatch.done) {
|
|
42882
|
+
return;
|
|
42883
|
+
}
|
|
42884
|
+
yield nextBatch.value;
|
|
42885
|
+
}
|
|
42886
|
+
}
|
|
42887
|
+
function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
|
|
42852
42888
|
return new Promise((resolve, reject) => {
|
|
42853
42889
|
const id = requestId++;
|
|
42854
42890
|
const onMessage = (type, payload2) => {
|
|
@@ -42868,7 +42904,7 @@ return true;`);
|
|
|
42868
42904
|
}
|
|
42869
42905
|
};
|
|
42870
42906
|
WorkerBody.addEventListener(onMessage);
|
|
42871
|
-
const payload = { id, input: arrayBuffer, options
|
|
42907
|
+
const payload = { id, input: arrayBuffer, options, context: jobContext };
|
|
42872
42908
|
WorkerBody.postMessage("process", payload);
|
|
42873
42909
|
});
|
|
42874
42910
|
}
|
|
@@ -42876,21 +42912,22 @@ return true;`);
|
|
|
42876
42912
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
42877
42913
|
async function createLoaderWorker(loader) {
|
|
42878
42914
|
await createWorker(
|
|
42879
|
-
|
|
42880
|
-
const result = await parseData({
|
|
42881
|
-
loader,
|
|
42882
|
-
arrayBuffer: input,
|
|
42883
|
-
options: options2,
|
|
42884
|
-
context: {
|
|
42885
|
-
...loaderContext,
|
|
42886
|
-
coreApi: createWorkerCoreApi(),
|
|
42887
|
-
_parse: createParseOnMainThread(workerContext?.process)
|
|
42888
|
-
}
|
|
42889
|
-
});
|
|
42890
|
-
return loader.serializeWorkerResult ? loader.serializeWorkerResult(result, options2, loaderContext) : result;
|
|
42891
|
-
}
|
|
42915
|
+
(input, options, workerContext, loaderContext) => processLoaderWorkerData(loader, input, options, workerContext, loaderContext)
|
|
42892
42916
|
);
|
|
42893
42917
|
}
|
|
42918
|
+
async function processLoaderWorkerData(loader, input, options = {}, workerContext, loaderContext = {}) {
|
|
42919
|
+
const result = await parseData({
|
|
42920
|
+
loader,
|
|
42921
|
+
arrayBuffer: input,
|
|
42922
|
+
options,
|
|
42923
|
+
context: {
|
|
42924
|
+
...loaderContext,
|
|
42925
|
+
coreApi: createWorkerCoreApi(),
|
|
42926
|
+
_parse: createParseOnMainThread(workerContext?.process)
|
|
42927
|
+
}
|
|
42928
|
+
});
|
|
42929
|
+
return loader.serializeWorkerResult ? loader.serializeWorkerResult(result, options, loaderContext) : result;
|
|
42930
|
+
}
|
|
42894
42931
|
function createWorkerCoreApi() {
|
|
42895
42932
|
const unavailable = (methodName) => () => {
|
|
42896
42933
|
throw new Error(`context.coreApi.${methodName} is unavailable inside worker loaders.`);
|
|
@@ -42906,17 +42943,17 @@ return true;`);
|
|
|
42906
42943
|
};
|
|
42907
42944
|
}
|
|
42908
42945
|
function createParseOnMainThread(processOnMainThread2) {
|
|
42909
|
-
return (arrayBuffer, loaders,
|
|
42946
|
+
return (arrayBuffer, loaders, options, context) => {
|
|
42910
42947
|
if (!processOnMainThread2) {
|
|
42911
42948
|
throw new Error("Worker not set up to parse on main thread");
|
|
42912
42949
|
}
|
|
42913
|
-
const parseArguments = getMainThreadParseArguments(loaders,
|
|
42950
|
+
const parseArguments = getMainThreadParseArguments(loaders, options, context);
|
|
42914
42951
|
return processOnMainThread2(arrayBuffer, parseArguments.options, parseArguments.context);
|
|
42915
42952
|
};
|
|
42916
42953
|
}
|
|
42917
|
-
function getMainThreadParseArguments(loaders,
|
|
42918
|
-
if (
|
|
42919
|
-
return { options
|
|
42954
|
+
function getMainThreadParseArguments(loaders, options, context) {
|
|
42955
|
+
if (options) {
|
|
42956
|
+
return { options, context: getSerializableLoaderContext(context) };
|
|
42920
42957
|
}
|
|
42921
42958
|
if (Array.isArray(loaders) || loaders && isLoaderObject(loaders)) {
|
|
42922
42959
|
return { options: void 0, context: getSerializableLoaderContext(context) };
|
|
@@ -42939,7 +42976,7 @@ return true;`);
|
|
|
42939
42976
|
async function parseData({
|
|
42940
42977
|
loader,
|
|
42941
42978
|
arrayBuffer,
|
|
42942
|
-
options
|
|
42979
|
+
options,
|
|
42943
42980
|
context
|
|
42944
42981
|
}) {
|
|
42945
42982
|
let data;
|
|
@@ -42954,15 +42991,18 @@ return true;`);
|
|
|
42954
42991
|
} else {
|
|
42955
42992
|
throw new Error(`Could not load data with ${loader.name} loader`);
|
|
42956
42993
|
}
|
|
42957
|
-
|
|
42958
|
-
...
|
|
42959
|
-
modules:
|
|
42994
|
+
options = {
|
|
42995
|
+
...options,
|
|
42996
|
+
modules: {
|
|
42997
|
+
...loader && loader.options && loader.options.modules || {},
|
|
42998
|
+
...options.modules || {}
|
|
42999
|
+
},
|
|
42960
43000
|
core: {
|
|
42961
|
-
...
|
|
43001
|
+
...options.core,
|
|
42962
43002
|
worker: false
|
|
42963
43003
|
}
|
|
42964
43004
|
};
|
|
42965
|
-
return await parser(data, { ...
|
|
43005
|
+
return await parser(data, { ...options }, context, loader);
|
|
42966
43006
|
}
|
|
42967
43007
|
|
|
42968
43008
|
// src/workers/excel-worker.ts
|