@extend-ai/react-xlsx 0.10.2 → 0.10.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/README.md +63 -0
- package/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +58 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +56 -7
- package/dist/index.js.map +1 -1
- package/dist/xlsx-worker.js +43 -4
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +5 -3
package/dist/xlsx-worker.js
CHANGED
|
@@ -4411,13 +4411,46 @@ function safeCalculate(workbook2, options = {}) {
|
|
|
4411
4411
|
|
|
4412
4412
|
// src/wasm.ts
|
|
4413
4413
|
var wasmModulePromise = null;
|
|
4414
|
+
var hasConfiguredWasmSource = false;
|
|
4415
|
+
var configuredWasmSource;
|
|
4416
|
+
var configuredWorkerWasmSource;
|
|
4417
|
+
function bufferSourceToArrayBuffer(source) {
|
|
4418
|
+
if (source instanceof ArrayBuffer) {
|
|
4419
|
+
return source.slice(0);
|
|
4420
|
+
}
|
|
4421
|
+
const bytes = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
4422
|
+
const copy = new Uint8Array(bytes);
|
|
4423
|
+
return copy.buffer;
|
|
4424
|
+
}
|
|
4425
|
+
function sourceToWorkerSource(source) {
|
|
4426
|
+
if (typeof source === "string") {
|
|
4427
|
+
return source;
|
|
4428
|
+
}
|
|
4429
|
+
if (typeof URL !== "undefined" && source instanceof URL) {
|
|
4430
|
+
return source.href;
|
|
4431
|
+
}
|
|
4432
|
+
if (typeof Request !== "undefined" && source instanceof Request) {
|
|
4433
|
+
return source.url;
|
|
4434
|
+
}
|
|
4435
|
+
if (source instanceof ArrayBuffer || ArrayBuffer.isView(source)) {
|
|
4436
|
+
return bufferSourceToArrayBuffer(source);
|
|
4437
|
+
}
|
|
4438
|
+
if (typeof WebAssembly !== "undefined" && source instanceof WebAssembly.Module) {
|
|
4439
|
+
return source;
|
|
4440
|
+
}
|
|
4441
|
+
return void 0;
|
|
4442
|
+
}
|
|
4443
|
+
function setWasmSource(source) {
|
|
4444
|
+
hasConfiguredWasmSource = true;
|
|
4445
|
+
configuredWasmSource = source;
|
|
4446
|
+
configuredWorkerWasmSource = sourceToWorkerSource(source);
|
|
4447
|
+
}
|
|
4414
4448
|
function getSheetsWasmModule() {
|
|
4415
4449
|
if (!wasmModulePromise) {
|
|
4416
4450
|
wasmModulePromise = import("@dukelib/sheets-wasm").then(async (mod) => {
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
} catch {
|
|
4451
|
+
if (configuredWasmSource !== void 0) {
|
|
4452
|
+
await mod.default(configuredWasmSource);
|
|
4453
|
+
} else {
|
|
4421
4454
|
await mod.default();
|
|
4422
4455
|
}
|
|
4423
4456
|
return mod;
|
|
@@ -4860,9 +4893,15 @@ function respond(message) {
|
|
|
4860
4893
|
async function handleMessage(message) {
|
|
4861
4894
|
switch (message.type) {
|
|
4862
4895
|
case "load": {
|
|
4896
|
+
if (message.payload.wasmSource !== void 0) {
|
|
4897
|
+
setWasmSource(message.payload.wasmSource);
|
|
4898
|
+
}
|
|
4863
4899
|
return loadWorkbook(message.payload.buffer, message.payload.skipXmlParsing, message.payload.showHiddenSheets);
|
|
4864
4900
|
}
|
|
4865
4901
|
case "parseCharts": {
|
|
4902
|
+
if (message.payload.wasmSource !== void 0) {
|
|
4903
|
+
setWasmSource(message.payload.wasmSource);
|
|
4904
|
+
}
|
|
4866
4905
|
return parseCharts(message.payload.buffer, message.payload.skipXmlParsing, message.payload.showHiddenSheets);
|
|
4867
4906
|
}
|
|
4868
4907
|
case "getCellSnapshot": {
|