excelsaurus 0.1.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/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/astro.d.ts +44 -0
- package/dist/astro.js +90 -0
- package/dist/astro.js.map +1 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/react.d.ts +77 -0
- package/dist/react.js +3 -0
- package/dist/react.js.map +1 -0
- package/dist/types-C2-m7DtR.d.ts +114 -0
- package/dist/worker.d.ts +68 -0
- package/dist/worker.js +37 -0
- package/dist/worker.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../pkg/excelsaurus.js","../src/core.ts","../src/streaming.ts","../src/utils.ts"],"names":["excelsaurus_exports","__export","__wbg_init","getSheetNames","init","initSync","parseExcel","data","retptr","wasm","ptr0","passArray8ToWasm0","len0","WASM_VECTOR_LEN","r0","getDataViewMemory0","r1","r2","takeObject","options","addHeapObject","__wbg_get_imports","arg0","arg1","ret","getStringFromWasm0","getObject","ptr1","passStringToWasm0","len1","v","isLikeNone","debugString","val","obj","deferred0_0","deferred0_1","result","arg2","getArrayU8FromWasm0","heap_next","heap","idx","type","description","name","length","debug","builtInMatches","className","dropObject","ptr","len","getUint8ArrayMemory0","cachedDataViewMemory0","decodeText","cachedUint8ArrayMemory0","x","arg","malloc","realloc","buf","cachedTextEncoder","mem","offset","code","view","numBytesDecoded","MAX_SAFARI_DECODE_BYTES","cachedTextDecoder","__wbg_finalize_init","instance","module","__wbg_load","imports","e","expectedResponseType","bytes","module_or_path","init_excelsaurus","__esmMin","wasmModule","initPromise","initWasm","mod","getWasm","input","toUint8Array","parseExcelWithSchema","schema","rawResult","errors","row","rowErrors","field","colIndex","columnLetterToIndex","value","validateType","validatorError","runValidator","buffer","letter","upper","i","expectedType","validator","str","createExcelStream","chunkSize","totalRows","totalChunks","currentChunk","rowsProcessed","startIdx","endIdx","rows","isLast","progress","chunk","fileToArrayBuffer","file","isExcelFile","filename","ext","getFileExtension","parts"],"mappings":"AAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAAA,CAAAA,CAAA,EAAA,CAAAC,CAAAA,CAAAD,CAAAA,CAAA,CAAA,OAAA,CAAA,IAAAE,EAAAA,CAAA,aAAA,CAAA,IAAAC,CAAAA,CAAA,IAAA,CAAA,IAAAC,CAAAA,CAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,CAAAA,CAAAA,CAAAA,CAaO,SAASH,CAAAA,CAAcI,CAAAA,CAAM,CAChC,GAAI,CACA,IAAMC,CAAAA,CAASC,CAAAA,CAAK,+BAAA,CAAgC,CAAA,EAAG,CAAA,CACjDC,CAAAA,CAAOC,CAAAA,CAAkBJ,CAAAA,CAAME,CAAAA,CAAK,iBAAiB,CAAA,CACrDG,CAAAA,CAAOC,CAAAA,CACbJ,CAAAA,CAAK,aAAA,CAAcD,CAAAA,CAAQE,CAAAA,CAAME,CAAI,CAAA,CACrC,IAAIE,CAAAA,CAAKC,CAAAA,EAAmB,CAAE,QAAA,CAASP,CAAAA,CAAS,CAAA,CAAO,CAAA,CAAI,CAAA,CACvDQ,CAAAA,CAAKD,CAAAA,EAAmB,CAAE,QAAA,CAASP,CAAAA,CAAS,CAAA,CAAO,CA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A,CAAQ,KAAK,CAAA,CAAE,QAAA,CAASC,CAAG,CAC3E,CAKO,SAASC,CAAAA,CAAiBF,EAA0B,CACzD,IAAMG,CAAAA,CAAQH,CAAAA,CAAS,MAAM,GAAG,CAAA,CAChC,OAAOG,CAAAA,CAAM,OAAS,CAAA,CAAIA,CAAAA,CAAMA,EAAM,MAAA,CAAS,CAAC,EAAI,EACtD","file":"index.js","sourcesContent":["/* @ts-self-types=\"./excelsaurus.d.ts\" */\n\n/**\n * Get list of sheet names in the workbook\n *\n * # Arguments\n * * `data` - Raw bytes of the Excel file\n *\n * # Returns\n * * `Vec<String>` - List of sheet names\n * @param {Uint8Array} data\n * @returns {any}\n */\nexport function getSheetNames(data) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.getSheetNames(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Initialize panic hook for better error messages in browser console\n */\nexport function init() {\n wasm.init();\n}\n\n/**\n * Parse an Excel file from bytes\n *\n * # Arguments\n * * `data` - Raw bytes of the Excel file\n * * `options` - Parse options (optional)\n *\n * # Returns\n * * `JsValue` - Parsed result as JavaScript object\n * @param {Uint8Array} data\n * @param {any} options\n * @returns {any}\n */\nexport function parseExcel(data, options) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.parseExcel(retptr, ptr0, len0, addHeapObject(options));\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n },\n __wbg_Number_04624de7d0e8332d: function(arg0) {\n const ret = Number(getObject(arg0));\n return ret;\n },\n __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {\n const ret = String(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {\n const v = getObject(arg1);\n const ret = typeof(v) === 'bigint' ? v : undefined;\n getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {\n const v = getObject(arg0);\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n },\n __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {\n const ret = getObject(arg0) in getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'bigint';\n return ret;\n },\n __wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {\n const ret = getObject(arg0) === null;\n return ret;\n },\n __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {\n const val = getObject(arg0);\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n },\n __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {\n const ret = getObject(arg0) === undefined;\n return ret;\n },\n __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {\n const ret = getObject(arg0) === getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {\n const ret = getObject(arg0) == getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'number' ? obj : undefined;\n getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'string' ? obj : undefined;\n var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {\n let deferred0_0;\n let deferred0_1;\n try {\n deferred0_0 = arg0;\n deferred0_1 = arg1;\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);\n }\n },\n __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {\n const ret = getObject(arg0)[getObject(arg1)];\n return addHeapObject(ret);\n },\n __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof ArrayBuffer;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Uint8Array;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {\n const ret = Number.isSafeInteger(getObject(arg0));\n return ret;\n },\n __wbg_length_32ed9a279acd054c: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_new_361308b2356cecd0: function() {\n const ret = new Object();\n return addHeapObject(ret);\n },\n __wbg_new_3eb36ae241fe6f44: function() {\n const ret = new Array();\n return addHeapObject(ret);\n },\n __wbg_new_8a6f238a6ece86ea: function() {\n const ret = new Error();\n return addHeapObject(ret);\n },\n __wbg_new_dd2b680c8bf6ae29: function(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));\n },\n __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {\n getObject(arg0)[takeObject(arg1)] = takeObject(arg2);\n },\n __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {\n getObject(arg0)[arg1 >>> 0] = takeObject(arg2);\n },\n __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {\n const ret = getObject(arg1).stack;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbindgen_cast_0000000000000001: function(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000002: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000003: function(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_clone_ref: function(arg0) {\n const ret = getObject(arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_drop_ref: function(arg0) {\n takeObject(arg0);\n },\n };\n return {\n __proto__: null,\n \"./excelsaurus_bg.js\": import0,\n };\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(128).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('excelsaurus_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n","/**\n * Core parsing functions\n */\n\nimport type { ParseOptions, ParseResult, Schema, SchemaParseResult, CellValue } from \"./types\";\n\n// Wasm module instance\nlet wasmModule: typeof import(\"../pkg/excelsaurus\") | null = null;\nlet initPromise: Promise<void> | null = null;\n\n/**\n * Initialize the Wasm module\n * This is called automatically on first use\n */\nasync function initWasm(): Promise<void> {\n if (wasmModule) return;\n\n if (!initPromise) {\n initPromise = (async () => {\n // Dynamic import of wasm module\n const mod = await import(\"../pkg/excelsaurus\");\n await mod.default();\n wasmModule = mod;\n })();\n }\n\n await initPromise;\n}\n\n/**\n * Ensure wasm is initialized and get the module\n */\nasync function getWasm() {\n await initWasm();\n if (!wasmModule) {\n throw new Error(\"Failed to initialize ExcelSaurus Wasm module\");\n }\n return wasmModule;\n}\n\n/**\n * Parse an Excel file and return raw data\n *\n * @example\n * ```ts\n * const file = event.target.files[0];\n * const result = await parseExcel(file);\n * console.log(result.rows);\n * ```\n */\nexport async function parseExcel(\n input: File | ArrayBuffer | Uint8Array,\n options: ParseOptions = {}\n): Promise<ParseResult> {\n const wasm = await getWasm();\n const bytes = await toUint8Array(input);\n\n const result = wasm.parseExcel(bytes, {\n sheet: options.sheet?.toString(),\n limit: options.limit,\n skipRows: options.skipRows,\n hasHeaders: options.hasHeaders,\n });\n\n return result as ParseResult;\n}\n\n/**\n * Parse an Excel file with schema validation\n *\n * @example\n * ```ts\n * const result = await parseExcelWithSchema(file, {\n * fields: [\n * { name: 'name', column: 0, type: 'string', required: true },\n * { name: 'email', column: 1, type: 'string', validate: 'email' },\n * { name: 'age', column: 2, type: 'number' },\n * ]\n * });\n * console.log(result.data);\n * ```\n */\nexport async function parseExcelWithSchema<T extends Record<string, CellValue>>(\n input: File | ArrayBuffer | Uint8Array,\n schema: Schema,\n options: ParseOptions = {}\n): Promise<SchemaParseResult<T>> {\n // First, parse the raw data\n const rawResult = await parseExcel(input, options);\n\n // Then apply schema validation in JS\n // (This will be moved to Rust in a future version for better performance)\n const data: T[] = [];\n const errors: { valid: boolean; rowIndex: number; errors: { field: string; message: string; value?: string }[] }[] = [];\n\n for (let i = 0; i < rawResult.rows.length; i++) {\n const row = rawResult.rows[i];\n const obj: Record<string, CellValue> = {};\n const rowErrors: { field: string; message: string; value?: string }[] = [];\n\n for (const field of schema.fields) {\n const colIndex = typeof field.column === \"number\" \n ? field.column \n : columnLetterToIndex(field.column);\n \n let value = row[colIndex] ?? null;\n\n // Apply default if empty\n if ((value === null || value === \"\") && field.default !== undefined) {\n value = field.default;\n }\n\n // Check required\n if (field.required && (value === null || value === \"\")) {\n rowErrors.push({\n field: field.name,\n message: \"Field is required\",\n });\n continue;\n }\n\n // Validate type (basic)\n if (value !== null && value !== \"\") {\n const typeValid = validateType(value, field.type);\n if (!typeValid) {\n rowErrors.push({\n field: field.name,\n message: `Expected ${field.type}, got ${typeof value}`,\n value: String(value),\n });\n }\n\n // Run validator\n if (field.validate) {\n const validatorError = runValidator(field.validate, value);\n if (validatorError) {\n rowErrors.push({\n field: field.name,\n message: validatorError,\n value: String(value),\n });\n }\n }\n }\n\n obj[field.name] = value;\n }\n\n if (rowErrors.length > 0) {\n errors.push({ valid: false, rowIndex: i, errors: rowErrors });\n if (!schema.skipInvalid) {\n continue;\n }\n }\n\n data.push(obj as T);\n }\n\n return {\n data,\n errors: errors.length > 0 ? errors : undefined,\n rowCount: data.length,\n sheetName: rawResult.sheetName,\n };\n}\n\n/**\n * Get list of sheet names in a workbook\n */\nexport async function getSheetNames(\n input: File | ArrayBuffer | Uint8Array\n): Promise<string[]> {\n const wasm = await getWasm();\n const bytes = await toUint8Array(input);\n return wasm.getSheetNames(bytes) as string[];\n}\n\n// Helper functions\n\nasync function toUint8Array(input: File | ArrayBuffer | Uint8Array): Promise<Uint8Array> {\n if (input instanceof Uint8Array) {\n return input;\n }\n if (input instanceof ArrayBuffer) {\n return new Uint8Array(input);\n }\n // File\n const buffer = await input.arrayBuffer();\n return new Uint8Array(buffer);\n}\n\nfunction columnLetterToIndex(letter: string): number {\n const upper = letter.toUpperCase();\n let result = 0;\n for (let i = 0; i < upper.length; i++) {\n result = result * 26 + (upper.charCodeAt(i) - 64);\n }\n return result - 1;\n}\n\nfunction validateType(value: CellValue, expectedType: string): boolean {\n if (expectedType === \"any\") return true;\n \n switch (expectedType) {\n case \"string\":\n return typeof value === \"string\" || typeof value === \"number\";\n case \"number\":\n case \"integer\":\n return typeof value === \"number\";\n case \"boolean\":\n return typeof value === \"boolean\";\n case \"date\":\n case \"datetime\":\n return typeof value === \"string\"; // Dates are strings from Excel\n default:\n return true;\n }\n}\n\nfunction runValidator(validator: string, value: CellValue): string | null {\n const str = String(value);\n \n switch (validator.toLowerCase()) {\n case \"email\":\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(str) ? null : \"Invalid email format\";\n case \"phone\":\n return /^\\+?[0-9\\s\\-()]{7,20}$/.test(str) ? null : \"Invalid phone number\";\n case \"url\":\n return /^https?:\\/\\/[^\\s]+$/.test(str) ? null : \"Invalid URL\";\n case \"nonempty\":\n return str.trim() !== \"\" ? null : \"Value cannot be empty\";\n default:\n return null;\n }\n}\n","/**\n * Streaming API for large Excel files\n */\n\nimport type { StreamOptions, StreamProgress, RowChunk, CellValue } from \"./types\";\nimport { parseExcel } from \"./core\";\n\n/**\n * Create an async iterator for streaming Excel data\n *\n * @example\n * ```ts\n * const stream = await createExcelStream(file, {\n * chunkSize: 1000,\n * onProgress: (p) => console.log(`${p.percent}%`)\n * });\n *\n * for await (const chunk of stream) {\n * await processChunk(chunk.rows);\n * }\n * ```\n */\nexport async function createExcelStream(\n input: File | ArrayBuffer | Uint8Array,\n options: StreamOptions = {}\n): Promise<AsyncIterable<RowChunk>> {\n const chunkSize = options.chunkSize ?? 1000;\n\n // For now, parse all data and chunk it\n // In future, this will use true streaming from Rust\n const result = await parseExcel(input, {\n sheet: options.sheet,\n skipRows: options.skipRows,\n hasHeaders: options.hasHeaders,\n });\n\n const totalRows = result.rows.length;\n const totalChunks = Math.ceil(totalRows / chunkSize);\n\n return {\n [Symbol.asyncIterator](): AsyncIterator<RowChunk> {\n let currentChunk = 0;\n let rowsProcessed = 0;\n\n return {\n async next(): Promise<IteratorResult<RowChunk>> {\n if (currentChunk >= totalChunks) {\n return { done: true, value: undefined };\n }\n\n const startIdx = currentChunk * chunkSize;\n const endIdx = Math.min(startIdx + chunkSize, totalRows);\n const rows = result.rows.slice(startIdx, endIdx);\n\n rowsProcessed += rows.length;\n const isLast = currentChunk === totalChunks - 1;\n\n // Call progress callback\n if (options.onProgress) {\n const progress: StreamProgress = {\n rowsProcessed,\n totalRows,\n percent: Math.round((rowsProcessed / totalRows) * 100),\n chunkNumber: currentChunk + 1,\n };\n options.onProgress(progress);\n }\n\n const chunk: RowChunk = {\n rows,\n chunkIndex: currentChunk,\n isLast,\n };\n\n currentChunk++;\n return { done: false, value: chunk };\n },\n };\n },\n };\n}\n\n/**\n * Collect all chunks from a stream into a single array\n * Useful for testing or when you need all data at once\n */\nexport async function collectStream(\n stream: AsyncIterable<RowChunk>\n): Promise<CellValue[][]> {\n const allRows: CellValue[][] = [];\n for await (const chunk of stream) {\n allRows.push(...chunk.rows);\n }\n return allRows;\n}\n","/**\n * Utility functions\n */\n\n/**\n * Convert a File to ArrayBuffer\n */\nexport async function fileToArrayBuffer(file: File): Promise<ArrayBuffer> {\n return file.arrayBuffer();\n}\n\n/**\n * Check if a file is an Excel file based on extension\n */\nexport function isExcelFile(filename: string): boolean {\n const ext = getFileExtension(filename).toLowerCase();\n return [\"xlsx\", \"xls\", \"xlsm\", \"xlsb\", \"xla\", \"xlam\", \"ods\"].includes(ext);\n}\n\n/**\n * Get file extension from filename\n */\nexport function getFileExtension(filename: string): string {\n const parts = filename.split(\".\");\n return parts.length > 1 ? parts[parts.length - 1] : \"\";\n}\n\n/**\n * Format file size for display\n */\nexport function formatFileSize(bytes: number): string {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + \" \" + sizes[i];\n}\n\n/**\n * Format duration in milliseconds to human readable\n */\nexport function formatDuration(ms: number): string {\n if (ms < 1000) return `${ms}ms`;\n if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;\n return `${(ms / 60000).toFixed(1)}m`;\n}\n"]}
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { C as CellValue, P as ParseOptions, S as Schema } from './types-C2-m7DtR.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* React integration for ExcelSaurus
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface UseExcelParserState<T = CellValue[][]> {
|
|
8
|
+
/** Parsed data */
|
|
9
|
+
data: T | null;
|
|
10
|
+
/** Whether parsing is in progress */
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
/** Parse progress (0-100) */
|
|
13
|
+
progress: number;
|
|
14
|
+
/** Error if parsing failed */
|
|
15
|
+
error: Error | null;
|
|
16
|
+
/** Sheet name */
|
|
17
|
+
sheetName: string | null;
|
|
18
|
+
/** Row count */
|
|
19
|
+
rowCount: number;
|
|
20
|
+
}
|
|
21
|
+
interface UseExcelParserOptions extends ParseOptions {
|
|
22
|
+
/** Schema for typed parsing */
|
|
23
|
+
schema?: Schema;
|
|
24
|
+
}
|
|
25
|
+
interface UseExcelParserReturn<T = CellValue[][]> extends UseExcelParserState<T> {
|
|
26
|
+
/** Parse a file */
|
|
27
|
+
parse: (file: File, options?: UseExcelParserOptions) => Promise<void>;
|
|
28
|
+
/** Reset state */
|
|
29
|
+
reset: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* React hook for parsing Excel files
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* function ImportComponent() {
|
|
37
|
+
* const { parse, data, isLoading, error } = useExcelParser();
|
|
38
|
+
*
|
|
39
|
+
* return (
|
|
40
|
+
* <input
|
|
41
|
+
* type="file"
|
|
42
|
+
* onChange={(e) => e.target.files?.[0] && parse(e.target.files[0])}
|
|
43
|
+
* />
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare function useExcelParser<T extends Record<string, CellValue> = Record<string, CellValue>>(): UseExcelParserReturn<T[] | CellValue[][]>;
|
|
49
|
+
/**
|
|
50
|
+
* React hook for streaming Excel files
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* function StreamingImport() {
|
|
55
|
+
* const { stream, chunks, progress, isStreaming } = useExcelStream();
|
|
56
|
+
*
|
|
57
|
+
* return (
|
|
58
|
+
* <input
|
|
59
|
+
* type="file"
|
|
60
|
+
* onChange={(e) => e.target.files?.[0] && stream(e.target.files[0])}
|
|
61
|
+
* />
|
|
62
|
+
* );
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function useExcelStream(chunkSize?: number): {
|
|
67
|
+
stream: (file: File, options?: ParseOptions) => Promise<void>;
|
|
68
|
+
chunks: CellValue[][][];
|
|
69
|
+
isStreaming: boolean;
|
|
70
|
+
progress: number;
|
|
71
|
+
error: Error | null;
|
|
72
|
+
reset: () => void;
|
|
73
|
+
/** All rows flattened */
|
|
74
|
+
allRows: CellValue[][];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { useExcelParser, useExcelStream };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {useState,useRef,useCallback}from'react';var K=Object.defineProperty;var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>{for(var n in e)K(t,n,{get:e[n],enumerable:true});};var H={};L(H,{default:()=>ce,getSheetNames:()=>Q,init:()=>Z,initSync:()=>ie,parseExcel:()=>ee});function Q(t){try{let s=u.__wbindgen_add_to_stack_pointer(-16),a=D(t,u.__wbindgen_export),o=p;u.getSheetNames(s,a,o);var e=f().getInt32(s+0,!0),n=f().getInt32(s+4,!0),r=f().getInt32(s+8,!0);if(r)throw m(n);return m(e)}finally{u.__wbindgen_add_to_stack_pointer(16);}}function Z(){u.init();}function ee(t,e){try{let a=u.__wbindgen_add_to_stack_pointer(-16),o=D(t,u.__wbindgen_export),i=p;u.parseExcel(a,o,i,b(e));var n=f().getInt32(a+0,!0),r=f().getInt32(a+4,!0),s=f().getInt32(a+8,!0);if(s)throw m(r);return m(n)}finally{u.__wbindgen_add_to_stack_pointer(16);}}function $(){return {__proto__:null,"./excelsaurus_bg.js":{__proto__:null,__wbg_Error_8c4e43fe74559d73:function(e,n){let r=Error(U(e,n));return b(r)},__wbg_Number_04624de7d0e8332d:function(e){return Number(c(e))},__wbg_String_8f0eb39a4a4c2f66:function(e,n){let r=String(c(n)),s=O(r,u.__wbindgen_export,u.__wbindgen_export2),a=p;f().setInt32(e+4,a,true),f().setInt32(e+0,s,true);},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(e,n){let r=c(n),s=typeof r=="bigint"?r:void 0;f().setBigInt64(e+8,x(s)?BigInt(0):s,true),f().setInt32(e+0,!x(s),true);},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(e){let n=c(e),r=typeof n=="boolean"?n:void 0;return x(r)?16777215:r?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(e,n){let r=v(c(n)),s=O(r,u.__wbindgen_export,u.__wbindgen_export2),a=p;f().setInt32(e+4,a,true),f().setInt32(e+0,s,true);},__wbg___wbindgen_in_47fa6863be6f2f25:function(e,n){return c(e)in c(n)},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(e){return typeof c(e)=="bigint"},__wbg___wbindgen_is_null_ac34f5003991759a:function(e){return c(e)===null},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(e){let n=c(e);return typeof n=="object"&&n!==null},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(e){return c(e)===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(e,n){return c(e)===c(n)},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(e,n){return c(e)==c(n)},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(e,n){let r=c(n),s=typeof r=="number"?r:void 0;f().setFloat64(e+8,x(s)?0:s,true),f().setInt32(e+0,!x(s),true);},__wbg___wbindgen_string_get_72fb696202c56729:function(e,n){let r=c(n),s=typeof r=="string"?r:void 0;var a=x(s)?0:O(s,u.__wbindgen_export,u.__wbindgen_export2),o=p;f().setInt32(e+4,o,true),f().setInt32(e+0,a,true);},__wbg___wbindgen_throw_be289d5034ed271b:function(e,n){throw new Error(U(e,n))},__wbg_error_7534b8e9a36f1ab4:function(e,n){let r,s;try{r=e,s=n,console.error(U(e,n));}finally{u.__wbindgen_export3(r,s,1);}},__wbg_get_with_ref_key_1dc361bd10053bfe:function(e,n){let r=c(e)[c(n)];return b(r)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(e){let n;try{n=c(e)instanceof ArrayBuffer;}catch{n=false;}return n},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(e){let n;try{n=c(e)instanceof Uint8Array;}catch{n=false;}return n},__wbg_isSafeInteger_bfbc7332a9768d2a:function(e){return Number.isSafeInteger(c(e))},__wbg_length_32ed9a279acd054c:function(e){return c(e).length},__wbg_new_361308b2356cecd0:function(){let e=new Object;return b(e)},__wbg_new_3eb36ae241fe6f44:function(){let e=new Array;return b(e)},__wbg_new_8a6f238a6ece86ea:function(){let e=new Error;return b(e)},__wbg_new_dd2b680c8bf6ae29:function(e){let n=new Uint8Array(c(e));return b(n)},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(e,n,r){Uint8Array.prototype.set.call(ne(e,n),c(r));},__wbg_set_3f1d0b984ed272ed:function(e,n,r){c(e)[m(n)]=m(r);},__wbg_set_f43e577aea94465b:function(e,n,r){c(e)[n>>>0]=m(r);},__wbg_stack_0ed75d68575b0f3c:function(e,n){let r=c(n).stack,s=O(r,u.__wbindgen_export,u.__wbindgen_export2),a=p;f().setInt32(e+4,a,true),f().setInt32(e+0,s,true);},__wbindgen_cast_0000000000000001:function(e){return b(e)},__wbindgen_cast_0000000000000002:function(e,n){let r=U(e,n);return b(r)},__wbindgen_cast_0000000000000003:function(e){let n=BigInt.asUintN(64,e);return b(n)},__wbindgen_object_clone_ref:function(e){let n=c(e);return b(n)},__wbindgen_object_drop_ref:function(e){m(e);}}}}function b(t){E===w.length&&w.push(w.length+1);let e=E;return E=w[e],w[e]=t,e}function v(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return `${t}`;if(e=="string")return `"${t}"`;if(e=="symbol"){let s=t.description;return s==null?"Symbol":`Symbol(${s})`}if(e=="function"){let s=t.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(t)){let s=t.length,a="[";s>0&&(a+=v(t[0]));for(let o=1;o<s;o++)a+=", "+v(t[o]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return "Object("+JSON.stringify(t)+")"}catch{return "Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
2
|
+
${t.stack}`:r}function te(t){t<132||(w[t]=E,E=t);}function ne(t,e){return t=t>>>0,S().subarray(t/1,t/1+e)}function f(){return (h===null||h.buffer.detached===true||h.buffer.detached===void 0&&h.buffer!==u.memory.buffer)&&(h=new DataView(u.memory.buffer)),h}function U(t,e){return t=t>>>0,se(t,e)}function S(){return (P===null||P.byteLength===0)&&(P=new Uint8Array(u.memory.buffer)),P}function c(t){return w[t]}function x(t){return t==null}function D(t,e){let n=e(t.length*1,1)>>>0;return S().set(t,n/1),p=t.length,n}function O(t,e,n){if(n===void 0){let i=R.encode(t),_=e(i.length,1)>>>0;return S().subarray(_,_+i.length).set(i),p=i.length,_}let r=t.length,s=e(r,1)>>>0,a=S(),o=0;for(;o<r;o++){let i=t.charCodeAt(o);if(i>127)break;a[s+o]=i;}if(o!==r){o!==0&&(t=t.slice(o)),s=n(s,r,r=o+t.length*3,1)>>>0;let i=S().subarray(s+o,s+r),_=R.encodeInto(t,i);o+=_.written,s=n(s,r,o,1)>>>0;}return p=o,s}function m(t){let e=c(t);return te(t),e}function se(t,e){return W+=e,W>=re&&(T=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),T.decode(),W=e),T.decode(S().subarray(t,t+e))}function q(t,e){return u=t.exports,h=null,P=null,u.__wbindgen_start(),u}async function ae(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(t.ok&&n(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}function n(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function ie(t){if(u!==void 0)return u;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=$();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return q(n)}async function ce(t){if(u!==void 0)return u;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0&&(t=new URL("excelsaurus_bg.wasm",import.meta.url));let e=$();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await ae(await t,e);return q(n)}var h,P,w,E,T,re,W,R,p,u,z=N(()=>{h=null;P=null;w=new Array(128).fill(void 0);w.push(void 0,null,true,false);E=w.length;T=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});T.decode();re=2146435072,W=0;R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(t,e){let n=R.encode(t);return e.set(n),{read:t.length,written:n.length}});p=0;});async function ue(){V||(M||(M=(async()=>{let t=await Promise.resolve().then(()=>(z(),H));await t.default(),V=t;})()),await M);}async function le(){if(await ue(),!V)throw new Error("Failed to initialize ExcelSaurus Wasm module");return V}async function C(t,e={}){let n=await le(),r=await fe(t);return n.parseExcel(r,{sheet:e.sheet?.toString(),limit:e.limit,skipRows:e.skipRows,hasHeaders:e.hasHeaders})}async function J(t,e,n={}){let r=await C(t,n),s=[],a=[];for(let o=0;o<r.rows.length;o++){let i=r.rows[o],_={},g=[];for(let l of e.fields){let A=typeof l.column=="number"?l.column:_e(l.column),d=i[A]??null;if((d===null||d==="")&&l.default!==void 0&&(d=l.default),l.required&&(d===null||d==="")){g.push({field:l.name,message:"Field is required"});continue}if(d!==null&&d!==""&&(de(d,l.type)||g.push({field:l.name,message:`Expected ${l.type}, got ${typeof d}`,value:String(d)}),l.validate)){let k=be(l.validate,d);k&&g.push({field:l.name,message:k,value:String(d)});}_[l.name]=d;}g.length>0&&(a.push({valid:false,rowIndex:o,errors:g}),!e.skipInvalid)||s.push(_);}return {data:s,errors:a.length>0?a:void 0,rowCount:s.length,sheetName:r.sheetName}}async function fe(t){if(t instanceof Uint8Array)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);let e=await t.arrayBuffer();return new Uint8Array(e)}function _e(t){let e=t.toUpperCase(),n=0;for(let r=0;r<e.length;r++)n=n*26+(e.charCodeAt(r)-64);return n-1}function de(t,e){if(e==="any")return true;switch(e){case "string":return typeof t=="string"||typeof t=="number";case "number":case "integer":return typeof t=="number";case "boolean":return typeof t=="boolean";case "date":case "datetime":return typeof t=="string";default:return true}}function be(t,e){let n=String(e);switch(t.toLowerCase()){case "email":return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?null:"Invalid email format";case "phone":return /^\+?[0-9\s\-()]{7,20}$/.test(n)?null:"Invalid phone number";case "url":return /^https?:\/\/[^\s]+$/.test(n)?null:"Invalid URL";case "nonempty":return n.trim()!==""?null:"Value cannot be empty";default:return null}}var V,M,B=N(()=>{V=null,M=null;});var X={};L(X,{collectStream:()=>we,createExcelStream:()=>ge});async function ge(t,e={}){let n=e.chunkSize??1e3,r=await C(t,{sheet:e.sheet,skipRows:e.skipRows,hasHeaders:e.hasHeaders}),s=r.rows.length,a=Math.ceil(s/n);return {[Symbol.asyncIterator](){let o=0,i=0;return {async next(){if(o>=a)return {done:true,value:void 0};let _=o*n,g=Math.min(_+n,s),l=r.rows.slice(_,g);i+=l.length;let A=o===a-1;if(e.onProgress){let y={rowsProcessed:i,totalRows:s,percent:Math.round(i/s*100),chunkNumber:o+1};e.onProgress(y);}let d={rows:l,chunkIndex:o,isLast:A};return o++,{done:false,value:d}}}}}}async function we(t){let e=[];for await(let n of t)e.push(...n.rows);return e}var Y=N(()=>{B();});B();function Ae(){let[t,e]=useState({data:null,isLoading:false,progress:0,error:null,sheetName:null,rowCount:0}),n=useRef(null),r=useCallback(async(a,o={})=>{n.current?.abort(),n.current=new AbortController,e(i=>({...i,isLoading:true,error:null,progress:0}));try{let i;o.schema?(i=await J(a,o.schema,o),e({data:i.data,isLoading:!1,progress:100,error:null,sheetName:i.sheetName,rowCount:i.rowCount})):(i=await C(a,o),e({data:i.rows,isLoading:!1,progress:100,error:null,sheetName:i.sheetName,rowCount:i.rowCount}));}catch(i){e(_=>({..._,isLoading:false,error:i instanceof Error?i:new Error(String(i))}));}},[]),s=useCallback(()=>{n.current?.abort(),e({data:null,isLoading:false,progress:0,error:null,sheetName:null,rowCount:0});},[]);return {...t,parse:r,reset:s}}function Pe(t=1e3){let[e,n]=useState([]),[r,s]=useState(false),[a,o]=useState(0),[i,_]=useState(null),g=useCallback(async(A,d={})=>{s(true),n([]),o(0),_(null);try{let{createExcelStream:y}=await Promise.resolve().then(()=>(Y(),X)),k=await y(A,{...d,chunkSize:t,onProgress:F=>o(F.percent)});for await(let F of k)n(G=>[...G,F.rows]);}catch(y){_(y instanceof Error?y:new Error(String(y)));}finally{s(false),o(100);}},[t]),l=useCallback(()=>{n([]),o(0),_(null),s(false);},[]);return {stream:g,chunks:e,isStreaming:r,progress:a,error:i,reset:l,allRows:e.flat()}}export{Ae as useExcelParser,Pe as useExcelStream};//# sourceMappingURL=react.js.map
|
|
3
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../pkg/excelsaurus.js","../src/core.ts","../src/streaming.ts","../src/integrations/react.tsx"],"names":["excelsaurus_exports","__export","__wbg_init","getSheetNames","init","initSync","parseExcel","data","retptr","wasm","ptr0","passArray8ToWasm0","len0","WASM_VECTOR_LEN","r0","getDataViewMemory0","r1","r2","takeObject","options","addHeapObject","__wbg_get_imports","arg0","arg1","ret","getStringFromWasm0","getObject","ptr1","passStringToWasm0","len1","v","isLikeNone","debugString","val","obj","deferred0_0","deferred0_1","result","arg2","getArrayU8FromWasm0","heap_next","heap","idx","type","description","name","length","debug","i","builtInMatches","className","dropObject","ptr","len","getUint8ArrayMemory0","cachedDataViewMemory0","decodeText","cachedUint8ArrayMemory0","x","arg","malloc","realloc","buf","cachedTextEncoder","mem","offset","code","view","numBytesDecoded","MAX_SAFARI_DECODE_BYTES","cachedTextDecoder","__wbg_finalize_init","instance","module","__wbg_load","imports","e","expectedResponseType","bytes","module_or_path","init_excelsaurus","__esmMin","initWasm","wasmModule","initPromise","mod","getWasm","input","toUint8Array","parseExcelWithSchema","schema","rawResult","errors","row","rowErrors","field","colIndex","columnLetterToIndex","value","validateType","validatorError","runValidator","buffer","letter","upper","expectedType","validator","str","init_core","streaming_exports","collectStream","createExcelStream","chunkSize","totalRows","totalChunks","currentChunk","rowsProcessed","startIdx","endIdx","rows","isLast","progress","chunk","stream","allRows","init_streaming","useExcelParser","state","setState","useState","abortRef","useRef","parse","useCallback","file","prev","err","reset","useExcelStream","chunks","setChunks","isStreaming","setIsStreaming","setProgress","error","setError","excelStream","p"],"mappings":"gDAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAAA,CAAAA,CAAA,EAAA,CAAAC,CAAAA,CAAAD,CAAAA,CAAA,CAAA,OAAA,CAAA,IAAAE,EAAAA,CAAA,aAAA,CAAA,IAAAC,CAAAA,CAAA,IAAA,CAAA,IAAAC,CAAAA,CAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,UAAA,CAAA,IAAAC,EAAAA,CAAAA,CAAAA,CAaO,SAASH,CAAAA,CAAcI,CAAAA,CAAM,CAChC,GAAI,CACA,IAAMC,CAAAA,CAASC,CAAAA,CAAK,+BAAA,CAAgC,CAAA,EAAG,CAAA,CACjDC,CAAAA,CAAOC,CAAAA,CAAkBJ,CAAAA,CAAME,CAAAA,CAAK,iBAAiB,CAAA,CACrDG,CAAAA,CAAOC,CAAAA,CACbJ,CAAAA,CAAK,aAAA,CAAcD,CAAAA,CAAQE,CAAAA,CAAME,CA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list of sheet names in the workbook\n *\n * # Arguments\n * * `data` - Raw bytes of the Excel file\n *\n * # Returns\n * * `Vec<String>` - List of sheet names\n * @param {Uint8Array} data\n * @returns {any}\n */\nexport function getSheetNames(data) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.getSheetNames(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Initialize panic hook for better error messages in browser console\n */\nexport function init() {\n wasm.init();\n}\n\n/**\n * Parse an Excel file from bytes\n *\n * # Arguments\n * * `data` - Raw bytes of the Excel file\n * * `options` - Parse options (optional)\n *\n * # Returns\n * * `JsValue` - Parsed result as JavaScript object\n * @param {Uint8Array} data\n * @param {any} options\n * @returns {any}\n */\nexport function parseExcel(data, options) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.parseExcel(retptr, ptr0, len0, addHeapObject(options));\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n },\n __wbg_Number_04624de7d0e8332d: function(arg0) {\n const ret = Number(getObject(arg0));\n return ret;\n },\n __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {\n const ret = String(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {\n const v = getObject(arg1);\n const ret = typeof(v) === 'bigint' ? v : undefined;\n getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {\n const v = getObject(arg0);\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n },\n __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {\n const ret = getObject(arg0) in getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'bigint';\n return ret;\n },\n __wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {\n const ret = getObject(arg0) === null;\n return ret;\n },\n __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {\n const val = getObject(arg0);\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n },\n __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {\n const ret = getObject(arg0) === undefined;\n return ret;\n },\n __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {\n const ret = getObject(arg0) === getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {\n const ret = getObject(arg0) == getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'number' ? obj : undefined;\n getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'string' ? obj : undefined;\n var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {\n let deferred0_0;\n let deferred0_1;\n try {\n deferred0_0 = arg0;\n deferred0_1 = arg1;\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);\n }\n },\n __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {\n const ret = getObject(arg0)[getObject(arg1)];\n return addHeapObject(ret);\n },\n __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof ArrayBuffer;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Uint8Array;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {\n const ret = Number.isSafeInteger(getObject(arg0));\n return ret;\n },\n __wbg_length_32ed9a279acd054c: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_new_361308b2356cecd0: function() {\n const ret = new Object();\n return addHeapObject(ret);\n },\n __wbg_new_3eb36ae241fe6f44: function() {\n const ret = new Array();\n return addHeapObject(ret);\n },\n __wbg_new_8a6f238a6ece86ea: function() {\n const ret = new Error();\n return addHeapObject(ret);\n },\n __wbg_new_dd2b680c8bf6ae29: function(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));\n },\n __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {\n getObject(arg0)[takeObject(arg1)] = takeObject(arg2);\n },\n __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {\n getObject(arg0)[arg1 >>> 0] = takeObject(arg2);\n },\n __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {\n const ret = getObject(arg1).stack;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbindgen_cast_0000000000000001: function(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000002: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000003: function(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_clone_ref: function(arg0) {\n const ret = getObject(arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_drop_ref: function(arg0) {\n takeObject(arg0);\n },\n };\n return {\n __proto__: null,\n \"./excelsaurus_bg.js\": import0,\n };\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(128).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('excelsaurus_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n","/**\n * Core parsing functions\n */\n\nimport type { ParseOptions, ParseResult, Schema, SchemaParseResult, CellValue } from \"./types\";\n\n// Wasm module instance\nlet wasmModule: typeof import(\"../pkg/excelsaurus\") | null = null;\nlet initPromise: Promise<void> | null = null;\n\n/**\n * Initialize the Wasm module\n * This is called automatically on first use\n */\nasync function initWasm(): Promise<void> {\n if (wasmModule) return;\n\n if (!initPromise) {\n initPromise = (async () => {\n // Dynamic import of wasm module\n const mod = await import(\"../pkg/excelsaurus\");\n await mod.default();\n wasmModule = mod;\n })();\n }\n\n await initPromise;\n}\n\n/**\n * Ensure wasm is initialized and get the module\n */\nasync function getWasm() {\n await initWasm();\n if (!wasmModule) {\n throw new Error(\"Failed to initialize ExcelSaurus Wasm module\");\n }\n return wasmModule;\n}\n\n/**\n * Parse an Excel file and return raw data\n *\n * @example\n * ```ts\n * const file = event.target.files[0];\n * const result = await parseExcel(file);\n * console.log(result.rows);\n * ```\n */\nexport async function parseExcel(\n input: File | ArrayBuffer | Uint8Array,\n options: ParseOptions = {}\n): Promise<ParseResult> {\n const wasm = await getWasm();\n const bytes = await toUint8Array(input);\n\n const result = wasm.parseExcel(bytes, {\n sheet: options.sheet?.toString(),\n limit: options.limit,\n skipRows: options.skipRows,\n hasHeaders: options.hasHeaders,\n });\n\n return result as ParseResult;\n}\n\n/**\n * Parse an Excel file with schema validation\n *\n * @example\n * ```ts\n * const result = await parseExcelWithSchema(file, {\n * fields: [\n * { name: 'name', column: 0, type: 'string', required: true },\n * { name: 'email', column: 1, type: 'string', validate: 'email' },\n * { name: 'age', column: 2, type: 'number' },\n * ]\n * });\n * console.log(result.data);\n * ```\n */\nexport async function parseExcelWithSchema<T extends Record<string, CellValue>>(\n input: File | ArrayBuffer | Uint8Array,\n schema: Schema,\n options: ParseOptions = {}\n): Promise<SchemaParseResult<T>> {\n // First, parse the raw data\n const rawResult = await parseExcel(input, options);\n\n // Then apply schema validation in JS\n // (This will be moved to Rust in a future version for better performance)\n const data: T[] = [];\n const errors: { valid: boolean; rowIndex: number; errors: { field: string; message: string; value?: string }[] }[] = [];\n\n for (let i = 0; i < rawResult.rows.length; i++) {\n const row = rawResult.rows[i];\n const obj: Record<string, CellValue> = {};\n const rowErrors: { field: string; message: string; value?: string }[] = [];\n\n for (const field of schema.fields) {\n const colIndex = typeof field.column === \"number\" \n ? field.column \n : columnLetterToIndex(field.column);\n \n let value = row[colIndex] ?? null;\n\n // Apply default if empty\n if ((value === null || value === \"\") && field.default !== undefined) {\n value = field.default;\n }\n\n // Check required\n if (field.required && (value === null || value === \"\")) {\n rowErrors.push({\n field: field.name,\n message: \"Field is required\",\n });\n continue;\n }\n\n // Validate type (basic)\n if (value !== null && value !== \"\") {\n const typeValid = validateType(value, field.type);\n if (!typeValid) {\n rowErrors.push({\n field: field.name,\n message: `Expected ${field.type}, got ${typeof value}`,\n value: String(value),\n });\n }\n\n // Run validator\n if (field.validate) {\n const validatorError = runValidator(field.validate, value);\n if (validatorError) {\n rowErrors.push({\n field: field.name,\n message: validatorError,\n value: String(value),\n });\n }\n }\n }\n\n obj[field.name] = value;\n }\n\n if (rowErrors.length > 0) {\n errors.push({ valid: false, rowIndex: i, errors: rowErrors });\n if (!schema.skipInvalid) {\n continue;\n }\n }\n\n data.push(obj as T);\n }\n\n return {\n data,\n errors: errors.length > 0 ? errors : undefined,\n rowCount: data.length,\n sheetName: rawResult.sheetName,\n };\n}\n\n/**\n * Get list of sheet names in a workbook\n */\nexport async function getSheetNames(\n input: File | ArrayBuffer | Uint8Array\n): Promise<string[]> {\n const wasm = await getWasm();\n const bytes = await toUint8Array(input);\n return wasm.getSheetNames(bytes) as string[];\n}\n\n// Helper functions\n\nasync function toUint8Array(input: File | ArrayBuffer | Uint8Array): Promise<Uint8Array> {\n if (input instanceof Uint8Array) {\n return input;\n }\n if (input instanceof ArrayBuffer) {\n return new Uint8Array(input);\n }\n // File\n const buffer = await input.arrayBuffer();\n return new Uint8Array(buffer);\n}\n\nfunction columnLetterToIndex(letter: string): number {\n const upper = letter.toUpperCase();\n let result = 0;\n for (let i = 0; i < upper.length; i++) {\n result = result * 26 + (upper.charCodeAt(i) - 64);\n }\n return result - 1;\n}\n\nfunction validateType(value: CellValue, expectedType: string): boolean {\n if (expectedType === \"any\") return true;\n \n switch (expectedType) {\n case \"string\":\n return typeof value === \"string\" || typeof value === \"number\";\n case \"number\":\n case \"integer\":\n return typeof value === \"number\";\n case \"boolean\":\n return typeof value === \"boolean\";\n case \"date\":\n case \"datetime\":\n return typeof value === \"string\"; // Dates are strings from Excel\n default:\n return true;\n }\n}\n\nfunction runValidator(validator: string, value: CellValue): string | null {\n const str = String(value);\n \n switch (validator.toLowerCase()) {\n case \"email\":\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(str) ? null : \"Invalid email format\";\n case \"phone\":\n return /^\\+?[0-9\\s\\-()]{7,20}$/.test(str) ? null : \"Invalid phone number\";\n case \"url\":\n return /^https?:\\/\\/[^\\s]+$/.test(str) ? null : \"Invalid URL\";\n case \"nonempty\":\n return str.trim() !== \"\" ? null : \"Value cannot be empty\";\n default:\n return null;\n }\n}\n","/**\n * Streaming API for large Excel files\n */\n\nimport type { StreamOptions, StreamProgress, RowChunk, CellValue } from \"./types\";\nimport { parseExcel } from \"./core\";\n\n/**\n * Create an async iterator for streaming Excel data\n *\n * @example\n * ```ts\n * const stream = await createExcelStream(file, {\n * chunkSize: 1000,\n * onProgress: (p) => console.log(`${p.percent}%`)\n * });\n *\n * for await (const chunk of stream) {\n * await processChunk(chunk.rows);\n * }\n * ```\n */\nexport async function createExcelStream(\n input: File | ArrayBuffer | Uint8Array,\n options: StreamOptions = {}\n): Promise<AsyncIterable<RowChunk>> {\n const chunkSize = options.chunkSize ?? 1000;\n\n // For now, parse all data and chunk it\n // In future, this will use true streaming from Rust\n const result = await parseExcel(input, {\n sheet: options.sheet,\n skipRows: options.skipRows,\n hasHeaders: options.hasHeaders,\n });\n\n const totalRows = result.rows.length;\n const totalChunks = Math.ceil(totalRows / chunkSize);\n\n return {\n [Symbol.asyncIterator](): AsyncIterator<RowChunk> {\n let currentChunk = 0;\n let rowsProcessed = 0;\n\n return {\n async next(): Promise<IteratorResult<RowChunk>> {\n if (currentChunk >= totalChunks) {\n return { done: true, value: undefined };\n }\n\n const startIdx = currentChunk * chunkSize;\n const endIdx = Math.min(startIdx + chunkSize, totalRows);\n const rows = result.rows.slice(startIdx, endIdx);\n\n rowsProcessed += rows.length;\n const isLast = currentChunk === totalChunks - 1;\n\n // Call progress callback\n if (options.onProgress) {\n const progress: StreamProgress = {\n rowsProcessed,\n totalRows,\n percent: Math.round((rowsProcessed / totalRows) * 100),\n chunkNumber: currentChunk + 1,\n };\n options.onProgress(progress);\n }\n\n const chunk: RowChunk = {\n rows,\n chunkIndex: currentChunk,\n isLast,\n };\n\n currentChunk++;\n return { done: false, value: chunk };\n },\n };\n },\n };\n}\n\n/**\n * Collect all chunks from a stream into a single array\n * Useful for testing or when you need all data at once\n */\nexport async function collectStream(\n stream: AsyncIterable<RowChunk>\n): Promise<CellValue[][]> {\n const allRows: CellValue[][] = [];\n for await (const chunk of stream) {\n allRows.push(...chunk.rows);\n }\n return allRows;\n}\n","/**\n * React integration for ExcelSaurus\n */\n\nimport { useState, useCallback, useRef } from \"react\";\nimport type { ParseOptions, ParseResult, Schema, SchemaParseResult, CellValue } from \"../types\";\nimport { parseExcel, parseExcelWithSchema } from \"../core\";\n\ninterface UseExcelParserState<T = CellValue[][]> {\n /** Parsed data */\n data: T | null;\n /** Whether parsing is in progress */\n isLoading: boolean;\n /** Parse progress (0-100) */\n progress: number;\n /** Error if parsing failed */\n error: Error | null;\n /** Sheet name */\n sheetName: string | null;\n /** Row count */\n rowCount: number;\n}\n\ninterface UseExcelParserOptions extends ParseOptions {\n /** Schema for typed parsing */\n schema?: Schema;\n}\n\ninterface UseExcelParserReturn<T = CellValue[][]> extends UseExcelParserState<T> {\n /** Parse a file */\n parse: (file: File, options?: UseExcelParserOptions) => Promise<void>;\n /** Reset state */\n reset: () => void;\n}\n\n/**\n * React hook for parsing Excel files\n *\n * @example\n * ```tsx\n * function ImportComponent() {\n * const { parse, data, isLoading, error } = useExcelParser();\n *\n * return (\n * <input\n * type=\"file\"\n * onChange={(e) => e.target.files?.[0] && parse(e.target.files[0])}\n * />\n * );\n * }\n * ```\n */\nexport function useExcelParser<T extends Record<string, CellValue> = Record<string, CellValue>>(): UseExcelParserReturn<T[] | CellValue[][]> {\n const [state, setState] = useState<UseExcelParserState<T[] | CellValue[][]>>({\n data: null,\n isLoading: false,\n progress: 0,\n error: null,\n sheetName: null,\n rowCount: 0,\n });\n\n const abortRef = useRef<AbortController | null>(null);\n\n const parse = useCallback(async (file: File, options: UseExcelParserOptions = {}) => {\n // Cancel any in-progress parse\n abortRef.current?.abort();\n abortRef.current = new AbortController();\n\n setState((prev: UseExcelParserState<T[] | CellValue[][]>) => ({\n ...prev,\n isLoading: true,\n error: null,\n progress: 0,\n }));\n\n try {\n let result: ParseResult | SchemaParseResult<T>;\n\n if (options.schema) {\n result = await parseExcelWithSchema<T>(file, options.schema, options);\n setState({\n data: (result as SchemaParseResult<T>).data,\n isLoading: false,\n progress: 100,\n error: null,\n sheetName: result.sheetName,\n rowCount: result.rowCount,\n });\n } else {\n result = await parseExcel(file, options);\n setState({\n data: (result as ParseResult).rows,\n isLoading: false,\n progress: 100,\n error: null,\n sheetName: result.sheetName,\n rowCount: result.rowCount,\n });\n }\n } catch (err) {\n setState((prev: UseExcelParserState<T[] | CellValue[][]>) => ({\n ...prev,\n isLoading: false,\n error: err instanceof Error ? err : new Error(String(err)),\n }));\n }\n }, []);\n\n const reset = useCallback(() => {\n abortRef.current?.abort();\n setState({\n data: null,\n isLoading: false,\n progress: 0,\n error: null,\n sheetName: null,\n rowCount: 0,\n });\n }, []);\n\n return {\n ...state,\n parse,\n reset,\n };\n}\n\n/**\n * React hook for streaming Excel files\n *\n * @example\n * ```tsx\n * function StreamingImport() {\n * const { stream, chunks, progress, isStreaming } = useExcelStream();\n *\n * return (\n * <input\n * type=\"file\"\n * onChange={(e) => e.target.files?.[0] && stream(e.target.files[0])}\n * />\n * );\n * }\n * ```\n */\nexport function useExcelStream(chunkSize = 1000) {\n const [chunks, setChunks] = useState<CellValue[][][]>([]);\n const [isStreaming, setIsStreaming] = useState(false);\n const [progress, setProgress] = useState(0);\n const [error, setError] = useState<Error | null>(null);\n\n const stream = useCallback(\n async (file: File, options: ParseOptions = {}) => {\n setIsStreaming(true);\n setChunks([]);\n setProgress(0);\n setError(null);\n\n try {\n const { createExcelStream } = await import(\"../streaming\");\n\n const excelStream = await createExcelStream(file, {\n ...options,\n chunkSize,\n onProgress: (p) => setProgress(p.percent),\n });\n\n for await (const chunk of excelStream) {\n setChunks((prev: CellValue[][][]) => [...prev, chunk.rows]);\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsStreaming(false);\n setProgress(100);\n }\n },\n [chunkSize]\n );\n\n const reset = useCallback(() => {\n setChunks([]);\n setProgress(0);\n setError(null);\n setIsStreaming(false);\n }, []);\n\n return {\n stream,\n chunks,\n isStreaming,\n progress,\n error,\n reset,\n /** All rows flattened */\n allRows: chunks.flat(),\n };\n}\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for ExcelSaurus
|
|
3
|
+
*/
|
|
4
|
+
/** A single cell value */
|
|
5
|
+
type CellValue = string | number | boolean | null;
|
|
6
|
+
/** Options for parsing Excel files */
|
|
7
|
+
interface ParseOptions {
|
|
8
|
+
/** Sheet name or index (0-based) to parse. Default: first sheet */
|
|
9
|
+
sheet?: string | number;
|
|
10
|
+
/** Maximum number of rows to parse. Default: all */
|
|
11
|
+
limit?: number;
|
|
12
|
+
/** Number of rows to skip from the beginning. Default: 0 */
|
|
13
|
+
skipRows?: number;
|
|
14
|
+
/** Whether first row contains headers. Default: true */
|
|
15
|
+
hasHeaders?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Result of parsing an Excel file */
|
|
18
|
+
interface ParseResult {
|
|
19
|
+
/** Parsed rows as 2D array */
|
|
20
|
+
rows: CellValue[][];
|
|
21
|
+
/** Column headers (if hasHeaders is true) */
|
|
22
|
+
headers: string[] | null;
|
|
23
|
+
/** Total number of rows parsed */
|
|
24
|
+
rowCount: number;
|
|
25
|
+
/** Name of the sheet that was parsed */
|
|
26
|
+
sheetName: string;
|
|
27
|
+
}
|
|
28
|
+
/** Information about a sheet */
|
|
29
|
+
interface SheetInfo {
|
|
30
|
+
/** Sheet name */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Sheet index (0-based) */
|
|
33
|
+
index: number;
|
|
34
|
+
}
|
|
35
|
+
/** Schema field definition */
|
|
36
|
+
interface SchemaField {
|
|
37
|
+
/** Field name in output object */
|
|
38
|
+
name: string;
|
|
39
|
+
/** Column index (0-based) or letter (A, B, C...) */
|
|
40
|
+
column: number | string;
|
|
41
|
+
/** Expected data type */
|
|
42
|
+
type: "string" | "number" | "integer" | "boolean" | "date" | "datetime" | "any";
|
|
43
|
+
/** Whether field is required */
|
|
44
|
+
required?: boolean;
|
|
45
|
+
/** Built-in validator: 'email', 'phone', 'url', 'nonempty' */
|
|
46
|
+
validate?: string;
|
|
47
|
+
/** Default value if cell is empty */
|
|
48
|
+
default?: CellValue;
|
|
49
|
+
}
|
|
50
|
+
/** Schema definition for typed parsing */
|
|
51
|
+
interface Schema {
|
|
52
|
+
/** Field definitions */
|
|
53
|
+
fields: SchemaField[];
|
|
54
|
+
/** Skip rows that fail validation. Default: false */
|
|
55
|
+
skipInvalid?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** Options for streaming API */
|
|
58
|
+
interface StreamOptions extends ParseOptions {
|
|
59
|
+
/** Number of rows per chunk. Default: 1000 */
|
|
60
|
+
chunkSize?: number;
|
|
61
|
+
/** Progress callback */
|
|
62
|
+
onProgress?: (progress: StreamProgress) => void;
|
|
63
|
+
}
|
|
64
|
+
/** Progress information for streaming */
|
|
65
|
+
interface StreamProgress {
|
|
66
|
+
/** Number of rows processed so far */
|
|
67
|
+
rowsProcessed: number;
|
|
68
|
+
/** Total rows (if known) */
|
|
69
|
+
totalRows?: number;
|
|
70
|
+
/** Percentage complete (0-100) */
|
|
71
|
+
percent: number;
|
|
72
|
+
/** Current chunk number (1-based) */
|
|
73
|
+
chunkNumber: number;
|
|
74
|
+
}
|
|
75
|
+
/** A chunk of rows from streaming */
|
|
76
|
+
interface RowChunk {
|
|
77
|
+
/** The rows in this chunk */
|
|
78
|
+
rows: CellValue[][];
|
|
79
|
+
/** Chunk index (0-based) */
|
|
80
|
+
chunkIndex: number;
|
|
81
|
+
/** Whether this is the last chunk */
|
|
82
|
+
isLast: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Validation error */
|
|
85
|
+
interface ValidationError {
|
|
86
|
+
/** Field name */
|
|
87
|
+
field: string;
|
|
88
|
+
/** Error message */
|
|
89
|
+
message: string;
|
|
90
|
+
/** Actual value */
|
|
91
|
+
value?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Result of schema validation */
|
|
94
|
+
interface ValidationResult {
|
|
95
|
+
/** Whether validation passed */
|
|
96
|
+
valid: boolean;
|
|
97
|
+
/** Row index (0-based, excluding header) */
|
|
98
|
+
rowIndex: number;
|
|
99
|
+
/** List of validation errors */
|
|
100
|
+
errors: ValidationError[];
|
|
101
|
+
}
|
|
102
|
+
/** Result of parsing with schema */
|
|
103
|
+
interface SchemaParseResult<T = Record<string, CellValue>> {
|
|
104
|
+
/** Parsed and validated data */
|
|
105
|
+
data: T[];
|
|
106
|
+
/** Validation errors (if skipInvalid is true) */
|
|
107
|
+
errors?: ValidationResult[];
|
|
108
|
+
/** Total rows processed */
|
|
109
|
+
rowCount: number;
|
|
110
|
+
/** Sheet name */
|
|
111
|
+
sheetName: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type { CellValue as C, ParseOptions as P, RowChunk as R, Schema as S, ParseResult as a, SchemaParseResult as b, StreamOptions as c, SheetInfo as d, StreamProgress as e };
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { C as CellValue, P as ParseOptions, a as ParseResult } from './types-C2-m7DtR.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web Worker wrapper for non-blocking Excel parsing
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type ProgressCallback = (progress: {
|
|
8
|
+
percent: number;
|
|
9
|
+
rowsProcessed: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
type ChunkCallback = (rows: CellValue[][]) => void;
|
|
12
|
+
type CompleteCallback<T> = (result: T) => void;
|
|
13
|
+
type ErrorCallback = (error: Error) => void;
|
|
14
|
+
/**
|
|
15
|
+
* ExcelWorker - Parse Excel files in a Web Worker
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const worker = new ExcelWorker();
|
|
20
|
+
* worker.onProgress((p) => console.log(`${p.percent}%`));
|
|
21
|
+
* worker.onComplete((result) => console.log(result));
|
|
22
|
+
*
|
|
23
|
+
* await worker.parse(file);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare class ExcelWorker {
|
|
27
|
+
private worker;
|
|
28
|
+
private requestId;
|
|
29
|
+
private pending;
|
|
30
|
+
private progressCallback;
|
|
31
|
+
private _chunkCallback;
|
|
32
|
+
private completeCallback;
|
|
33
|
+
private errorCallback;
|
|
34
|
+
constructor();
|
|
35
|
+
private initWorker;
|
|
36
|
+
/**
|
|
37
|
+
* Set progress callback
|
|
38
|
+
*/
|
|
39
|
+
onProgress(callback: ProgressCallback): this;
|
|
40
|
+
/**
|
|
41
|
+
* Set chunk callback (for streaming)
|
|
42
|
+
*/
|
|
43
|
+
onChunk(callback: ChunkCallback): this;
|
|
44
|
+
/**
|
|
45
|
+
* Set complete callback
|
|
46
|
+
*/
|
|
47
|
+
onComplete<T>(callback: CompleteCallback<T>): this;
|
|
48
|
+
/**
|
|
49
|
+
* Set error callback
|
|
50
|
+
*/
|
|
51
|
+
onError(callback: ErrorCallback): this;
|
|
52
|
+
/**
|
|
53
|
+
* Parse Excel file in worker
|
|
54
|
+
*/
|
|
55
|
+
parse(input: File | ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Get sheet names in worker
|
|
58
|
+
*/
|
|
59
|
+
getSheetNames(input: File | ArrayBuffer): Promise<string[]>;
|
|
60
|
+
private sendRequest;
|
|
61
|
+
private runInMainThread;
|
|
62
|
+
/**
|
|
63
|
+
* Terminate the worker
|
|
64
|
+
*/
|
|
65
|
+
terminate(): void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { ExcelWorker };
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var J=Object.defineProperty;var U=(t,e)=>()=>(t&&(e=t(t=0)),e);var O=(t,e)=>{for(var n in e)J(t,n,{get:e[n],enumerable:true});};var T={};O(T,{default:()=>se,getSheetNames:()=>X,init:()=>Y,initSync:()=>re,parseExcel:()=>G});function X(t){try{let s=c.__wbindgen_add_to_stack_pointer(-16),o=B(t,c.__wbindgen_export),i=p;c.getSheetNames(s,o,i);var e=l().getInt32(s+0,!0),n=l().getInt32(s+4,!0),r=l().getInt32(s+8,!0);if(r)throw y(n);return y(e)}finally{c.__wbindgen_add_to_stack_pointer(16);}}function Y(){c.init();}function G(t,e){try{let o=c.__wbindgen_add_to_stack_pointer(-16),i=B(t,c.__wbindgen_export),u=p;c.parseExcel(o,i,u,d(e));var n=l().getInt32(o+0,!0),r=l().getInt32(o+4,!0),s=l().getInt32(o+8,!0);if(s)throw y(r);return y(n)}finally{c.__wbindgen_add_to_stack_pointer(16);}}function M(){return {__proto__:null,"./excelsaurus_bg.js":{__proto__:null,__wbg_Error_8c4e43fe74559d73:function(e,n){let r=Error(x(e,n));return d(r)},__wbg_Number_04624de7d0e8332d:function(e){return Number(a(e))},__wbg_String_8f0eb39a4a4c2f66:function(e,n){let r=String(a(n)),s=I(r,c.__wbindgen_export,c.__wbindgen_export2),o=p;l().setInt32(e+4,o,true),l().setInt32(e+0,s,true);},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(e,n){let r=a(n),s=typeof r=="bigint"?r:void 0;l().setBigInt64(e+8,h(s)?BigInt(0):s,true),l().setInt32(e+0,!h(s),true);},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(e){let n=a(e),r=typeof n=="boolean"?n:void 0;return h(r)?16777215:r?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(e,n){let r=E(a(n)),s=I(r,c.__wbindgen_export,c.__wbindgen_export2),o=p;l().setInt32(e+4,o,true),l().setInt32(e+0,s,true);},__wbg___wbindgen_in_47fa6863be6f2f25:function(e,n){return a(e)in a(n)},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(e){return typeof a(e)=="bigint"},__wbg___wbindgen_is_null_ac34f5003991759a:function(e){return a(e)===null},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(e){let n=a(e);return typeof n=="object"&&n!==null},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(e){return a(e)===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(e,n){return a(e)===a(n)},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(e,n){return a(e)==a(n)},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(e,n){let r=a(n),s=typeof r=="number"?r:void 0;l().setFloat64(e+8,h(s)?0:s,true),l().setInt32(e+0,!h(s),true);},__wbg___wbindgen_string_get_72fb696202c56729:function(e,n){let r=a(n),s=typeof r=="string"?r:void 0;var o=h(s)?0:I(s,c.__wbindgen_export,c.__wbindgen_export2),i=p;l().setInt32(e+4,i,true),l().setInt32(e+0,o,true);},__wbg___wbindgen_throw_be289d5034ed271b:function(e,n){throw new Error(x(e,n))},__wbg_error_7534b8e9a36f1ab4:function(e,n){let r,s;try{r=e,s=n,console.error(x(e,n));}finally{c.__wbindgen_export3(r,s,1);}},__wbg_get_with_ref_key_1dc361bd10053bfe:function(e,n){let r=a(e)[a(n)];return d(r)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(e){let n;try{n=a(e)instanceof ArrayBuffer;}catch{n=false;}return n},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(e){let n;try{n=a(e)instanceof Uint8Array;}catch{n=false;}return n},__wbg_isSafeInteger_bfbc7332a9768d2a:function(e){return Number.isSafeInteger(a(e))},__wbg_length_32ed9a279acd054c:function(e){return a(e).length},__wbg_new_361308b2356cecd0:function(){let e=new Object;return d(e)},__wbg_new_3eb36ae241fe6f44:function(){let e=new Array;return d(e)},__wbg_new_8a6f238a6ece86ea:function(){let e=new Error;return d(e)},__wbg_new_dd2b680c8bf6ae29:function(e){let n=new Uint8Array(a(e));return d(n)},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(e,n,r){Uint8Array.prototype.set.call(Q(e,n),a(r));},__wbg_set_3f1d0b984ed272ed:function(e,n,r){a(e)[y(n)]=y(r);},__wbg_set_f43e577aea94465b:function(e,n,r){a(e)[n>>>0]=y(r);},__wbg_stack_0ed75d68575b0f3c:function(e,n){let r=a(n).stack,s=I(r,c.__wbindgen_export,c.__wbindgen_export2),o=p;l().setInt32(e+4,o,true),l().setInt32(e+0,s,true);},__wbindgen_cast_0000000000000001:function(e){return d(e)},__wbindgen_cast_0000000000000002:function(e,n){let r=x(e,n);return d(r)},__wbindgen_cast_0000000000000003:function(e){let n=BigInt.asUintN(64,e);return d(n)},__wbindgen_object_clone_ref:function(e){let n=a(e);return d(n)},__wbindgen_object_drop_ref:function(e){y(e);}}}}function d(t){A===w.length&&w.push(w.length+1);let e=A;return A=w[e],w[e]=t,e}function E(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return `${t}`;if(e=="string")return `"${t}"`;if(e=="symbol"){let s=t.description;return s==null?"Symbol":`Symbol(${s})`}if(e=="function"){let s=t.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(t)){let s=t.length,o="[";s>0&&(o+=E(t[0]));for(let i=1;i<s;i++)o+=", "+E(t[i]);return o+="]",o}let n=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return "Object("+JSON.stringify(t)+")"}catch{return "Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
2
|
+
${t.stack}`:r}function K(t){t<132||(w[t]=A,A=t);}function Q(t,e){return t=t>>>0,k().subarray(t/1,t/1+e)}function l(){return (m===null||m.buffer.detached===true||m.buffer.detached===void 0&&m.buffer!==c.memory.buffer)&&(m=new DataView(c.memory.buffer)),m}function x(t,e){return t=t>>>0,ee(t,e)}function k(){return (C===null||C.byteLength===0)&&(C=new Uint8Array(c.memory.buffer)),C}function a(t){return w[t]}function h(t){return t==null}function B(t,e){let n=e(t.length*1,1)>>>0;return k().set(t,n/1),p=t.length,n}function I(t,e,n){if(n===void 0){let u=S.encode(t),b=e(u.length,1)>>>0;return k().subarray(b,b+u.length).set(u),p=u.length,b}let r=t.length,s=e(r,1)>>>0,o=k(),i=0;for(;i<r;i++){let u=t.charCodeAt(i);if(u>127)break;o[s+i]=u;}if(i!==r){i!==0&&(t=t.slice(i)),s=n(s,r,r=i+t.length*3,1)>>>0;let u=k().subarray(s+i,s+r),b=S.encodeInto(t,u);i+=b.written,s=n(s,r,i,1)>>>0;}return p=i,s}function y(t){let e=a(t);return K(t),e}function ee(t,e){return R+=e,R>=Z&&(P=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),P.decode(),R=e),P.decode(k().subarray(t,t+e))}function F(t,e){return c=t.exports,m=null,C=null,c.__wbindgen_start(),c}async function ne(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(t.ok&&n(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}function n(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function re(t){if(c!==void 0)return c;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=M();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return F(n)}async function se(t){if(c!==void 0)return c;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0&&(t=new URL("excelsaurus_bg.wasm",import.meta.url));let e=M();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await ne(await t,e);return F(n)}var m,C,w,A,P,Z,R,S,p,c,N=U(()=>{m=null;C=null;w=new Array(128).fill(void 0);w.push(void 0,null,true,false);A=w.length;P=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});P.decode();Z=2146435072,R=0;S=new TextEncoder;"encodeInto"in S||(S.encodeInto=function(t,e){let n=S.encode(t);return e.set(n),{read:t.length,written:n.length}});p=0;});var L={};O(L,{getSheetNames:()=>ae,parseExcel:()=>q,parseExcelWithSchema:()=>oe});async function ie(){v||(W||(W=(async()=>{let t=await Promise.resolve().then(()=>(N(),T));await t.default(),v=t;})()),await W);}async function V(){if(await ie(),!v)throw new Error("Failed to initialize ExcelSaurus Wasm module");return v}async function q(t,e={}){let n=await V(),r=await $(t);return n.parseExcel(r,{sheet:e.sheet?.toString(),limit:e.limit,skipRows:e.skipRows,hasHeaders:e.hasHeaders})}async function oe(t,e,n={}){let r=await q(t,n),s=[],o=[];for(let i=0;i<r.rows.length;i++){let u=r.rows[i],b={},g=[];for(let f of e.fields){let H=typeof f.column=="number"?f.column:ce(f.column),_=u[H]??null;if((_===null||_==="")&&f.default!==void 0&&(_=f.default),f.required&&(_===null||_==="")){g.push({field:f.name,message:"Field is required"});continue}if(_!==null&&_!==""&&(ue(_,f.type)||g.push({field:f.name,message:`Expected ${f.type}, got ${typeof _}`,value:String(_)}),f.validate)){let j=le(f.validate,_);j&&g.push({field:f.name,message:j,value:String(_)});}b[f.name]=_;}g.length>0&&(o.push({valid:false,rowIndex:i,errors:g}),!e.skipInvalid)||s.push(b);}return {data:s,errors:o.length>0?o:void 0,rowCount:s.length,sheetName:r.sheetName}}async function ae(t){let e=await V(),n=await $(t);return e.getSheetNames(n)}async function $(t){if(t instanceof Uint8Array)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);let e=await t.arrayBuffer();return new Uint8Array(e)}function ce(t){let e=t.toUpperCase(),n=0;for(let r=0;r<e.length;r++)n=n*26+(e.charCodeAt(r)-64);return n-1}function ue(t,e){if(e==="any")return true;switch(e){case "string":return typeof t=="string"||typeof t=="number";case "number":case "integer":return typeof t=="number";case "boolean":return typeof t=="boolean";case "date":case "datetime":return typeof t=="string";default:return true}}function le(t,e){let n=String(e);switch(t.toLowerCase()){case "email":return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?null:"Invalid email format";case "phone":return /^\+?[0-9\s\-()]{7,20}$/.test(n)?null:"Invalid phone number";case "url":return /^https?:\/\/[^\s]+$/.test(n)?null:"Invalid URL";case "nonempty":return n.trim()!==""?null:"Value cannot be empty";default:return null}}var v,W,D=U(()=>{v=null,W=null;});var z=class{worker=null;requestId=0;pending=new Map;progressCallback=null;_chunkCallback=null;completeCallback=null;errorCallback=null;constructor(){this.initWorker();}initWorker(){let e=`
|
|
3
|
+
let wasmModule = null;
|
|
4
|
+
|
|
5
|
+
async function initWasm() {
|
|
6
|
+
if (wasmModule) return;
|
|
7
|
+
const mod = await import('./pkg/excelsaurus.js');
|
|
8
|
+
await mod.default();
|
|
9
|
+
wasmModule = mod;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
self.onmessage = async (e) => {
|
|
13
|
+
const { id, type, data, options, schema } = e.data;
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
await initWasm();
|
|
17
|
+
const bytes = new Uint8Array(data);
|
|
18
|
+
let result;
|
|
19
|
+
|
|
20
|
+
switch (type) {
|
|
21
|
+
case 'parse':
|
|
22
|
+
result = wasmModule.parseExcel(bytes, options || {});
|
|
23
|
+
break;
|
|
24
|
+
case 'getSheetNames':
|
|
25
|
+
result = wasmModule.getSheetNames(bytes);
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
throw new Error('Unknown operation: ' + type);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
self.postMessage({ id, success: true, result });
|
|
32
|
+
} catch (error) {
|
|
33
|
+
self.postMessage({ id, success: false, error: error.message });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
`;try{let n=new Blob([e],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n),{type:"module"}),this.worker.onmessage=r=>{let{id:s,success:o,result:i,error:u,progress:b}=r.data;if(b&&this.progressCallback){this.progressCallback(b);return}let g=this.pending.get(s);if(g)if(this.pending.delete(s),o)g.resolve(i),this.completeCallback&&this.completeCallback(i);else {let f=new Error(u||"Unknown error");g.reject(f),this.errorCallback&&this.errorCallback(f);}},this.worker.onerror=r=>{let s=new Error(r.message||"Worker error");this.errorCallback&&this.errorCallback(s);};}catch{console.warn("Web Worker not available, falling back to main thread");}}onProgress(e){return this.progressCallback=e,this}onChunk(e){return this._chunkCallback=e,this}onComplete(e){return this.completeCallback=e,this}onError(e){return this.errorCallback=e,this}async parse(e,n={}){let r=e instanceof File?await e.arrayBuffer():e;return this.sendRequest("parse",r,n)}async getSheetNames(e){let n=e instanceof File?await e.arrayBuffer():e;return this.sendRequest("getSheetNames",n)}sendRequest(e,n,r,s){if(!this.worker)return this.runInMainThread(e,n,r,s);let o=++this.requestId;return new Promise((i,u)=>{this.pending.set(o,{resolve:i,reject:u}),this.worker.postMessage({id:o,type:e,data:n,options:r,schema:s},[n]);})}async runInMainThread(e,n,r,s){let{parseExcel:o,getSheetNames:i}=await Promise.resolve().then(()=>(D(),L)),u=new Uint8Array(n);switch(e){case "parse":return o(u,r);case "getSheetNames":return i(u);default:throw new Error(`Unknown operation: ${e}`)}}terminate(){this.worker&&(this.worker.terminate(),this.worker=null);}};export{z as ExcelWorker};//# sourceMappingURL=worker.js.map
|
|
37
|
+
//# sourceMappingURL=worker.js.map
|